Skip to content

Commit

Permalink
Fix some more incorrect item dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
planetguy32 committed Aug 2, 2015
1 parent ceb96ce commit c9c749a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public static boolean SetBlock(World world, int x, int y, int z, Block newBlock,
int oldOpacity = oldBlock.getLightOpacity(world, x, y, z);

xbs.func_150818_a(chunkX, y & 15, chunkZ, newBlock);
xbs.setExtBlockMetadata(chunkX, y & 15, chunkZ, meta); // This line duplicates the one below, so breakBlock fires with valid worldstate
xbs.setExtBlockMetadata(chunkX, y & 15, chunkZ, meta);

if (!world.isRemote)
{
// After breakBlock a phantom TE might have been created with incorrect meta. This attempts to kill that phantom TE so the normal one can be create properly later
TileEntity te = chunk.getTileEntityUnsafe(chunkX & 0x0F, y, chunkZ & 0x0F);
if (te != null && te.shouldRefresh(oldBlock, chunk.getBlock(chunkX & 0x0F, y, chunkZ & 0x0F), metadata, chunk.getBlockMetadata(chunkX & 0x0F, y, chunkZ & 0x0F), world, x, y, z))
{
world.restoringBlockSnapshots=true;
world.restoringBlockSnapshots=true; //suppress item drops from TileEntity.invalidate()
chunk.removeTileEntity(chunkX & 0x0F, y, chunkZ & 0x0F);
world.restoringBlockSnapshots=false;
}
Expand All @@ -71,7 +71,7 @@ else if (oldBlock.hasTileEntity(metadata))
TileEntity te = chunk.getTileEntityUnsafe(chunkX & 0x0F, y, chunkZ & 0x0F);
if (te != null && te.shouldRefresh(oldBlock, newBlock, metadata, meta, world, x, y, z))
{
world.restoringBlockSnapshots=true;
world.restoringBlockSnapshots=true; //suppress item drops from TileEntity.invalidate()
world.removeTileEntity(x, y, z);
world.restoringBlockSnapshots=false;
}
Expand Down Expand Up @@ -140,8 +140,9 @@ public static void SetTileEntity(World world, int X, int Y, int Z, TileEntity en
if (entity == null) { throw new NullPointerException(); }
// This does exactly the same thing, except without reflection
world.addTileEntity(entity);

world.restoringBlockSnapshots=true;
world.getChunkFromBlockCoords(X, Z).func_150812_a(X & 0xF, Y, Z & 0xF, entity);
world.restoringBlockSnapshots=false;
}

public static void NotifyBlocks(World world, int X, int Y, int Z, Block OldId, Block NewId) {
Expand Down

0 comments on commit c9c749a

Please sign in to comment.