001package net.minecraft.block; 002 003import net.minecraft.block.material.Material; 004import net.minecraft.tileentity.TileEntity; 005import net.minecraft.world.World; 006 007public abstract class BlockContainer extends Block implements ITileEntityProvider 008{ 009 protected BlockContainer(int par1, Material par2Material) 010 { 011 super(par1, par2Material); 012 this.isBlockContainer = true; 013 } 014 015 /** 016 * Called whenever the block is added into the world. Args: world, x, y, z 017 */ 018 public void onBlockAdded(World par1World, int par2, int par3, int par4) 019 { 020 super.onBlockAdded(par1World, par2, par3, par4); 021 } 022 023 /** 024 * ejects contained items into the world, and notifies neighbours of an update, as appropriate 025 */ 026 public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) 027 { 028 super.breakBlock(par1World, par2, par3, par4, par5, par6); 029 par1World.removeBlockTileEntity(par2, par3, par4); 030 } 031 032 /** 033 * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile 034 * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter 035 */ 036 public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) 037 { 038 super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); 039 TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4); 040 return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; 041 } 042}