diff --git a/build.gradle b/build.gradle index 6c60dd699..f86620951 100644 --- a/build.gradle +++ b/build.gradle @@ -9,11 +9,12 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2' } } + apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. @@ -25,20 +26,24 @@ version = 'a1.5.2' group = 'com.seibel.lod' archivesBaseName = 'Distant-Horizons_1.16.5' - -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. +java.toolchain.languageVersion = JavaLanguageVersion.of(16) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { - // The mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD Snapshot are built nightly. - // stable_# Stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not always work. + // The mappings can be changed at any time and must be in the following format. + // Channel: Version: + // snapshot YYYYMMDD Snapshot are built nightly. + // stable # Stables are built at the discretion of the MCP team. + // official MCVersion Official field/method names from Mojang mapping files + // + // You must be aware of the Mojang license when using the 'official' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'official', version: '1.16.5' + mappings channel: 'official', version: '1.17.1' - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. @@ -49,7 +54,7 @@ minecraft { arg "-mixin.config=lod.mixins.json" // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -72,7 +77,7 @@ minecraft { arg "-mixin.config=lod.mixins.json" // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -94,7 +99,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -134,16 +139,15 @@ configurations { } dependencies { - // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.16.5-36.1.0' + minecraft 'net.minecraftforge:forge:1.17.1-37.0.103' - - compile 'org.tukaani:xz:1.9' - shadowMe 'org.tukaani:xz:1.9' - compile 'org.apache.commons:commons-compress:1.21' - shadowMe 'org.apache.commons:commons-compress:1.21' + //compile 'org.tukaani:xz:1.9' + //shadowMe 'org.tukaani:xz:1.9' + //compile 'org.apache.commons:commons-compress:1.21' + //shadowMe 'org.apache.commons:commons-compress:1.21' // these were added to hopefully allow for cloning // configuredFeatures to allow for safe @@ -158,19 +162,10 @@ dependencies { //implementation 'org.objenesis:objenesis:3.2' - // You may put jars on which you depend on in ./libs or you may define them like so.. - // compile "some.group:artifact:version:classifier" - // compile "some.group:artifact:version" - - // Real examples - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // These dependencies get remapped to your current MCP mappings - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html @@ -204,12 +199,13 @@ jar { "Specification-Title": "LOD", "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, - "Implementation-Version": "1", + "Implementation-Version" : project.jar.archiveVersion, "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "MixinConfigs": "lod.mixins.json", ]) } } + // Example configuration to allow publishing using the maven-publish task // This is the preferred method to reobfuscate your jar file jar.finalizedBy('reobfJar') @@ -224,11 +220,11 @@ publishing { } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/mcmodsrepo" } } } mixin { add sourceSets.main, "lod.refmap.json" -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee9..7454180f2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1d5b29fbd..ffed3a254 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip diff --git a/gradlew.bat b/gradlew.bat index 808465d8d..f9553162f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -17,30 +17,30 @@ set APP_HOME=%DIRNAME% set DEFAULT_JVM_OPTS= @rem Find java.exe -if defined JAVA_MC_HOME goto findJavaFromJavaHome +if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if "%ERRORLEVEL%" == "0" goto init echo. -echo ERROR: JAVA_MC_HOME is not set and no 'java' command could be found in your PATH. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. -echo Please set the JAVA_MC_HOME variable in your environment to match the +echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :findJavaFromJavaHome -set JAVA_MC_HOME=%JAVA_MC_HOME:"=% -set JAVA_EXE=%JAVA_MC_HOME%/bin/java.exe +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto init echo. -echo ERROR: JAVA_MC_HOME is set to an invalid directory: %JAVA_MC_HOME% +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. -echo Please set the JAVA_MC_HOME variable in your environment to match the +echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail diff --git a/src/main/java/com/seibel/lod/LodMain.java b/src/main/java/com/seibel/lod/LodMain.java index 19e88b0bc..5a256070c 100644 --- a/src/main/java/com/seibel/lod/LodMain.java +++ b/src/main/java/com/seibel/lod/LodMain.java @@ -29,8 +29,8 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fmlserverevents.FMLServerStartedEvent; /** * Initialize and setup the Mod. @@ -74,7 +74,7 @@ public class LodMain @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) + public void onServerStarting(FMLServerStartedEvent event) { // this is called when the server starts } diff --git a/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java b/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java index 1d9aca68f..57613f907 100644 --- a/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java +++ b/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java @@ -24,12 +24,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Matrix4f; import com.seibel.lod.LodMain; import com.seibel.lod.config.LodConfig; +import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; /** * This class is used to mix in my rendering code @@ -41,25 +42,25 @@ import net.minecraft.client.renderer.WorldRenderer; * @author James Seibel * @version 9-19-2021 */ -@Mixin(WorldRenderer.class) +@Mixin(LevelRenderer.class) public class MixinWorldRenderer { private static float previousPartialTicks = 0; - @Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V") - private void renderSky(MatrixStack matrixStackIn, float partialTicks, CallbackInfo callback) + @Inject(at = @At("RETURN"), method = "renderClouds(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/math/Matrix4f;FDDD)V") + private void renderClouds(PoseStack modelViewMatrixStack, Matrix4f projectionMatrix, float partialTicks, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, CallbackInfo callback) { - // get the partial ticks since renderBlockLayer doesn't + // get the partial ticks since renderChunkLayer doesn't // have access to them previousPartialTicks = partialTicks; } - @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/matrix/MatrixStack;DDD)V") - private void renderChunkLayer(RenderType renderType, MatrixStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback) + @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V") + private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) { // only render if LODs are enabled and // only render before solid blocks if (LodConfig.CLIENT.advancedModOptions.debugging.drawLods.get() && renderType.equals(RenderType.solid())) - LodMain.client_proxy.renderLods(matrixStackIn, previousPartialTicks); + LodMain.client_proxy.renderLods(modelViewMatrixStack, previousPartialTicks); } }