diff --git a/build.gradle b/build.gradle index 9628ef7..22b4995 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.8-SNAPSHOT' id 'maven-publish' } @@ -28,14 +28,9 @@ dependencies { processResources { inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" + filesMatching("fabric.mod.json") { expand "version": project.version } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } } // ensure that the encoding is set to UTF-8, no matter what the system default is diff --git a/gradle.properties b/gradle.properties index f573ec8..f9834e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,11 +2,11 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.16.4 -yarn_mappings=1.16.4+build.7 +minecraft_version=1.17.1 +yarn_mappings=1.17.1+build.35 loader_version=0.10.8 # Mod Properties -mod_version=1.0.1 +mod_version=1.0.2+1.17.1 maven_group=dev.hephaestus archives_base_name=seedy-behavior diff --git a/gradlew b/gradlew index fbd7c51..4f906e0 100644 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 5093609..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/java/dev/hephaestus/seedy/mixin/world/biome/source/MultiNoiseBiomeSourceMixin.java b/src/main/java/dev/hephaestus/seedy/mixin/world/biome/source/MultiNoiseBiomeSourceMixin.java index 081a865..3a15567 100644 --- a/src/main/java/dev/hephaestus/seedy/mixin/world/biome/source/MultiNoiseBiomeSourceMixin.java +++ b/src/main/java/dev/hephaestus/seedy/mixin/world/biome/source/MultiNoiseBiomeSourceMixin.java @@ -1,25 +1,16 @@ package dev.hephaestus.seedy.mixin.world.biome.source; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.PrimitiveCodec; import dev.hephaestus.seedy.SeedSupplier; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.MultiNoiseBiomeSource; -import net.minecraft.world.gen.ChunkRandom; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.List; -import java.util.Optional; -import java.util.function.Supplier; @Mixin(MultiNoiseBiomeSource.class) public class MultiNoiseBiomeSourceMixin { @@ -31,17 +22,14 @@ private static MapCodec giveUsRandomSeeds(PrimitiveCodec codec, fina return codec.fieldOf(name).orElseGet(SeedSupplier::getSeed); } - @Inject(method = "(JLjava/util/List;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Ljava/util/Optional;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;seed:J", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER)) - private void replaceSeed(long seed, List>> biomePoints, MultiNoiseBiomeSource.NoiseParameters temperatureNoiseParameters, MultiNoiseBiomeSource.NoiseParameters humidityNoiseParameters, MultiNoiseBiomeSource.NoiseParameters altitudeNoiseParameters, MultiNoiseBiomeSource.NoiseParameters weirdnessNoiseParameters, Optional, MultiNoiseBiomeSource.Preset>> instance, CallbackInfo ci) { + @ModifyVariable(method = "(JLjava/util/List;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Ljava/util/Optional;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;seed:J", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER), ordinal = 0) + private long replaceSeed(long seed) { if (seed == SeedSupplier.MARKER) { - this.seed = LAST_SEED; + return LAST_SEED; } else { LAST_SEED = seed; } - } - @Redirect(method = "(JLjava/util/List;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource$NoiseParameters;Ljava/util/Optional;)V", at = @At(value = "NEW", target = "net/minecraft/world/gen/ChunkRandom")) - private ChunkRandom useOurSeed(long seed) { - return new ChunkRandom(this.seed); + return seed; } } diff --git a/src/main/java/dev/hephaestus/seedy/mixin/world/gen/chunk/NoiseChunkGeneratorMixin.java b/src/main/java/dev/hephaestus/seedy/mixin/world/gen/chunk/NoiseChunkGeneratorMixin.java index 017a259..cbd2be8 100644 --- a/src/main/java/dev/hephaestus/seedy/mixin/world/gen/chunk/NoiseChunkGeneratorMixin.java +++ b/src/main/java/dev/hephaestus/seedy/mixin/world/gen/chunk/NoiseChunkGeneratorMixin.java @@ -4,25 +4,18 @@ import com.mojang.serialization.codecs.PrimitiveCodec; import dev.hephaestus.seedy.SeedSupplier; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; -import net.minecraft.world.gen.chunk.ChunkGeneratorSettings; import net.minecraft.world.gen.chunk.NoiseChunkGenerator; import net.minecraft.world.gen.chunk.StructuresConfig; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.function.Supplier; @Mixin(NoiseChunkGenerator.class) public abstract class NoiseChunkGeneratorMixin extends ChunkGenerator { - @Shadow public long seed; @Unique private static long LAST_SEED = SeedSupplier.MARKER; public NoiseChunkGeneratorMixin(BiomeSource biomeSource, StructuresConfig structuresConfig) { @@ -34,18 +27,14 @@ private static MapCodec giveUsRandomSeeds(PrimitiveCodec codec, fina return codec.fieldOf(name).orElseGet(SeedSupplier::getSeed); } - @Inject(method = "(Lnet/minecraft/world/biome/source/BiomeSource;Lnet/minecraft/world/biome/source/BiomeSource;JLjava/util/function/Supplier;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/world/gen/chunk/NoiseChunkGenerator;seed:J", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER)) - private void replaceSeed(BiomeSource populationSource, BiomeSource biomeSource, long seed, Supplier settings, CallbackInfo ci) { + @ModifyVariable(method = "(Lnet/minecraft/world/biome/source/BiomeSource;Lnet/minecraft/world/biome/source/BiomeSource;JLjava/util/function/Supplier;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/world/gen/chunk/NoiseChunkGenerator;seed:J", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER), ordinal = 0) + private long replaceSeed(long seed) { if (seed == SeedSupplier.MARKER) { - this.seed = LAST_SEED; - this.worldSeed = LAST_SEED; + return LAST_SEED; } else { LAST_SEED = seed; } - } - @Redirect(method = "(Lnet/minecraft/world/biome/source/BiomeSource;Lnet/minecraft/world/biome/source/BiomeSource;JLjava/util/function/Supplier;)V", at = @At(value = "NEW", target = "net/minecraft/world/gen/ChunkRandom")) - private ChunkRandom useOurSeed(long seed) { - return new ChunkRandom(this.seed); + return seed; } }