Skip to content

Commit

Permalink
Patternchest drops patterns if not removed by player instead of sendi…
Browse files Browse the repository at this point in the history
…ng them into the void
  • Loading branch information
bonii-xx committed Sep 20, 2014
1 parent 263efb8 commit ea67ebc
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/main/java/tconstruct/tools/blocks/ToolStationBlock.java
Expand Up @@ -212,17 +212,6 @@ public String getTextureDomain (int textureNameIndex)
}

/* 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)
{
Expand All @@ -241,6 +230,11 @@ public boolean removedByPlayer (World world, EntityPlayer player, int x, int y,
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())
{
Expand Down

0 comments on commit ea67ebc

Please sign in to comment.