Development Assistance Getting Item Drop Amount NMS (Block Break Event)

Discussion in 'Plugin Help/Development/Requests' started by Techtony96, Dec 30, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Techtony96

    Code:
    for (ItemStack i : e.getBlock().getDrops()){
                if (p.getInventory().firstEmpty() == -1){
                    p.sendMessage(F.main("Prison", "Your inventory is full!"));
                    e.setCancelled(true);
                    return;
                }
                net.minecraft.server.v1_8_R1.Block nmsBlock = net.minecraft.server.v1_8_R1.Block.getById(??????);
                net.minecraft.server.v1_8_R1.World world = (net.minecraft.server.v1_8_R1.World) e.getBlock().getWorld();
                int dropCount = nmsBlock.getDropCount(1,world.random);
                i.setAmount(dropCount);
                p.getInventory().addItem(i);
            }
    My code is above, I also tried e.getBlock().getDrops(p.getItemInHand())); But that does not work either.
    I have no idea how to get the block, or if the int dropCount will work to get the drop amount of that item.
     
Thread Status:
Not open for further replies.

Share This Page