@Override
 public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
   TileEntity te = world.getBlockTileEntity(x, y, z);
   if (te instanceof ModularChestTileEntity) {
     ModularChestTileEntity mte = (ModularChestTileEntity) te;
     if (!((ModularChestTileEntity) te).isBreakable) {
       dropUpgrades(world, x, y, z);
       dropItems(world, x, y, z);
       dropItem(new ItemStack(this), world, x, y, z);
     } else {
       ItemStack item = new ItemStack(this);
       NBTTagCompound tag = new NBTTagCompound();
       mte.upgradesStorage.removeGlobalItem(ModularChests.breakableUpgradeItem, null);
       mte.writeDataToNBT(tag);
       item.setTagCompound(tag);
       dropItem(item, world, x, y, z);
     }
   } else dropItems(world, x, y, z);
   super.breakBlock(world, x, y, z, par5, par6);
 }
  @Override
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLiving entityliving, ItemStack itemStack) {

    TileEntity te = world.getBlockTileEntity(x, y, z);
    ModularChestTileEntity mte = null;
    if (te != null && te instanceof ModularChestTileEntity) {
      mte = (ModularChestTileEntity) te;
    }

    if (itemStack.getItem().itemID == ModularChests.modularBlockId) {
      if (itemStack.hasTagCompound()) {
        EntityPlayer player = (EntityPlayer) entityliving;

        mte.readDataFromNBT(itemStack.getTagCompound());
      }
    }

    byte chestFacing = 0;
    int facing =
        MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
    if (facing == 0) {
      chestFacing = 2;
    }
    if (facing == 1) {
      chestFacing = 5;
    }
    if (facing == 2) {
      chestFacing = 3;
    }
    if (facing == 3) {
      chestFacing = 4;
    }

    if (mte != null) {
      mte.setFacing(chestFacing);
      world.markBlockForUpdate(x, y, z);
    }
  }