Conversation
| .onValueChange { _, _ -> chunkedRenderer.clear(); refreshChunkedRenderer(this) } | ||
| private val minLightLevel by setting("Min Light Level", 0, 0..15).onValueChange(::refreshChunkedRenderer) | ||
| private val renderMode by setting("Render Mode", RenderMode.Square).onValueChange(::refreshChunkedRenderer) | ||
| private val color by setting("Color", Color.RED).onValueChange(::refreshChunkedRenderer) | ||
| private val size by setting("Size", 14, 1..16).onValueChange(::refreshChunkedRenderer) | ||
| private val fill by setting("Fill", false) { renderMode == RenderMode.Square }.group(Group.Fill).onValueChange(::refreshChunkedRenderer) |
There was a problem hiding this comment.
Either put .onValueChange in a newline or not. You are doing both.
There was a problem hiding this comment.
In this case is makes more sense to have them on the same line as it is the same onValueChange repeated for most of the render settings and is small. Unique onValueChange's should be put on a new line as they offer new logic which should be more visible and readable. This is why the onValueChange is on a new line for the mode setting
| Radius | ||
| } | ||
|
|
||
| private enum class RenderMode { |
There was a problem hiding this comment.
Maybe extend NamedEnum and Describable ?
There was a problem hiding this comment.
its too simple. Its clear that selecting Cross would render crosses, and likewise for the others
| tickedRenderer("LightLevels Ticked Renderer", { depthTest }) { | ||
| if (mode != Mode.Radius) return@tickedRenderer | ||
| runSafe { | ||
| val playerPos = mc.gameRenderer.camera.pos.flooredBlockPos |
There was a problem hiding this comment.
Why flooredBlockPos? Why not more accurate with double values?
There was a problem hiding this comment.
it makes no difference. If you add 8 to 1.9999 and then floor it, it gives you the same value as 8 + 1. This would only be somewhat worth it if our range settings werent whole integers, but theres not much point in that
| // } | ||
| @Inject(method = "onLightUpdate", at = @At("RETURN")) | ||
| private void injectOnLightUpdate(LightType type, ChunkSectionPos pos, CallbackInfo ci) { | ||
| if (LightLevels.INSTANCE.isEnabled()) { |
There was a problem hiding this comment.
its a pretty niche mixin; doubt any other modules would need it. If the time comes we can always change it
adds renders to show when the light level gets below a given threshold on spawnable blocks. Has two modes; chunked and radius. Chunked will scan the entire loaded render distance, and radius will scan a smaller radius around the player