toInvalidate.clear();
for (Map.Entry<ChunkPosition, TileEntity> entry : tileMap.entrySet()) {
TileEntity tileEntity = entry.getValue();
if ((!tileEntity.canUpdate() && tileEntity.isInvalid()) || tileEntity.getClass() == TileEntity.class) {
tileEntity.invalidate();
ChunkPosition position = entry.getKey();
tileMap.remove(position);
worldObj.loadedTileEntityList.remove(tileEntity);
int x = position.x, y = position.y, z = position.z;
int id = getBlockID(x, y, z);
int meta = getBlockMetadata(x, y, z);