Guest User

Block

a guest
Jul 15th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. public class XPChest extends Block{
  2.    
  3.     public XPChest(){
  4.         super(Material.ROCK);
  5.         setCreativeTab(XPStorageMod.tabXPStorage);
  6.         setHardness(50F);
  7.         setResistance(6000F);
  8.         setHarvestLevel("pickaxe", 3);
  9.     }
  10.  
  11.     @Override
  12.     public EnumBlockRenderType getRenderType(IBlockState state)
  13.     {
  14.         return EnumBlockRenderType.MODEL;
  15.     }
  16.    
  17.     @Override
  18.     public boolean hasTileEntity(){
  19.         return true;
  20.     }
  21.    
  22.     @Override
  23.     public TileEntity createTileEntity(World world, IBlockState state){
  24.         return new XPChestTileEntity();
  25.     }
  26.  
  27.     @Override
  28.     public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
  29.     {
  30.         playerIn.openGui(XPStorageMod.instance, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
  31.         return true;
  32.     }
  33.  
  34.     @Override
  35.     public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
  36.     {
  37.         TileEntity tileEntity = worldIn.getTileEntity(pos);
  38.         NBTTagCompound compound = tileEntity.getTileData();
  39.         dropXpOnBlockBreak(worldIn, pos, compound.getInteger("expPoints"));
  40.         super.breakBlock(worldIn, pos, state);
  41.     }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment