Patternchest drops patterns if not removed by player instead of sending them into the void

This commit is contained in:
Bernhard Bonigl committed 2014-09-20 23:14:54 +02:00
1 parent 263efb8b11
commit ea67ebc837
1 file changed
+5 -11
@@ -212,17 +212,6 @@ public class ToolStationBlock extends InventoryBlock
}
/* Keep pattern chest inventory */
@Override
public void breakBlock (World par1World, int x, int y, int z, Block blockID, int meta)
{
if (meta < 5 || meta > 9)
super.breakBlock(par1World, x, y, z, blockID, meta);
else
{
par1World.removeTileEntity(x, y, z);
}
}
@Override
public boolean removedByPlayer (World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
{
@@ -241,6 +230,11 @@ public class ToolStationBlock extends InventoryBlock
baseTag.setTag("Inventory", inventory);
chest.setTagCompound(baseTag);
// remove content. This is necessary because otherwise the patterns would also spill into the world
// we don't want to prevent that since that's the intended behaviour for explosions.
for(int i = 0; i < logic.getSizeInventory(); i++)
logic.setInventorySlotContents(i, null);
//Spawn item
if (!player.capabilities.isCreativeMode || player.isSneaking())
{