Comment quality + 1 comment accuracy fix

This commit is contained in:
OrderedSet committed 2026-11-08 00:34:56 -08:00
1 parent aa8f1c8adb
commit ef8cac9c39
5 files changed
+14 -21

No files matched your search

@@ -4,7 +4,7 @@ import net.minecraft.client.renderer.GLAllocation;
import org.lwjgl.opengl.GL11;
/** A GL display list of the mob spawn overlay. */
/** The mob spawn overlay quads, compiled into a GL display list. */
public final class MobOverlayDisplayList {
private int listId = -1;
@@ -2,7 +2,7 @@ package codechicken.nei;
import net.minecraft.client.renderer.Tessellator;
/** The vertices of the mob spawn overlay on the top face of one block. */
/** Vertex builder for one block's top face in the mob spawn overlay. */
public final class MobOverlayFace {
public static final byte OUTSIDE_SCAN = -2;
@@ -13,8 +13,8 @@ import net.minecraft.world.chunk.Chunk;
import codechicken.lib.math.MathHelper;
/**
* The mob spawn modes of the blocks around the player, scanned a slice per tick into a back buffer. The buffers swap
* when a pass is done. The column of a block or light change is rescanned on the next tick. The modes come from
* Spawn modes around the player, scanned a slice per tick into a back buffer. The buffers swap when a pass is done. The
* column of a block or light change is rescanned on the next tick. The modes come from
* {@link WorldOverlayRenderer#getSpawnMode}: 0 for no spawns, 1 for night only and 2 for any time.
*/
public final class MobOverlayScan {
@@ -176,7 +176,6 @@ public final class MobOverlayScan {
modesVersion++;
}
/** The spawn modes of one square of columns. */
private static final class Buffer {
// `modes[column * HEIGHT + k]`, valid for `k < columnEnds[column]`
@@ -9,7 +9,10 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/** A mark of the mob spawn overlay. {@code world.overlays.mobOverlayStyle} is saved as {@link #formatName()}. */
/**
* Each style is a mark drawn on every block where mobs can spawn. {@code world.overlays.mobOverlayStyle} is saved as
* {@link #formatName()}.
*/
public enum MobOverlayStyle {
/** NEI's original cross from corner to corner. */
@@ -131,10 +134,6 @@ public enum MobOverlayStyle {
};
}
public boolean isFilled() {
return glMode == GL11.GL_QUADS;
}
public float computeAlpha() {
return switch (this) {
case CONNECTED -> TINT_ALPHA;
@@ -117,7 +117,7 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
MOB_OVERLAY_SCAN.getMinZ() - intOffsetZ);
MOB_OVERLAY_LIST.draw();
GL11.glPopMatrix();
endMobOverlayDraw(style);
endMobOverlayDraw();
}
/**
@@ -166,11 +166,9 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glLineWidth(1.5F);
if (style.isFilled()) {
// a translucent quad that writes depth hides the overlay behind the quad. Turn depth writes off
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
}
// the band of `MobOverlayStyle.CONNECTED` lies in the plane of the tint. With depth writes on, the depth test
// discards most of the band
GL11.glDepthMask(false);
}
private static void loadNeighbourModes(int column, int k) {
@@ -189,11 +187,8 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
}
}
private static void endMobOverlayDraw(MobOverlayStyle style) {
if (style.isFilled()) {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
}
private static void endMobOverlayDraw() {
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);