Multicolored water
This commit is contained in:
parent
2441a059e1
commit
5ba742d8b2
2 changed files with 33 additions and 17 deletions
|
@ -8,38 +8,54 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import net.minecraft.client.color.world.BiomeColors;
|
import net.minecraft.client.color.world.BiomeColors;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockPos.Mutable;
|
import net.minecraft.util.math.BlockPos.Mutable;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.world.BlockRenderView;
|
import net.minecraft.world.BlockRenderView;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
import ru.betterend.util.BlocksHelper;
|
||||||
import ru.betterend.util.MHelper;
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
@Mixin(BiomeColors.class)
|
@Mixin(BiomeColors.class)
|
||||||
public class BiomeColorsMixin {
|
public class BiomeColorsMixin {
|
||||||
private static final int POISON_COLOR = MHelper.color(92, 160, 78);
|
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)
|
@Inject(method = "getWaterColor", at = @At("RETURN"), cancellable = true)
|
||||||
private static void beGetWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable<Integer> info) {
|
private static void beGetWaterColor(BlockRenderView world, BlockPos pos, CallbackInfoReturnable<Integer> 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();
|
int color = info.getReturnValue();
|
||||||
boolean cont = true;
|
|
||||||
for (int x = x1; x < x2 && cont; x++) {
|
boolean scanDeep = true;
|
||||||
mut.setX(x);
|
Mutable mut = new Mutable();
|
||||||
for (int y = y1; y < y2 && cont; y++) {
|
for (Direction d: BlocksHelper.HORIZONTAL) {
|
||||||
mut.setY(y);
|
mut.set(pos).move(d);
|
||||||
for (int z = z1; z < z2 && cont; z++) {
|
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);
|
mut.setZ(z);
|
||||||
if (world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE)) {
|
if (Math.abs(pos.getX() - x) != 2 || Math.abs(pos.getZ() - z) != 2) {
|
||||||
color = POISON_COLOR;
|
if ((world.getBlockState(mut).isOf(EndBlocks.BRIMSTONE))) {
|
||||||
cont = false;
|
color = STREAM_COLOR;
|
||||||
|
scanDeep = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setReturnValue(color);
|
info.setReturnValue(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class BiomeSulfurSprings extends EndBiome {
|
||||||
public BiomeSulfurSprings() {
|
public BiomeSulfurSprings() {
|
||||||
super(new BiomeDefinition("sulfur_springs")
|
super(new BiomeDefinition("sulfur_springs")
|
||||||
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
||||||
.setWaterAndFogColor(105, 213, 244)
|
.setWaterAndFogColor(25, 90, 157)
|
||||||
.setFogColor(207, 194, 62)
|
.setFogColor(207, 194, 62)
|
||||||
.setFogDensity(1.5F)
|
.setFogDensity(1.5F)
|
||||||
.setCaves(false)
|
.setCaves(false)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue