Skip to content
Merged
Show file tree
Hide file tree
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 @@ -39,10 +39,12 @@ public class LightmapTextureManagerMixin {
@Final
private GpuTexture glTexture;

@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V", shift = At.Shift.BEFORE))
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/MappableRingBuffer;rotate()V", shift = At.Shift.AFTER))
private void injectUpdate(float tickProgress, CallbackInfo ci) {
if (Fullbright.INSTANCE.isEnabled() || XRay.INSTANCE.isEnabled()) {
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(glTexture, ColorHelper.fullAlpha(ColorHelper.getWhite(1.0f)));
if (XRay.INSTANCE.isEnabled() || (Fullbright.INSTANCE.isEnabled() && !Fullbright.getNightVision())) {
RenderSystem.getDevice()
.createCommandEncoder()
.clearColorTexture(glTexture, ColorHelper.fullAlpha(ColorHelper.getWhite(1.0f)));
}
}

Expand Down
15 changes: 8 additions & 7 deletions src/main/kotlin/com/lambda/module/modules/render/Fullbright.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package com.lambda.module.modules.render
import com.lambda.config.entries.Setting.Companion.onValueChange
import com.lambda.context.SafeContext
import com.lambda.event.events.TickEvent
import com.lambda.event.listener.SafeListener.Companion.listenOnce
import com.lambda.event.listener.SafeListener.Companion.listen
import com.lambda.module.Module
import com.lambda.module.tag.ModuleTag
import net.minecraft.entity.effect.StatusEffectInstance
Expand All @@ -31,17 +31,18 @@ object Fullbright : Module(
description = "Makes everything brighter",
tag = ModuleTag.RENDER,
) {
private val nightVision by setting("Night Vision", false, description = "Adds the night vision effect client-side")
.onValueChange { _, to -> setNightVision(to) }
@JvmStatic val nightVision by setting("Night Vision", false, description = "Use client-side night vision for better compatibility with shaders")
.onValueChange { _, to -> if (isEnabled) setNightVision(to) }

private val instance = StatusEffectInstance(StatusEffects.NIGHT_VISION, -1, 1, false, false)

init {
listenOnce<TickEvent.Pre> {
if (nightVision && !player.hasStatusEffect(StatusEffects.NIGHT_VISION)) setNightVision(true)
onDisable {
if (nightVision && player.hasStatusEffect(StatusEffects.NIGHT_VISION)) setNightVision(false)
}

// Destroy the listener
true
listen<TickEvent.Pre> {
if (nightVision && !player.hasStatusEffect(StatusEffects.NIGHT_VISION)) setNightVision(true)
}
}

Expand Down