#591: Add option for a consumer before spawning an item

By: Martoph <sager1018@gmail.com>
This commit is contained in:
Bukkit/Spigot 2021-03-09 08:47:28 +11:00
parent 3df2b9e2ab
commit d1017aa606

View File

@ -471,6 +471,18 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public Item dropItem(@NotNull Location location, @NotNull ItemStack item);
/**
* Drops an item at the specified {@link Location}
* Note that functions will run before the entity is spawned
*
* @param location Location to drop the item
* @param item ItemStack to drop
* @param function the function to be run before the entity is spawned.
* @return ItemDrop entity created as a result of this method
*/
@NotNull
public Item dropItem(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
/**
* Drops an item at the specified {@link Location} with a random offset
*
@ -481,6 +493,18 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item);
/**
* Drops an item at the specified {@link Location} with a random offset
* Note that functions will run before the entity is spawned
*
* @param location Location to drop the item
* @param item ItemStack to drop
* @param function the function to be run before the entity is spawned.
* @return ItemDrop entity created as a result of this method
*/
@NotNull
public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
/**
* Creates an {@link Arrow} entity at the given {@link Location}
*