Search in sources :

Example 1 with ItemFruitPole

use of com.eerussianguy.firmalife.items.ItemFruitPole in project firmalife by eerussianguy.

the class CommonEventHandlerFL method onBlockHarvestDrops.

@SubscribeEvent
public static void onBlockHarvestDrops(BlockEvent.HarvestDropsEvent event) {
    final IBlockState state = event.getState();
    final Block block = state.getBlock();
    if (block instanceof BlockFruitTreeLeaves) {
        event.getDrops().add(new ItemStack(ItemsFL.FRUIT_LEAF, 2 + Constants.RNG.nextInt(4)));
    } else if (block instanceof BlockFruitTreeTrunk) {
        if (event.isCanceled())
            event.setCanceled(false);
        IFruitTree tree = ((BlockFruitTreeTrunk) block).getTree();
        ItemFruitPole pole = ItemFruitPole.get(tree);
        if (pole != null)
            event.getDrops().add(new ItemStack(pole));
    }
}
Also used : BlockFruitTreeTrunk(net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeTrunk) IBlockState(net.minecraft.block.state.IBlockState) BlockFruitTreeLeaves(net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves) IFruitTree(net.dries007.tfc.api.types.IFruitTree) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) ItemFruitPole(com.eerussianguy.firmalife.items.ItemFruitPole) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

ItemFruitPole (com.eerussianguy.firmalife.items.ItemFruitPole)1 IFruitTree (net.dries007.tfc.api.types.IFruitTree)1 BlockFruitTreeLeaves (net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves)1 BlockFruitTreeTrunk (net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeTrunk)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1