Skip to content

Commit 01ac6b0

Browse files
committed
Fixed fullbright for shaders
1 parent 745634a commit 01ac6b0

File tree

1 file changed

+25
-1
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/render

1 file changed

+25
-1
lines changed

common/src/main/kotlin/com/lambda/module/modules/render/Fullbright.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,35 @@
1717

1818
package com.lambda.module.modules.render
1919

20+
import com.lambda.context.SafeContext
21+
import com.lambda.event.events.TickEvent
22+
import com.lambda.event.listener.SafeListener.Companion.listenOnce
2023
import com.lambda.module.Module
2124
import com.lambda.module.tag.ModuleTag
25+
import net.minecraft.entity.effect.StatusEffectInstance
26+
import net.minecraft.entity.effect.StatusEffects
2227

2328
object Fullbright : Module(
2429
name = "Fullbright",
2530
description = "Makes everything brighter",
2631
defaultTags = setOf(ModuleTag.RENDER)
27-
)
32+
) {
33+
private val nightVision by setting("Night Vision", false, description = "Adds the night vision effect client-side")
34+
.onValueChange { _, to -> setNightVision(to) }
35+
36+
private val instance = StatusEffectInstance(StatusEffects.NIGHT_VISION, -1, 1, false, false)
37+
38+
init {
39+
listenOnce<TickEvent.Pre> {
40+
if (nightVision && !player.hasStatusEffect(StatusEffects.NIGHT_VISION)) setNightVision(true)
41+
42+
// Destroy the listener
43+
true
44+
}
45+
}
46+
47+
private fun SafeContext.setNightVision(value: Boolean) {
48+
if (value) player.addStatusEffect(instance)
49+
else player.removeStatusEffect(StatusEffects.NIGHT_VISION)
50+
}
51+
}

0 commit comments

Comments
 (0)