[Change] Removed old Sodium compatibility Code (#317)

This commit is contained in:
Frank 2023-12-19 21:59:12 +01:00
parent eef4def2f8
commit 5ee9012367

View file

@ -5,14 +5,11 @@ import org.betterx.betterend.client.ClientOptions;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.ui.ColorUtil; import org.betterx.ui.ColorUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BiomeColors; import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockAndTintGetter;
import net.fabricmc.loader.api.FabricLoader;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@ -31,19 +28,16 @@ public class BiomeColorsMixin {
private static final int BE_STREAM_COLOR = ColorUtil.color(105, 213, 244); private static final int BE_STREAM_COLOR = ColorUtil.color(105, 213, 244);
@Unique @Unique
private static final Point[] BE_OFFSETS; private static final Point[] BE_OFFSETS;
@Unique
private static final boolean BE_HAS_SODIUM;
@Inject(method = "getAverageWaterColor", at = @At("RETURN"), cancellable = true) @Inject(method = "getAverageWaterColor", at = @At("RETURN"), cancellable = true)
private static void be_getWaterColor(BlockAndTintGetter world, BlockPos pos, CallbackInfoReturnable<Integer> info) { private static void be_getWaterColor(BlockAndTintGetter world, BlockPos pos, CallbackInfoReturnable<Integer> info) {
if (ClientOptions.useSulfurWaterColor()) { if (ClientOptions.useSulfurWaterColor()) {
BlockAndTintGetter view = BE_HAS_SODIUM ? Minecraft.getInstance().level : world;
MutableBlockPos mut = new MutableBlockPos(); MutableBlockPos mut = new MutableBlockPos();
mut.setY(pos.getY()); mut.setY(pos.getY());
for (int i = 0; i < BE_OFFSETS.length; i++) { for (int i = 0; i < BE_OFFSETS.length; i++) {
mut.setX(pos.getX() + BE_OFFSETS[i].x); mut.setX(pos.getX() + BE_OFFSETS[i].x);
mut.setZ(pos.getZ() + BE_OFFSETS[i].y); mut.setZ(pos.getZ() + BE_OFFSETS[i].y);
if ((view.getBlockState(mut).is(EndBlocks.BRIMSTONE))) { if ((world.getBlockState(mut).is(EndBlocks.BRIMSTONE))) {
info.setReturnValue(i < 4 ? BE_POISON_COLOR : BE_STREAM_COLOR); info.setReturnValue(i < 4 ? BE_POISON_COLOR : BE_STREAM_COLOR);
return; return;
} }
@ -52,8 +46,6 @@ public class BiomeColorsMixin {
} }
static { static {
BE_HAS_SODIUM = FabricLoader.getInstance().isModLoaded("sodium");
int index = 0; int index = 0;
BE_OFFSETS = new Point[20]; BE_OFFSETS = new Point[20];
for (int x = -2; x < 3; x++) { for (int x = -2; x < 3; x++) {