From 5ba742d8b2e12118b9df27281bd3302ee99372fd Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Wed, 2 Dec 2020 17:46:14 +0300 Subject: [PATCH] Multicolored water --- .../mixin/client/BiomeColorsMixin.java | 48 ++++++++++++------- .../world/biome/BiomeSulfurSprings.java | 2 +- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java b/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java index b31ed275..6ad1f324 100644 --- a/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java +++ b/src/main/java/ru/betterend/mixin/client/BiomeColorsMixin.java @@ -8,38 +8,54 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.client.color.world.BiomeColors; 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.registry.EndBlocks; +import ru.betterend.util.BlocksHelper; import ru.betterend.util.MHelper; @Mixin(BiomeColors.class) public class BiomeColorsMixin { private static final int POISON_COLOR = MHelper.color(92, 160, 78); + private static final int STREAM_COLOR = MHelper.color(105, 213, 244); @Inject(method = "getWaterColor", at = @At("RETURN"), cancellable = true) private static void beGetWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable info) { - int x1 = pos.getX() - 1; - int y1 = pos.getY() - 1; - int z1 = pos.getZ() - 1; - int x2 = pos.getX() + 2; - int y2 = pos.getY() + 2; - int z2 = pos.getZ() + 2; - Mutable mut = new Mutable(); int color = info.getReturnValue(); - boolean cont = true; - for (int x = x1; x < x2 && cont; x++) { - mut.setX(x); - for (int y = y1; y < y2 && cont; y++) { - mut.setY(y); - for (int z = z1; z < z2 && cont; z++) { + + 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 (world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE)) { - color = POISON_COLOR; - cont = false; + 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); } } diff --git a/src/main/java/ru/betterend/world/biome/BiomeSulfurSprings.java b/src/main/java/ru/betterend/world/biome/BiomeSulfurSprings.java index 39989c15..38664808 100644 --- a/src/main/java/ru/betterend/world/biome/BiomeSulfurSprings.java +++ b/src/main/java/ru/betterend/world/biome/BiomeSulfurSprings.java @@ -9,7 +9,7 @@ public class BiomeSulfurSprings extends EndBiome { public BiomeSulfurSprings() { super(new BiomeDefinition("sulfur_springs") .setSurface(SurfaceBuilders.SULPHURIC_SURFACE) - .setWaterAndFogColor(105, 213, 244) + .setWaterAndFogColor(25, 90, 157) .setFogColor(207, 194, 62) .setFogDensity(1.5F) .setCaves(false)