Fixed TileEntity bug that was causing Ghost tile entities.

This commit is contained in:
LexManos 2012-04-13 10:24:22 -07:00
parent 5898a6e18b
commit 9b66ce034a
1 changed files with 12 additions and 10 deletions

View File

@ -167,10 +167,13 @@
int var5 = 0;
int var6;
@@ -1331,6 +1341,29 @@
TileEntity var9 = (TileEntity)var10.next();
var9.updateContainingBlockInfo();
@@ -1324,12 +1334,26 @@
}
this.generateHeightMap();
- Iterator var10 = this.chunkTileEntityMap.values().iterator();
-
- while (var10.hasNext())
+
+ List<TileEntity> invalidList = new ArrayList<TileEntity>();
+ iterator = chunkTileEntityMap.values().iterator();
@ -180,24 +183,23 @@
+ int x = tileEntity.xCoord & 15;
+ int y = tileEntity.yCoord;
+ int z = tileEntity.zCoord & 15;
+ /* This function is called when an entire chunk is sent, so we don't need to check the bounds.
+ if (x >= xStart && x <= xStop && y >= yStart && y <= yEnd && z >= zStart && z <= zStop)
+ */
+ Block block = tileEntity.getBlockType();
+ if (block == null || block.blockID != getBlockID(x, y, z) || tileEntity.getBlockMetadata() != getBlockMetadata(x, y, z))
+ {
+ invalidList.add(tileEntity);
+ }
+ tileEntity.updateContainingBlockInfo();
+ }
+
+ for (TileEntity tileEntity : invalidList)
+ {
{
- TileEntity var9 = (TileEntity)var10.next();
- var9.updateContainingBlockInfo();
+ tileEntity.invalidate();
+ }
}
}
public BiomeGenBase func_48490_a(int par1, int par2, WorldChunkManager par3WorldChunkManager)
@@ -1435,4 +1468,18 @@
@@ -1435,4 +1459,18 @@
}
}
}