@Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { TileEntityTent tile = (TileEntityTent) world.getBlockTileEntity(x, y, z); if (tile != null) { color = tile.color; BlockUtil.dropItems(world, x, y, z); tile.structures[tile.rotation].destroyStructure(world, tile.tracker[tile.rotation]); super.breakBlock(world, x, y, z, par5, par6); if (!tile.dropped) { ArrayList<ItemStack> stacks = getDroppes(world, x, y, z, world.getBlockMetadata(x, y, z), 1); stacks.addAll(tile.getContends()); for (ItemStack stack : stacks) { dropBlockAsItem_do(world, x, y, z, stack); } tile.dropped = true; } } world.setBlock(x, y, z, 0); }
@Override public void onBlockPlacedBy( World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) { super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack); ((TileEntityTent) world.getBlockTileEntity(x, y, z)) .setColor(itemStack.hasTagCompound() ? itemStack.getTagCompound().getInteger("color") : 15); ; }
@Override public void addCollisionBoxesToList( World world, int x, int y, int z, AxisAlignedBB alignedBB, List list, Entity entity) { TileEntityTent tile = (TileEntityTent) world.getBlockTileEntity(x, y, z); TileEntityTent.bounds[tile.rotation].setBlockCollision(this); super.addCollisionBoxesToList(world, x, y, z, alignedBB, list, entity); }
@Override protected void dropBlockAsItem_do(World world, int x, int y, int z, ItemStack stack) { if (stack != null) { stack.setTagCompound(new NBTTagCompound()); stack.getTagCompound().setInteger("color", color); } super.dropBlockAsItem_do(world, x, y, z, stack); }