Solved Item hovering over head

Discussion in 'Plugin Development' started by Twisted_Panda, Jul 7, 2015.

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

    Twisted_Panda

    How would I go threw with this, set the item as a passenger ?
     
  2. Set the item as a passenger and store its uuid in some sort of array.
    In the PlayerPickupItemEvent check if the items uuid is in the array, if it is cancel the event.
     
  3. Offline

    Twisted_Panda

    Guessing i'm casting this wrong been a long time.

    Code:
    Item item = (Item) e.getPlayer().getItemInHand();
    
    e.getPlayer().setPassenger(item);
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack cannot be cast to org.bukkit.entity.Item
     
  4. ItemStack is not Item. ItemStack is the item you can have in an inventory and Item is an Entity.
    You first need to spawn the item entity with world.dropItem(location, itemstack) and then set the entity to the passenger
     
  5. Offline

    Twisted_Panda

    Thank you got it working
     
Thread Status:
Not open for further replies.

Share This Page