Solved Summon dropped item

Discussion in 'Plugin Development' started by CraterHater, Jun 26, 2015.

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

    CraterHater

    How do I summon an dropped item that is an dragon egg and has the custom name: Mount.
    It must be so when picked up aswell.
     
  2. Offline

    NathanWolf

    Create an ItemStack for the dragon egg, give it a display name. Then spawn an Item entity, give it your item stack and a custom name.
     
  3. Offline

    CraterHater

    Example maybe?
     
  4. Offline

    iSexyChocobo

    Code:
        ItemStack item = new ItemStack(Material.DIRT);
        ItemMeta itemmeta = item.getItemMeta();
        itemmeta.setDisplayName("Item Name");
        item.setItemMeta(itemmeta);
    Then you just drop the item (named "item") naturally somewhere.
     
  5. Offline

    CraterHater

    How to summon it than?
     
  6. Offline

    NathanWolf

    Like the above poster said, World.dropItemNaturally will do it the same way as if a player dropped the item in-game.

    It will return the Item entity, if you want to call setCustomName.

    Side-note: It's a real shame that Curse took down the javadocs, and the only place I can find that hosts them is something I'm afraid to link to just because of the domain name.
     
  7. Offline

    megamichiel

  8. Offline

    NathanWolf

    Yes, and Curse happens to be known to ban people for even mentioning Spigot, let alone linking to their site. Maybe they've gotten more lenient about that - but yes, that is what I was referring to without referring to it.
     
  9. Offline

    CraterHater

  10. Offline

    iSexyChocobo

    @CraterHater

    What part do you not get? It's basically copy paste at this point.
     
  11. Offline

    CraterHater

    Yeah I got it, thanks for all the help
     
    NathanWolf likes this.
Thread Status:
Not open for further replies.

Share This Page