Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*============================FORGE START=====================================*/
- @Override
- public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
- {
- super.getDrops(drops, world, pos, state, fortune);
- TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null;
- if (te != null && te.getFlowerPotItem() != null)
- drops.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData()));
- }
- @Override
- public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
- {
- if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops
- return super.removedByPlayer(state, world, pos, player, willHarvest);
- }
- /**
- * Spawns the block's drops in the world. By the time this is called the Block has possibly been set to air via
- * Block.removedByPlayer
- */
- @Override
- public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack tool)
- {
- super.harvestBlock(world, player, pos, state, te, tool);
- world.setBlockToAir(pos);
- }
- /*===========================FORGE END==========================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement