package com.arslaancodes.arslaansmagichax.mixin; import com.arslaancodes.arslaansmagichax.ArslaansMagicHaxClient; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.Objects; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @Mixin(BlockBehaviour.class) public class AbstractBlockMixin { private static Minecraft mc = Minecraft.getInstance(); @Inject(method = "getShadeBrightness", at = @At("HEAD"), cancellable = true) private void onGetAmbientOcclusionLightLevel(BlockState state, BlockGetter world, BlockPos pos, CallbackInfoReturnable cir) { if (mc == null) mc = Minecraft.getInstance(); // just in case :) if (mc != null) { if (mc.level != null && (ArslaansMagicHaxClient.fullbright.isEnabled())) { if (Objects.equals(ArslaansMagicHaxClient.fullbright.mode.getMode(), "Break AO Renderer")) { cir.setReturnValue(15.0F); // over the limit of 1.0F, breaks the ambient occlusion renderer and messes everything up :) yay } else { cir.setReturnValue(1.0F); } } } } }