Boy132

CoreCrop

Apr 19th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. public abstract class CoreCrop extends BlockCrops
  2. {
  3.     protected String name;
  4.    
  5.     public CoreCrop(String name)
  6.     {
  7.         this.name = name;
  8.        
  9.         setUnlocalizedName(this.name);
  10.         setRegistryName(this.name);
  11.     }
  12.    
  13.     public String getName()
  14.     {
  15.         return name;
  16.     }
  17.    
  18.     @Override
  19.     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
  20.     {
  21.         if(state == withAge(getMaxAge()))
  22.         {
  23.             world.getBlockState(pos).getBlock().harvestBlock(world, player, pos, state, null, ItemStack.EMPTY);
  24.             world.setBlockState(pos, getDefaultState(), 3);
  25.             return true;
  26.         }
  27.        
  28.         return false;
  29.     }
  30.    
  31.     @Override
  32.     protected abstract int getBonemealAgeIncrease(World world);
  33.    
  34.     @Override
  35.     public abstract Item getSeed();
  36.    
  37.     @Override
  38.     public abstract Item getCrop();
  39.    
  40.     @Override
  41.     public abstract int getMaxAge();
  42.    
  43.     @Override
  44.     public abstract boolean isMaxAge(IBlockState state);
  45.    
  46.     @Override
  47.     public abstract AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos);
  48.    
  49.     @Override
  50.     protected abstract PropertyInteger getAgeProperty();
  51.    
  52.     @Override
  53.     protected abstract BlockStateContainer createBlockState();
  54. }
Add Comment
Please, Sign In to add comment