Skip to content

Commit

Permalink
Fix Luminous in FullBright and weird lighting when xray enabled (#3920)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexadecimal233 authored Aug 6, 2023
1 parent bb14113 commit 0c28f37
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import me.jellysquid.mods.sodium.client.model.light.data.LightDataAccess;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.Fullbright;
import meteordevelopment.meteorclient.systems.modules.render.Xray;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
Expand All @@ -23,7 +24,7 @@
@Mixin(value = LightDataAccess.class, remap = false)
public class SodiumLightDataAccessMixin {
@Unique
private static final int FULL_LIGHT = 15 << 20 | 15 << 4;
private static final int FULL_LIGHT = 15 | 15 << 4 | 15 << 8;

@Shadow
protected BlockRenderView world;
Expand All @@ -39,12 +40,17 @@ private void onInit(CallbackInfo info) {
}

@ModifyVariable(method = "compute", at = @At(value = "TAIL"), name = "bl")
private int compute_modifyAO(int light) {
private int compute_modifyBL(int light) {
if (xray.isActive()) {
BlockState state = world.getBlockState(pos);
if (!xray.isBlocked(state.getBlock(), pos)) return FULL_LIGHT;
}

return light;
}

@ModifyVariable(method = "compute", at = @At(value = "TAIL"), name = "sl")
private int compute_modifySL(int light) {
return Math.max(Modules.get().get(Fullbright.class).getLuminance(), light);
}
}

0 comments on commit 0c28f37

Please sign in to comment.