Can't pick up item

Discussion in 'Plugin Development' started by Anrza, Mar 10, 2015.

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

    Anrza

    I spawn an item with world.dropItem() or dropItemNaturally() (tried both, same result).
    I set the pickUpDelay to 0.
    The item is spawned in just the way it should.
    However, when I try to pick it up, it wont let me.
    PlayerPickUpItemEvent is not called.
    I can pick up any other item, on which PlayerPickUpItemEvent IS called.

    I have also tried
    Code:
        @EventHandler(priority = EventPriority.MONITOR)
        public void a(ItemSpawnEvent event) {
            event.getEntity().setPickupDelay(0);
        }
    Which is called an executed and everything, but doesn't make a difference for the items spawned with dropItem().
     
  2. @Anrza Could you post the code of the item being dropped?
     
  3. Offline

    mine-care

  4. mine-care likes this.
  5. Offline

    mine-care

    @CodePlaysMinecraft :O sorry, thanks for pointing it out... I gues I need some rest 0_0
    So the above post goes to
    @Anrza
     
    CodePlaysMinecraft likes this.
  6. Offline

    Anrza

    Code:
    ItemStack is = new ItemStack(Material.IRON_SPADE);
                is.setAmount(entity.getMetadata("b").get(0).asInt());
                ItemMeta im = is.getItemMeta();
                im.setDisplayName("a");
                is.setItemMeta(im);
                Item i = entity.getWorld().dropItem(entity.getLocation(), is);
                String c = ((Entity) ((Projectile) entity).getShooter()).getUniqueId().toString();
                i.setMetadata("owner", new FixedMetadataValue(SiegeHardCode.plugin, c));
    Nothing weird in there.

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  7. @Anrza Is there any errors when the plugin is loaded of when the item is dropped? If so please post it.
     
  8. Offline

    Anrza

    Nope, no error whatsoever on either of the occasions.
     
  9. @Anrza You said you set the pickup delay to 0? Try removing that and see if you can pick up the item, that could be your problem.
     
  10. Offline

    Anrza

    I only set the pickUpDelay to 0 in order to make sure there was no ridiculously high delay preventing me from picking it up. Couldn't pick it up before I added it either.
     
  11. @Anrza Do you think you could paste me all of your code so I can take a look at it?
     
  12. Offline

    Anrza

    You have all of it, except for the debug code.
     
  13. @Anrza Then I am sorry for wasting your time but I really don't know where the problem is...
     
    Last edited: Mar 11, 2015
  14. Offline

    Anrza

Thread Status:
Not open for further replies.

Share This Page