Skip to content

Commit 27776ca

Browse files
CaedisUltraProdigy
andauthored
fix: getTE when crossing chunk (#7822)
Co-authored-by: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com>
1 parent 529b5f4 commit 27776ca

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/main/java/gregtech/api/metatileentity/BaseTileEntity.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,17 @@ public TileEntity getTileEntity(int x, int y, int z) {
439439
@Override
440440
public final TileEntity getTileEntityAtSide(ForgeDirection side) {
441441
final int ordinalSide = side.ordinal();
442-
if (side == ForgeDirection.UNKNOWN || mBufferedTileEntities[ordinalSide] == this) return null;
442+
if (side == ForgeDirection.UNKNOWN) return null;
443443
final int tX = getOffsetX(side, 1);
444444
final int tY = getOffsetY(side, 1);
445445
final int tZ = getOffsetZ(side, 1);
446446
if (crossedChunkBorder(tX, tZ)) {
447+
// never trust the "nothing here" marker across a chunk border
448+
// loading the neighbor chunk fires no block update
449+
// the marker would stick forever and we would never see its tile entities.
447450
mBufferedTileEntities[ordinalSide] = null;
448451
if (ignoreUnloadedChunks && !worldObj.blockExists(tX, tY, tZ)) return null;
449-
}
452+
} else if (mBufferedTileEntities[ordinalSide] == this) return null;
450453
if (mBufferedTileEntities[ordinalSide] == null) {
451454
mBufferedTileEntities[ordinalSide] = worldObj.getTileEntity(tX, tY, tZ);
452455
if (mBufferedTileEntities[ordinalSide] == null) {

0 commit comments

Comments
 (0)