1.17.x Drop an item by an entity

Discussion in 'Spigot Plugin Development' started by Kurasava, Sep 18, 2021.

  1. Is it possible to make a mob drop an object with any action with it(not death)? and if so, how to implement it?
     
  2. What do you mean "drop an item"? It is possible to drop in item at the entities location based on pretty much any action/event.
     
  3. Use EntitySpawnEvent, put a custom name for your entity, then with a runnable, drop the item at entity location.
     
  4. are you saying like as we can make players drop any item in their inventory? there are events which include all entities, u can use them
     
  5. You can use the method dropItemNaturally to accomplish it, like:
    Code (Text):

    dropItemNaturally(Location location, ItemStack item);
     
     
  6. thank you for all your answers