getTypeId()

Discussion in 'Plugin Development' started by communitygames, Sep 28, 2013.

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

    communitygames

    Hello community.

    getTypeId() and ItemStack has no functionality. Please help me. My code here....

    Code:java
    1. int block = p.getInventory().getItemInHand().getTypeId();
    2. int anzahl = p.getInventory().getItemInHand().getAmount();
    3. p.getInventory().addItem(new ItemStack(block, 64 - anzahl));
    4. return true;


    This code works, but the new items are not ItemsInHand, there only in the inventory.
     
  2. Offline

    billman555555

    Code:java
    1. ItemStack block = p.getInventory().getItemInHand().getType();
    2. int anzahl = p.getInventory().getItemInHand().getAmount();
    3. p.getInventory().addItem(new ItemStack(block, 64 - anzahl));
    4. return true;
     
  3. Offline

    Janmm14

    communitygames
    Code:
    int amount = p.getInventory().getAmount();
    p.getInventory().getItemInHand().setAmount(64 + anzahl);
     
  4. Offline

    communitygames

    Janmm14
    Thanks for your work, but this code doesn't work.

    @billmann555555
    Thanks for your work. Your code works partly. I've changed a litte bit. here the new code...

    Code:java
    1. Material block = p.getInventory().getItemInHand().getType();
    2. int amount = p.getInventory().getItemInHand().getAmount();
    3. p.getInventory().addItem(new ItemStack(block, 64 - amount));
    4. return true;
     
Thread Status:
Not open for further replies.

Share This Page