Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Luminous in FullBright and weird lighting when xray enabled #3920

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}