diff --git a/src/main/java/ru/betterend/client/ClientOptions.java b/src/main/java/ru/betterend/client/ClientOptions.java index de13c4ec..e17b3c5d 100644 --- a/src/main/java/ru/betterend/client/ClientOptions.java +++ b/src/main/java/ru/betterend/client/ClientOptions.java @@ -1,16 +1,22 @@ package ru.betterend.client; +import net.fabricmc.loader.api.FabricLoader; import ru.betterend.config.Configs; public class ClientOptions { private static boolean customSky; private static boolean useFogDensity; private static boolean blendBiomeMusic; + private static boolean sulfurWaterColor; public static void init() { - setCustomSky(Configs.CLENT_CONFIG.getBooleanRoot("customSky", true)); - setUseFogDensity(Configs.CLENT_CONFIG.getBooleanRoot("useFogDensity", true)); - setBlendBiomeMusic(Configs.CLENT_CONFIG.getBooleanRoot("blendBiomeMusic", true)); + customSky = Configs.CLENT_CONFIG.getBooleanRoot("customSky", true); + useFogDensity = Configs.CLENT_CONFIG.getBooleanRoot("useFogDensity", true); + blendBiomeMusic = Configs.CLENT_CONFIG.getBooleanRoot("blendBiomeMusic", true); + sulfurWaterColor = Configs.CLENT_CONFIG.getBooleanRoot("sulfurWaterColor", true); + if (sulfurWaterColor) { + sulfurWaterColor = !FabricLoader.getInstance().isModLoaded("sodium"); + } Configs.CLENT_CONFIG.saveChanges(); } @@ -37,4 +43,12 @@ public class ClientOptions { public static void setBlendBiomeMusic(boolean blendBiomeMusic) { ClientOptions.blendBiomeMusic = blendBiomeMusic; } + + public static boolean useSulfurWaterColor() { + return sulfurWaterColor; + } + + public static void setSulfurWaterColor(boolean sulfurWaterColor) { + ClientOptions.sulfurWaterColor = sulfurWaterColor && !FabricLoader.getInstance().isModLoaded("sodium"); + } } diff --git a/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java b/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java index 15bc3b69..195ca679 100644 --- a/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java +++ b/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java @@ -10,6 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos.Mutable; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; +import ru.betterend.client.ClientOptions; import ru.betterend.registry.EndBlocks; import ru.betterend.util.BlocksHelper; import ru.betterend.util.MHelper; @@ -21,41 +22,43 @@ public class BiomeColorsMixin { @Inject(method = "getWaterColor", at = @At("RETURN"), cancellable = true) private static void be_getWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable info) { - int color = info.getReturnValue(); - - boolean scanDeep = true; - Mutable mut = new Mutable(); - for (Direction d: BlocksHelper.HORIZONTAL) { - mut.set(pos).move(d); - if ((world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE))) { - color = POISON_COLOR; - scanDeep = false; - break; + if (ClientOptions.useSulfurWaterColor()) { + int color = info.getReturnValue(); + + boolean scanDeep = true; + Mutable mut = new Mutable(); + for (Direction d: BlocksHelper.HORIZONTAL) { + mut.set(pos).move(d); + if ((world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE))) { + color = POISON_COLOR; + scanDeep = false; + break; + } } - } - - if (scanDeep) { - int x1 = pos.getX() - 2; - int z1 = pos.getZ() - 2; - - int x2 = pos.getX() + 3; - int z2 = pos.getZ() + 3; - - mut.setY(pos.getY()); - for (int x = x1; x < x2 && scanDeep; x++) { - mut.setX(x); - for (int z = z1; z < z2 && scanDeep; z++) { - mut.setZ(z); - if (Math.abs(pos.getX() - x) != 2 || Math.abs(pos.getZ() - z) != 2) { - if ((world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE))) { - color = STREAM_COLOR; - scanDeep = false; + + if (scanDeep) { + int x1 = pos.getX() - 2; + int z1 = pos.getZ() - 2; + + int x2 = pos.getX() + 3; + int z2 = pos.getZ() + 3; + + mut.setY(pos.getY()); + for (int x = x1; x < x2 && scanDeep; x++) { + mut.setX(x); + for (int z = z1; z < z2 && scanDeep; z++) { + mut.setZ(z); + if (Math.abs(pos.getX() - x) != 2 || Math.abs(pos.getZ() - z) != 2) { + if ((world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE))) { + color = STREAM_COLOR; + scanDeep = false; + } } } } } + + info.setReturnValue(color); } - - info.setReturnValue(color); } }