Solved Cast EntityType to ItemStack?

Discussion in 'Plugin Development' started by Uniclaw, Nov 15, 2012.

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

    Uniclaw

    Hi!

    If i have a EntityType like dropped_item, how i can cast it to an ItemStack?

    I've tryed a thing like this:
    Code:
    (Theentitytype)Item.getItemStack();
    But its not working...

    Greet
     
  2. Offline

    fireblast709

    if you have an Item instance, just call .getItemStack() on it. Should work fine
     
  3. Offline

    Uniclaw

    Yeah, but i don't have the item instance :/
    fireblast709
     
  4. Offline

    fireblast709

    What do you want to do then?
     
  5. Offline

    Uniclaw

    Convert the EntityType wich i get from the RightclickEntityEvent to an Item, and then getting an ItemStack with getItemStack(); :)
    fireblast709
     
  6. Offline

    fireblast709

    Uniclaw here ya go :3
    Code:java
    1. @EventHandler
    2. public void onInteractEntity(PlayerInteractEntityEvent event)
    3. {
    4. if(event.getRightClicked() instanceof Item)
    5. {
    6. ItemStack i = ((Item)event.getRightClicked()).getItemStack();
    7. }
    8. }
     
  7. Offline

    Uniclaw

    Thanks :D ! Awesome :D !!
     
Thread Status:
Not open for further replies.

Share This Page