diff --git a/patches/net/minecraftforge/common/ForgeHooks.java.patch b/patches/net/minecraftforge/common/ForgeHooks.java.patch index f078637..317b1b6 100644 --- a/patches/net/minecraftforge/common/ForgeHooks.java.patch +++ b/patches/net/minecraftforge/common/ForgeHooks.java.patch @@ -65,7 +65,7 @@ { // Let the client know the block still exists entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); -@@ -500,81 +514,137 @@ +@@ -500,81 +514,144 @@ if (!(itemstack.getItem() instanceof ItemBucket)) // if not bucket { world.captureBlockSnapshots = true; @@ -169,6 +169,8 @@ + List blockSnapshots = (List) world.capturedBlockSnapshots + .clone(); + world.capturedBlockSnapshots.clear(); ++ List tDropItemSnapshots=(List)world.capturedItems.clone(); ++ world.capturedItems.clear(); + + // make sure to set pre-placement item data for event + itemstack.setItemDamage(meta); @@ -202,13 +204,14 @@ - if (newBlock != null && !(newBlock.hasTileEntity(metadata))) // Containers get placed automatically + flag = false; // cancel placement + // revert back all captured blocks -+ for (net.minecraftforge.common.util.BlockSnapshot blocksnapshot : blockSnapshots) - { -- newBlock.onBlockAdded(world, blockX, blockY, blockZ); -+ world.restoringBlockSnapshots = true; -+ blocksnapshot.restore(true, false); -+ world.restoringBlockSnapshots = false; - } ++ for(int i=blockSnapshots.size();i>0;){ ++ world.restoringBlockSnapshots=true; ++ blockSnapshots.get(--i).restore(true,false); ++ world.restoringBlockSnapshots=false; ++ } ++ for(net.minecraftforge.common.util.EntitySnapshot sEntityItem : tDropItemSnapshots){ ++ sEntityItem.cancel(); ++ } + } + else + { @@ -216,9 +219,10 @@ + itemstack.setItemDamage(newMeta); + itemstack.stackSize = newSize; + if (nbt != null) -+ { + { +- newBlock.onBlockAdded(world, blockX, blockY, blockZ); + itemstack.setTagCompound(newNBT); -+ } + } - world.markAndNotifyBlock(blockX, blockY, blockZ, null, oldBlock, newBlock, updateFlag); + for (net.minecraftforge.common.util.BlockSnapshot blocksnapshot : blockSnapshots) @@ -240,6 +244,9 @@ + + world.markAndNotifyBlock(blockX, blockY, blockZ, null, oldBlock, newBlock, updateFlag); + } ++ for(net.minecraftforge.common.util.EntitySnapshot sEntityItem : tDropItemSnapshots){ ++ sEntityItem.apply(); ++ } + player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1); } - player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1);