Left hand support?

Discussion in 'Plugin Development' started by Pikkachhu Raaicchu, Jul 22, 2016.

Thread Status:
Not open for further replies.
  1. Hello everyone, i'm back because no one has made a tutorial on this yet...
    Recently, as you probably know, Mojang has added the left hand. This got me thinking.
    First, plugins such as CustomJoinItems do not really support 1.9, which means the
    join items can be held in the left hand, and in some cases players can even clone the
    items. I want to prevent this. And, i would also like to expand my java programming
    knowledge, by being able to control the left hand using a custom plugin. Can someone explain this to me?
     
  2. @Pikkachhu Raaicchu
    The left hand can be accessed using
    Code:java
    1. Inventory.getItemInOffHand()
    . It is also slot number 40 and can be accessed just like any other inventory slot.
     
  3. So, someInventory.setItem(40, new ItemStack(Material.STONE, 1)); would do it?
     
  4. Offline

    Zombie_Striker

    @Pikkachhu Raaicchu
    Actually, no. Slot "40", is the 41 slot, since slots start at 0. What you are looking for is actually slot 39. Also make sure that "someInventory" is an instanceof PlayerInventory first, or else the index may be out of bounds.
     
    bwfcwalshy likes this.
  5. Offline

    I Al Istannen

  6. K thanks everyone
     
  7. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page