Water color option, disabling color if sodium is installed
This commit is contained in:
parent
7d178dedb0
commit
f62f88e4bd
2 changed files with 50 additions and 33 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Integer> info) {
|
||||
int color = info.getReturnValue();
|
||||
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;
|
||||
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;
|
||||
if (scanDeep) {
|
||||
int x1 = pos.getX() - 2;
|
||||
int z1 = pos.getZ() - 2;
|
||||
|
||||
int x2 = pos.getX() + 3;
|
||||
int z2 = pos.getZ() + 3;
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue