package net.minecraft.block; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public abstract class BlockContainer extends Block { protected BlockContainer(int par1, Material par2Material) { super(par1, par2Material); this.isBlockContainer = true; } protected BlockContainer(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); this.isBlockContainer = true; } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); par1World.setBlockTileEntity(par2, par3, par4, this.createTileEntity(par1World, par1World.getBlockMetadata(par2, par3, par4))); } /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { super.breakBlock(par1World, par2, par3, par4, par5, par6); par1World.removeBlockTileEntity(par2, par3, par4); } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public abstract TileEntity createNewTileEntity(World var1); public TileEntity createNewTileEntity(World world, int metadata) { return createNewTileEntity(world); } /** * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter */ public void onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) { super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); TileEntity var7 = par1World.getBlockTileEntity(par2, par3, par4); if (var7 != null) { var7.receiveClientEvent(par5, par6); } } }