diff --git a/src/main/java/io/github/steveplays28/simpleseasons/config/SimpleSeasonsConfig.java b/src/main/java/io/github/steveplays28/simpleseasons/config/SimpleSeasonsConfig.java index a465290..9683422 100644 --- a/src/main/java/io/github/steveplays28/simpleseasons/config/SimpleSeasonsConfig.java +++ b/src/main/java/io/github/steveplays28/simpleseasons/config/SimpleSeasonsConfig.java @@ -3,6 +3,7 @@ import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; import dev.isxander.yacl3.config.v2.api.SerialEntry; import dev.isxander.yacl3.config.v2.api.autogen.AutoGen; +import dev.isxander.yacl3.config.v2.api.autogen.Boolean; import dev.isxander.yacl3.config.v2.api.autogen.FloatField; import dev.isxander.yacl3.config.v2.api.autogen.FloatSlider; import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; @@ -31,4 +32,8 @@ public class SimpleSeasonsConfig { @SerialEntry(comment = "The length multiplier of seasons. Increasing this value will result in longer seasons and decreasing this value will result in shorter seasons.") @FloatField(min = 0.0001f, format = "%.4f") public float seasonLengthMultiplier = 1f; + @AutoGen(category = SERVER_CATEGORY) + @SerialEntry(comment = "Determines if ice should form in water (with the exception of water in oceans and water in biomes with a wet/dry season) during winter.") + @Boolean(colored = true) + public boolean iceFormationInWaterDuringWinter = true; } diff --git a/src/main/java/io/github/steveplays28/simpleseasons/mixin/world/biome/BiomeMixin.java b/src/main/java/io/github/steveplays28/simpleseasons/mixin/world/biome/BiomeMixin.java index f8805ee..1f275c8 100644 --- a/src/main/java/io/github/steveplays28/simpleseasons/mixin/world/biome/BiomeMixin.java +++ b/src/main/java/io/github/steveplays28/simpleseasons/mixin/world/biome/BiomeMixin.java @@ -1,6 +1,7 @@ package io.github.steveplays28.simpleseasons.mixin.world.biome; import io.github.steveplays28.simpleseasons.api.SimpleSeasonsApi; +import io.github.steveplays28.simpleseasons.config.SimpleSeasonsConfig; import io.github.steveplays28.simpleseasons.state.world.SeasonTracker; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBiomeTags; import net.minecraft.block.Blocks; @@ -28,7 +29,7 @@ public abstract class BiomeMixin { return; } - if ( !this.hasPrecipitation() || SimpleSeasonsApi.biomeHasWetAndDrySeasons( + if (!this.hasPrecipitation() || SimpleSeasonsApi.biomeHasWetAndDrySeasons( world.getBiome(blockPos)) || !Blocks.SNOW.getDefaultState().canPlaceAt(world, blockPos)) { cir.setReturnValue(false); return; @@ -39,12 +40,14 @@ public abstract class BiomeMixin { @Inject(method = "canSetIce(Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;Z)Z", at = @At(value = "HEAD"), cancellable = true) private void simple_seasons$canSetIceAllowSettingIceInWinter(@NotNull WorldView worldView, @NotNull BlockPos blockPos, boolean doWaterCheck, @NotNull CallbackInfoReturnable cir) { - if (!(worldView instanceof @NotNull World world) || !SimpleSeasonsApi.worldHasSeasons(world)) { + if (!(worldView instanceof @NotNull World world) || !SimpleSeasonsApi.worldHasSeasons( + world) || !SimpleSeasonsConfig.HANDLER.instance().iceFormationInWaterDuringWinter) { return; } var biome = world.getBiome(blockPos); - if (biome.isIn(ConventionalBiomeTags.OCEAN) || SimpleSeasonsApi.biomeHasWetAndDrySeasons(world.getBiome(blockPos)) || world.getLightLevel( + if (biome.isIn(ConventionalBiomeTags.OCEAN) || SimpleSeasonsApi.biomeHasWetAndDrySeasons( + world.getBiome(blockPos)) || world.getLightLevel( LightType.BLOCK, blockPos) >= 10 || doWaterCheck && !world.getFluidState(blockPos).isOf(Fluids.WATER)) { cir.setReturnValue(false); return; diff --git a/src/main/resources/assets/simple_seasons/lang/en_us.json b/src/main/resources/assets/simple_seasons/lang/en_us.json index abd88cb..accd5fa 100644 --- a/src/main/resources/assets/simple_seasons/lang/en_us.json +++ b/src/main/resources/assets/simple_seasons/lang/en_us.json @@ -4,5 +4,7 @@ "yacl3.config.simple-seasons:config.seasonProgressUpdateRate": "Season Progress Update Rate", "yacl3.config.simple-seasons:config.seasonProgressUpdateRate.desc": "The rate at which the season progress updates. Every time the season progress updates in a world, a packet is sent to all clients in that world containing the new season progress. Subsequently, all clients in that world will reload the world's color and schedule a rebuild for all chunks.\nIncreasing this value will result in packets being sent more often to all clients in a world and thus season colors will update more often on all clients in that world. Decreasing this value will result in packets being sent less often to all clients in a world and thus season colors will update less often on all clients in that world. This config option can be performance intensive if set too high.", "yacl3.config.simple-seasons:config.seasonLengthMultiplier": "Season Length Multiplier", - "yacl3.config.simple-seasons:config.seasonLengthMultiplier.desc": "The length multiplier of seasons. Increasing this value will result in longer seasons and decreasing this value will result in shorter seasons." + "yacl3.config.simple-seasons:config.seasonLengthMultiplier.desc": "The length multiplier of seasons. Increasing this value will result in longer seasons and decreasing this value will result in shorter seasons.", + "yacl3.config.simple-seasons:config.iceFormationInWaterDuringWinter": "Ice Formation In Water During Winter", + "yacl3.config.simple-seasons:config.iceFormationInWaterDuringWinter.desc": "Determines if ice should form in water (with the exception of water in oceans and water in biomes with a wet/dry season) during winter." }