drop item

Discussion in 'Plugin Development' started by spacemoehre, Aug 24, 2014.

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

    spacemoehre

    I want to have such a little dropped item (material m) on my Block.

    getBlock().getLocation()
     
  2. Maby someting like this:
    Location loc = //BlockLocation//
    World blockworld = //BlockLocation//.getWorld();
    Bukkit.getServer.getWorld(BlockWorld).dropItem(m);
    Replace blocklocation whit the location o the block.
    Replace all the wrong spelled words whit good spelled words.
     
  3. Offline

    TheMcScavenger

    Maybe something like this:
    Location loc = //BlockLocation//
    World blockworld = //BlockLocation//.getWorld();
    Bukkit.getServer.getWorld(BlockWorld).dropItem(m);
    Replace blocklocation with the location of the block.
    Replace all the wrong spelled words with properly spelled words.
     
  4. TheMcScavenger Thank you,
    My English is not so good and i make the same mistakes all the time. (Like maybe maby, with whit) ('someting' and o was just a mistake typing on my tablet)
    Maybe is has to do something whit my dyslexie or the size of the tablet.
     
  5. Offline

    TheMcScavenger

    Just use autocorrect.
     
  6. Offline

    spacemoehre

    this is not about correct language. ^^ its about a problem and if i can understand him its fine, but i prefer to put it al in one line^^:
    Bukkit.getWorld(c.getBlock().getWorld().getName()).dropItem(c.getBlock().getLocation(), new ItemStack(m,1));

    ok it works, but i want that it stays at the location where it was dropped. you no an advice? TheLegendOffPabu

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  7. Code:java
    1. @EventHandler
    2. public void dropItemOnBlockBreak(BlockBreakEvent e)
    3. {
    4. Location blockLocation = e.getblock().getLocation();
    5.  
    6. e.getBlock().getWorld().dropItemNaturally(blockLocation, new ItemStack(Material.DIAMOND));
    7. }
     
  8. Offline

    spacemoehre

    parat26 the item is not exact in the middle of the block. i want that it is on the block, exact in the middle
     
  9. Maybe you can set the pickup delay at the material? Just make a itemstack and drop that item stack.
    And i think it is .setPickupDelay(//delay//); Or you have to make a ItemPickupevent or playerpickupevent, And you check o the location is the same as the block.
     
  10. Offline

    spacemoehre

    TheLegendOffPabu what would a delay be usefull for?
    is there an event witch is used when the plugin 'drops' an item?
     
  11. No there is no event for that,
    maybe i did read it wrong but i did think that you want the item to stay on the block?
    If you set te pickupdelay so high that it cant be picked op?
    And do you use .dropItem or .dropItemNaturally ? If it wont stay on the right position maybe you can do something with the spawnEntity() ?
    I will look at my eclipse
     
Thread Status:
Not open for further replies.

Share This Page