mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-20 20:22:17 +00:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
607543046d | ||
|
|
7fc80371c7 | ||
|
|
f5f696abba | ||
|
|
277c32b9e6 | ||
|
|
fbb0cdc81a | ||
|
|
991e166e0a | ||
|
|
d298c0e827 | ||
|
|
da16b40f36 | ||
|
|
651b59cba9 | ||
|
|
f922d7ef1e | ||
|
|
52ad6f38a5 | ||
|
|
8d118cb132 | ||
|
|
2590eec44a | ||
|
|
81a92a28f5 | ||
|
|
621ab621c7 | ||
|
|
1aa4d56100 | ||
|
|
dc35985ea0 | ||
|
|
bb8632a012 | ||
|
|
b361604422 | ||
|
|
02c97a05c3 | ||
|
|
d0785b5261 | ||
|
|
52ae4b2bd4 | ||
|
|
acacd13bd9 |
No files matched your search
@@ -713,8 +713,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
@Override
|
||||
public void load(GuiContainer gui) {
|
||||
NEIController.load(gui);
|
||||
|
||||
if (isEnabled()) {
|
||||
setInputFocused(null);
|
||||
|
||||
@@ -728,6 +726,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
AutoFocusWidget.instance.load(gui);
|
||||
}
|
||||
|
||||
NEIController.load(gui);
|
||||
|
||||
if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative) // override creative with
|
||||
// creative+
|
||||
gui.mc.displayGuiScreen(null); // close the screen and wait for the server to open it for us
|
||||
|
||||
@@ -30,8 +30,6 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
private static final MobOverlayScan MOB_OVERLAY_SCAN = new MobOverlayScan();
|
||||
private static final MobOverlayFace MARKED_FACE = new MobOverlayFace();
|
||||
private static final MobOverlayDisplayList MOB_OVERLAY_LIST = new MobOverlayDisplayList();
|
||||
// the cells of one column, reused by each compile
|
||||
private static final byte[] COLUMN_CELLS = new byte[2 * MobOverlayScan.MAX_VERTICAL_RADIUS + 1];
|
||||
|
||||
public static void reset() {
|
||||
mobOverlay = 0;
|
||||
@@ -113,58 +111,28 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a marked face to {@link #MOB_OVERLAY_LIST} for each block of {@link #MOB_OVERLAY_SCAN} where mobs can spawn,
|
||||
* in the chunk columns whose cells changed.
|
||||
* Add a marked face to {@link #MOB_OVERLAY_LIST} for each block of {@link #MOB_OVERLAY_SCAN} where mobs can spawn.
|
||||
*/
|
||||
private static void compileMobOverlayList(MobOverlayStyle style, long worldTicks) {
|
||||
MOB_OVERLAY_LIST.beginCompile(MOB_OVERLAY_SCAN, style, worldTicks);
|
||||
final int minX = MOB_OVERLAY_SCAN.getMinX();
|
||||
final int minZ = MOB_OVERLAY_SCAN.getMinZ();
|
||||
final int span = MOB_OVERLAY_SCAN.getSpan();
|
||||
final int toChunkX = (minX + span - 1) >> MobOverlayScan.CHUNK_SHIFT;
|
||||
final int toChunkZ = (minZ + span - 1) >> MobOverlayScan.CHUNK_SHIFT;
|
||||
for (int chunkX = minX >> MobOverlayScan.CHUNK_SHIFT; chunkX <= toChunkX; chunkX++) {
|
||||
for (int chunkZ = minZ >> MobOverlayScan.CHUNK_SHIFT; chunkZ <= toChunkZ; chunkZ++) {
|
||||
if (!MOB_OVERLAY_LIST.beginChunk(MOB_OVERLAY_SCAN, chunkX, chunkZ)) continue;
|
||||
|
||||
MOB_OVERLAY_LIST.endChunk(compileChunkFaces(style, chunkX, chunkZ));
|
||||
}
|
||||
}
|
||||
MOB_OVERLAY_LIST.endCompile();
|
||||
}
|
||||
|
||||
/** @return whether the chunk column has a marked face */
|
||||
private static boolean compileChunkFaces(MobOverlayStyle style, int chunkX, int chunkZ) {
|
||||
final int CHUNK_WIDTH = 1 << MobOverlayScan.CHUNK_SHIFT;
|
||||
final float alpha = style.computeAlpha();
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
final int cornerX = chunkX << MobOverlayScan.CHUNK_SHIFT;
|
||||
final int cornerZ = chunkZ << MobOverlayScan.CHUNK_SHIFT;
|
||||
final int minX = MOB_OVERLAY_SCAN.getMinX();
|
||||
final int minZ = MOB_OVERLAY_SCAN.getMinZ();
|
||||
final int span = MOB_OVERLAY_SCAN.getSpan();
|
||||
final int height = MOB_OVERLAY_SCAN.getHeight();
|
||||
boolean hasFaces = false;
|
||||
tess.startDrawing(style.glMode);
|
||||
for (int i = Math.max(cornerX - minX, 0); i < Math.min(cornerX + CHUNK_WIDTH - minX, span); i++) {
|
||||
for (int j = Math.max(cornerZ - minZ, 0); j < Math.min(cornerZ + CHUNK_WIDTH - minZ, span); j++) {
|
||||
MOB_OVERLAY_SCAN.readColumn(i, j, COLUMN_CELLS);
|
||||
for (int k = 0; k < height; k++) {
|
||||
if (MobOverlayScan.extractSpawnMode(COLUMN_CELLS[k]) == 0) continue;
|
||||
final int span = MOB_OVERLAY_SCAN.getSpan();
|
||||
for (int i = 0; i < span; i++) {
|
||||
for (int j = 0; j < span; j++) {
|
||||
for (int k = 0; k < MOB_OVERLAY_SCAN.getHeight(); k++) {
|
||||
if (MOB_OVERLAY_SCAN.readSpawnMode(i, k, j) == 0) continue;
|
||||
|
||||
MARKED_FACE.moveTo(
|
||||
minX + i - cornerX,
|
||||
k + MobOverlayScan.computeOverlayYOffset(COLUMN_CELLS[k]),
|
||||
minZ + j - cornerZ);
|
||||
MARKED_FACE.moveTo(i, k + MOB_OVERLAY_SCAN.readOverlayYOffset(i, k, j), j);
|
||||
loadNeighbourModes(i, k, j);
|
||||
MARKED_FACE.applyColor(style.colouring, alpha);
|
||||
style.addVertices(MARKED_FACE);
|
||||
hasFaces = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
tess.draw();
|
||||
return hasFaces;
|
||||
MOB_OVERLAY_LIST.endCompile();
|
||||
}
|
||||
|
||||
private static void beginMobOverlayDraw(MobOverlayStyle style) {
|
||||
|
||||
@@ -1,40 +1,19 @@
|
||||
package codechicken.nei.moboverlay;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* The mob spawn overlay quads, compiled into one GL display list for each chunk column that overlaps the box of a
|
||||
* {@link MobOverlayScan}. A compile rebuilds only the lists of the chunk columns whose
|
||||
* {@link MobOverlayScan#readChunkVersion} changed. A parent list calls the chunk-column lists, so a draw is one
|
||||
* {@code glCallList()}.
|
||||
*/
|
||||
/** The mob spawn overlay quads, compiled into a GL display list. */
|
||||
public final class MobOverlayDisplayList {
|
||||
|
||||
private static final int NO_LIST = -1;
|
||||
|
||||
// the first of `chunkSpan * chunkSpan` lists, in the order of the ring of `MobOverlayScan.readChunkVersion()`, then
|
||||
// the parent list
|
||||
private int firstListId = NO_LIST;
|
||||
private int parentListId = NO_LIST;
|
||||
private boolean hasParentList;
|
||||
private int anchorX;
|
||||
private int anchorY;
|
||||
private int anchorZ;
|
||||
private int chunkSpan;
|
||||
private boolean[] isCompiled = new boolean[0];
|
||||
private boolean[] hasFaces = new boolean[0];
|
||||
private int[] compiledChunkX = new int[0];
|
||||
private int[] compiledChunkZ = new int[0];
|
||||
private int[] compiledMinY = new int[0];
|
||||
private int[] compiledChunkVersion = new int[0];
|
||||
private int listId = -1;
|
||||
private int modesVersion;
|
||||
private MobOverlayStyle style;
|
||||
private int minX;
|
||||
private int minY;
|
||||
private int minZ;
|
||||
private long compiledTicks;
|
||||
private int compilingChunk;
|
||||
|
||||
/**
|
||||
* Compiles after a {@link MobOverlayScan#getModesVersion} change are debounced to one per {@code MIN_COMPILE_TICKS}
|
||||
@@ -43,7 +22,7 @@ public final class MobOverlayDisplayList {
|
||||
*/
|
||||
public boolean isCompileDue(int currentModesVersion, MobOverlayStyle currentStyle, long worldTicks) {
|
||||
final int MIN_COMPILE_TICKS = 5;
|
||||
if (firstListId == NO_LIST || style != currentStyle) return true;
|
||||
if (listId < 0 || style != currentStyle) return true;
|
||||
|
||||
// after a dimension change or a server switch, `worldTicks` can be lower than `compiledTicks`
|
||||
final boolean isWaitOver = worldTicks - compiledTicks >= MIN_COMPILE_TICKS || worldTicks < compiledTicks;
|
||||
@@ -51,110 +30,36 @@ public final class MobOverlayDisplayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a compile of {@code scan}. After this call, {@link #beginChunk} and {@link #endChunk} compile each chunk
|
||||
* column of the box, and {@link #endCompile} compiles the parent list. The lists of the chunk columns outside the
|
||||
* box are not drawn.
|
||||
* Quad positions are relative to block ({@link MobOverlayScan#getMinX}, {@link MobOverlayScan#getMinY},
|
||||
* {@link MobOverlayScan#getMinZ}) of {@code scan}.
|
||||
*/
|
||||
public void beginCompile(MobOverlayScan scan, MobOverlayStyle newStyle, long worldTicks) {
|
||||
if (chunkSpan != scan.getChunkSpan()) resize(scan.getChunkSpan());
|
||||
if (style != newStyle) Arrays.fill(isCompiled, false);
|
||||
if (listId < 0) listId = GLAllocation.generateDisplayLists(1);
|
||||
modesVersion = scan.getModesVersion();
|
||||
style = newStyle;
|
||||
minX = scan.getMinX();
|
||||
minY = scan.getMinY();
|
||||
minZ = scan.getMinZ();
|
||||
compiledTicks = worldTicks;
|
||||
anchorX = scan.getMinX();
|
||||
anchorY = scan.getMinY();
|
||||
anchorZ = scan.getMinZ();
|
||||
final int fromChunkX = scan.getMinX() >> MobOverlayScan.CHUNK_SHIFT;
|
||||
final int toChunkX = (scan.getMinX() + scan.getSpan() - 1) >> MobOverlayScan.CHUNK_SHIFT;
|
||||
final int fromChunkZ = scan.getMinZ() >> MobOverlayScan.CHUNK_SHIFT;
|
||||
final int toChunkZ = (scan.getMinZ() + scan.getSpan() - 1) >> MobOverlayScan.CHUNK_SHIFT;
|
||||
for (int chunk = 0; chunk < isCompiled.length; chunk++) {
|
||||
final boolean isInBox = compiledChunkX[chunk] >= fromChunkX && compiledChunkX[chunk] <= toChunkX
|
||||
&& compiledChunkZ[chunk] >= fromChunkZ
|
||||
&& compiledChunkZ[chunk] <= toChunkZ;
|
||||
isCompiled[chunk] &= isInBox;
|
||||
}
|
||||
GL11.glNewList(listId, GL11.GL_COMPILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the list of chunk column ({@code chunkX}, {@code chunkZ}), with quad positions relative to block ({@code
|
||||
* chunkX * 16}, {@link MobOverlayScan#getMinY}, {@code chunkZ * 16}) of {@code scan}.
|
||||
*
|
||||
* @return false, with no list started, when the list is compiled for the chunk column's version
|
||||
*/
|
||||
public boolean beginChunk(MobOverlayScan scan, int chunkX, int chunkZ) {
|
||||
final int chunk = Math.floorMod(chunkX, chunkSpan) * chunkSpan + Math.floorMod(chunkZ, chunkSpan);
|
||||
final int chunkVersion = scan.readChunkVersion(chunkX, chunkZ);
|
||||
final boolean isCurrent = isCompiled[chunk] && compiledChunkX[chunk] == chunkX
|
||||
&& compiledChunkZ[chunk] == chunkZ
|
||||
&& compiledChunkVersion[chunk] == chunkVersion;
|
||||
if (isCurrent) return false;
|
||||
|
||||
isCompiled[chunk] = true;
|
||||
compiledChunkX[chunk] = chunkX;
|
||||
compiledChunkZ[chunk] = chunkZ;
|
||||
compiledMinY[chunk] = scan.getMinY();
|
||||
compiledChunkVersion[chunk] = chunkVersion;
|
||||
compilingChunk = chunk;
|
||||
GL11.glNewList(firstListId + chunk, GL11.GL_COMPILE);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void endChunk(boolean hasChunkFaces) {
|
||||
GL11.glEndList();
|
||||
hasFaces[compilingChunk] = hasChunkFaces;
|
||||
}
|
||||
|
||||
/** Compile the parent list, with positions relative to the box's minimum corner at {@link #beginCompile}. */
|
||||
public void endCompile() {
|
||||
GL11.glNewList(parentListId, GL11.GL_COMPILE);
|
||||
for (int chunk = 0; chunk < isCompiled.length; chunk++) {
|
||||
if (!(isCompiled[chunk] && hasFaces[chunk])) continue;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(
|
||||
(compiledChunkX[chunk] << MobOverlayScan.CHUNK_SHIFT) - anchorX,
|
||||
compiledMinY[chunk] - anchorY,
|
||||
(compiledChunkZ[chunk] << MobOverlayScan.CHUNK_SHIFT) - anchorZ);
|
||||
GL11.glCallList(firstListId + chunk);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glEndList();
|
||||
hasParentList = true;
|
||||
}
|
||||
|
||||
/** The model view matrix is relative to block ({@code cameraX}, {@code cameraY}, {@code cameraZ}). */
|
||||
public void draw(int cameraX, int cameraY, int cameraZ) {
|
||||
if (!hasParentList) return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(anchorX - cameraX, anchorY - cameraY, anchorZ - cameraZ);
|
||||
GL11.glCallList(parentListId);
|
||||
GL11.glTranslated(minX - cameraX, minY - cameraY, minZ - cameraZ);
|
||||
GL11.glCallList(listId);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
if (firstListId == NO_LIST) return;
|
||||
if (listId < 0) return;
|
||||
|
||||
GLAllocation.deleteDisplayLists(firstListId);
|
||||
firstListId = NO_LIST;
|
||||
parentListId = NO_LIST;
|
||||
hasParentList = false;
|
||||
chunkSpan = 0;
|
||||
Arrays.fill(isCompiled, false);
|
||||
}
|
||||
|
||||
private void resize(int newChunkSpan) {
|
||||
delete();
|
||||
chunkSpan = newChunkSpan;
|
||||
final int chunkCount = newChunkSpan * newChunkSpan;
|
||||
firstListId = GLAllocation.generateDisplayLists(chunkCount + 1);
|
||||
parentListId = firstListId + chunkCount;
|
||||
isCompiled = new boolean[chunkCount];
|
||||
hasFaces = new boolean[chunkCount];
|
||||
compiledChunkX = new int[chunkCount];
|
||||
compiledChunkZ = new int[chunkCount];
|
||||
compiledMinY = new int[chunkCount];
|
||||
compiledChunkVersion = new int[chunkCount];
|
||||
GLAllocation.deleteDisplayLists(listId);
|
||||
listId = -1;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package codechicken.nei.moboverlay;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
@@ -33,7 +31,6 @@ public final class MobOverlayScan {
|
||||
public static final int MIN_VERTICAL_RADIUS = 4;
|
||||
public static final int MAX_VERTICAL_RADIUS = 64;
|
||||
public static final int DEFAULT_VERTICAL_RADIUS = 16;
|
||||
public static final int CHUNK_SHIFT = 4;
|
||||
private static final int RECENTRE_DISTANCE = 4;
|
||||
private static final int VERTICAL_RECENTRE_DISTANCE = 2;
|
||||
private static final int RESCAN_TICKS = 40;
|
||||
@@ -59,11 +56,6 @@ public final class MobOverlayScan {
|
||||
// the slice rescan of `update()` continues from this column, numbered `(x - minX) * span + (z - minZ)`
|
||||
private int nextRescanColumn;
|
||||
private int modesVersion;
|
||||
// chunk columns per side of the ring `chunkVersions`, enough for every chunk column that overlaps the box
|
||||
private int chunkSpan;
|
||||
// indexed by `findChunk()`
|
||||
private int[] chunkVersions = new int[0];
|
||||
private int chunkVersionCount;
|
||||
private boolean hasModes;
|
||||
private long scannedTick;
|
||||
// world of `modes`, with `changeListener` added
|
||||
@@ -79,8 +71,6 @@ public final class MobOverlayScan {
|
||||
height = 0;
|
||||
modes = new byte[0];
|
||||
dirty = new boolean[0];
|
||||
chunkSpan = 0;
|
||||
chunkVersions = new int[0];
|
||||
hasModes = false;
|
||||
scannedWorld = null;
|
||||
// `Chunk.worldObj` references the world
|
||||
@@ -127,11 +117,6 @@ public final class MobOverlayScan {
|
||||
return modesVersion;
|
||||
}
|
||||
|
||||
/** Chunk columns per side of the ring of {@link #readChunkVersion}. */
|
||||
public int getChunkSpan() {
|
||||
return chunkSpan;
|
||||
}
|
||||
|
||||
public int getSpan() {
|
||||
return span;
|
||||
}
|
||||
@@ -152,42 +137,19 @@ public final class MobOverlayScan {
|
||||
return minZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* The version changes when a cell of the chunk column or of a column beside the chunk column changes, and when the
|
||||
* box moves.
|
||||
*/
|
||||
public int readChunkVersion(int chunkX, int chunkZ) {
|
||||
return chunkVersions[findChunk(chunkX, chunkZ)];
|
||||
}
|
||||
|
||||
/** {@code i} and {@code j} are from 0 to {@link #getSpan}, and {@code k} is from 0 to {@link #getHeight}. */
|
||||
public byte readSpawnMode(int i, int k, int j) {
|
||||
return extractSpawnMode(modes[findCell(minX + i, minY + k, minZ + j)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the cells of column ({@code i}, {@code j}) to {@code columnCells}, from the bottom of the box to the top.
|
||||
* {@link #extractSpawnMode} and {@link #computeOverlayYOffset} read a cell. The indices are those of
|
||||
* {@link #readSpawnMode}.
|
||||
*/
|
||||
public void readColumn(int i, int j, byte[] columnCells) {
|
||||
final int columnStart = findColumn(minX + i, minZ + j) * height;
|
||||
final int bottomCell = Math.floorMod(minY, height);
|
||||
System.arraycopy(modes, columnStart + bottomCell, columnCells, 0, height - bottomCell);
|
||||
System.arraycopy(modes, columnStart, columnCells, height - bottomCell, bottomCell);
|
||||
}
|
||||
|
||||
public static byte extractSpawnMode(byte cell) {
|
||||
return (byte) (cell & SPAWN_MODE_MASK);
|
||||
return (byte) (modes[findCell(minX + i, minY + k, minZ + j)] & SPAWN_MODE_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Height of the overlay above the bottom of the block, so that a flat block such as a carpet does not cover the
|
||||
* overlay.
|
||||
* overlay. The indices are those of {@link #readSpawnMode}.
|
||||
*/
|
||||
public static double computeOverlayYOffset(byte cell) {
|
||||
public double readOverlayYOffset(int i, int k, int j) {
|
||||
final double OVERLAY_GAP = 0.02;
|
||||
return (double) (cell >> COVER_TOP_SHIFT) / COVER_TOP_STEPS + OVERLAY_GAP;
|
||||
final int coverTopSteps = modes[findCell(minX + i, minY + k, minZ + j)] >> COVER_TOP_SHIFT;
|
||||
return (double) coverTopSteps / COVER_TOP_STEPS + OVERLAY_GAP;
|
||||
}
|
||||
|
||||
private void resize(int newRadius, int newVerticalRadius) {
|
||||
@@ -197,8 +159,6 @@ public final class MobOverlayScan {
|
||||
height = 2 * newVerticalRadius + 1;
|
||||
modes = new byte[span * span * height];
|
||||
dirty = new boolean[span * span];
|
||||
chunkSpan = ((span - 1) >> CHUNK_SHIFT) + 2;
|
||||
chunkVersions = new int[chunkSpan * chunkSpan];
|
||||
hasModes = false;
|
||||
nextRescanColumn = 0;
|
||||
}
|
||||
@@ -212,7 +172,6 @@ public final class MobOverlayScan {
|
||||
scanColumn(x, z);
|
||||
}
|
||||
}
|
||||
markAllChunks();
|
||||
hasModes = true;
|
||||
modesVersion++;
|
||||
scannedTick = scannedWorld.getTotalWorldTime();
|
||||
@@ -230,7 +189,6 @@ public final class MobOverlayScan {
|
||||
final int offsetX = centreX - radius - minX;
|
||||
if (Math.abs(offsetX) > RECENTRE_DISTANCE) {
|
||||
final int enteringX = offsetX > 0 ? minX + span : minX + offsetX;
|
||||
markMovedEdgeChunks(minX, offsetX, true);
|
||||
minX += offsetX;
|
||||
for (int x = enteringX; x < enteringX + Math.abs(offsetX); x++) {
|
||||
for (int z = minZ; z < minZ + span; z++) {
|
||||
@@ -243,7 +201,6 @@ public final class MobOverlayScan {
|
||||
final int offsetZ = centreZ - radius - minZ;
|
||||
if (Math.abs(offsetZ) > RECENTRE_DISTANCE) {
|
||||
final int enteringZ = offsetZ > 0 ? minZ + span : minZ + offsetZ;
|
||||
markMovedEdgeChunks(minZ, offsetZ, false);
|
||||
minZ += offsetZ;
|
||||
for (int x = minX; x < minX + span; x++) {
|
||||
for (int z = enteringZ; z < enteringZ + Math.abs(offsetZ); z++) {
|
||||
@@ -263,7 +220,6 @@ public final class MobOverlayScan {
|
||||
column.scan(enteringY, enteringY + Math.abs(offsetY));
|
||||
}
|
||||
}
|
||||
markAllChunks();
|
||||
isMoved = true;
|
||||
}
|
||||
return isMoved;
|
||||
@@ -297,49 +253,7 @@ public final class MobOverlayScan {
|
||||
private boolean scanColumn(int x, int z) {
|
||||
column.moveTo(x, z);
|
||||
dirty[findColumn(x, z)] = false;
|
||||
final boolean isChanged = column.scan(minY, minY + height);
|
||||
// the connected outline of a cell depends on the spawn modes of the cells beside the cell
|
||||
if (isChanged) {
|
||||
for (int offsetX = -1; offsetX <= 1; offsetX++) {
|
||||
for (int offsetZ = -1; offsetZ <= 1; offsetZ++) {
|
||||
markChunk((x + offsetX) >> CHUNK_SHIFT, (z + offsetZ) >> CHUNK_SHIFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the chunk columns of the box's edge before and after a move of {@code offset} blocks along x, or along z
|
||||
* when {@code isAlongX} is false, and of the columns that enter or leave the box. No outline is drawn between an
|
||||
* edge cell of the box and a cell outside the box, so a move changes the outlines of the edge cells.
|
||||
*/
|
||||
private void markMovedEdgeChunks(int oldMin, int offset, boolean isAlongX) {
|
||||
final int lowFrom = Math.min(oldMin, oldMin + offset);
|
||||
final int lowTo = Math.max(oldMin, oldMin + offset);
|
||||
final int highFrom = lowFrom + span - 1;
|
||||
final int highTo = lowTo + span - 1;
|
||||
final int acrossFrom = isAlongX ? minZ : minX;
|
||||
for (int across = acrossFrom >> CHUNK_SHIFT; across <= (acrossFrom + span - 1) >> CHUNK_SHIFT; across++) {
|
||||
for (int along = lowFrom >> CHUNK_SHIFT; along <= lowTo >> CHUNK_SHIFT; along++) {
|
||||
markChunk(isAlongX ? along : across, isAlongX ? across : along);
|
||||
}
|
||||
for (int along = highFrom >> CHUNK_SHIFT; along <= highTo >> CHUNK_SHIFT; along++) {
|
||||
markChunk(isAlongX ? along : across, isAlongX ? across : along);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void markAllChunks() {
|
||||
Arrays.fill(chunkVersions, ++chunkVersionCount);
|
||||
}
|
||||
|
||||
private void markChunk(int chunkX, int chunkZ) {
|
||||
chunkVersions[findChunk(chunkX, chunkZ)] = ++chunkVersionCount;
|
||||
}
|
||||
|
||||
private int findChunk(int chunkX, int chunkZ) {
|
||||
return Math.floorMod(chunkX, chunkSpan) * chunkSpan + Math.floorMod(chunkZ, chunkSpan);
|
||||
return column.scan(minY, minY + height);
|
||||
}
|
||||
|
||||
private int findColumn(int x, int z) {
|
||||
@@ -400,11 +314,6 @@ public final class MobOverlayScan {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// `SpawnerAnimals.canCreatureTypeSpawnAtLocation()` rejects a normal cube in the cell for a monster. Most
|
||||
// cells below the surface are a normal cube. Test the block here, with no light reads and no reads of the
|
||||
// blocks above and below the cell
|
||||
if (chunk.getBlock(x & 15, y, z & 15).isNormalCube()) return 0;
|
||||
|
||||
if (chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15) >= 8 || !SpawnerAnimals
|
||||
.canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, chunk.worldObj, x, y, z)) {
|
||||
return 0;
|
||||
|
||||
@@ -123,6 +123,11 @@ public class AutoCraftingManager {
|
||||
AutoCraftingManager.math = math;
|
||||
|
||||
if (AutoCraftingManager.math != null) {
|
||||
|
||||
if (NEIClientUtils.getGuiContainer() instanceof GuiRecipe<?>gui && gui.firstGui != null) {
|
||||
gui.mc.displayGuiScreen(gui.firstGui);
|
||||
}
|
||||
|
||||
ItemPanels.bookmarkPanel.clearTooltips();
|
||||
math.createMasterRoot();
|
||||
task.restart();
|
||||
|
||||
@@ -149,6 +149,7 @@ public class RecipeHandlerRef {
|
||||
if (overlayHandler != null && overlayHandler.canCraft(firstGui, this.handler, this.recipeIndex)) {
|
||||
|
||||
if (!firstGui.equals(firstGui.mc.currentScreen)) {
|
||||
if (!firstGui.mc.func_152345_ab()) return false;
|
||||
firstGui.mc.displayGuiScreen(firstGui);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user