@@ -20,7 +20,7 @@ package com.lambda.module.modules.render
2020import com.lambda.config.entries.Setting.Companion.onValueChange
2121import com.lambda.context.SafeContext
2222import com.lambda.event.events.TickEvent
23- import com.lambda.event.listener.SafeListener.Companion.listenOnce
23+ import com.lambda.event.listener.SafeListener.Companion.listen
2424import com.lambda.module.Module
2525import com.lambda.module.tag.ModuleTag
2626import net.minecraft.entity.effect.StatusEffectInstance
@@ -31,17 +31,18 @@ object Fullbright : Module(
3131 description = " Makes everything brighter" ,
3232 tag = ModuleTag .RENDER ,
3333) {
34- private val nightVision by setting(" Night Vision" , false , description = " Adds the night vision effect client-side " )
35- .onValueChange { _, to -> setNightVision(to) }
34+ @JvmStatic val nightVision by setting(" Night Vision" , false , description = " Use client-side night vision for better compatibility with shaders " )
35+ .onValueChange { _, to -> if (isEnabled) setNightVision(to) }
3636
3737 private val instance = StatusEffectInstance (StatusEffects .NIGHT_VISION , - 1 , 1 , false , false )
3838
3939 init {
40- listenOnce<TickEvent .Pre > {
41- if (nightVision && ! player.hasStatusEffect(StatusEffects .NIGHT_VISION )) setNightVision(true )
40+ onDisable {
41+ if (nightVision && player.hasStatusEffect(StatusEffects .NIGHT_VISION )) setNightVision(false )
42+ }
4243
43- // Destroy the listener
44- true
44+ listen< TickEvent . Pre > {
45+ if (nightVision && ! player.hasStatusEffect( StatusEffects . NIGHT_VISION )) setNightVision( true )
4546 }
4647 }
4748
0 commit comments