Solved How to get breaknaturally() to use the item's enchants?

Discussion in 'Plugin Development' started by BananaPuncher714, Nov 17, 2016.

Thread Status:
Not open for further replies.
  1. So, in my leafminer plugin, I first get what the player's holding, then I put that item stack in a breaknaturally ( itemstack ) method. When I break a block using shears or an item with silk touch, it doesn't drop the block, but drops what it would drop as if I have broken it with my fist. What should I do to get the block drops if I used fortune, silf touch, or a certain tool?
    Here's my code:
    Code:
                leafSet.add( new LeafLocation( e.getBlock().getLocation(), e.getPlayer().getItemInHand(), true ) );
    and here's the part that breaks the block:
    Code:
                                leafSet.add( new LeafLocation( tempLoc, location.getItem() ) );
                                tempLoc.getBlock().breakNaturally( location.getItem() );
    Why doesn't it drop the right blocks if I create a new LeafLocation with a shear as the itemstack?
     
  2. Offline

    Zombie_Striker

    @BananaPuncher714
    For silktouch, just drop an item with all the data of the block. For fortune, check if the drops are greater than 2, and if so, duplicate some of the items.
     
  3. Ok, I'll try that. Thanks.
     
  4. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page