LootTable API

Provides API to control what Loot Table an object uses.

Also provides an Event to control if a lootable inventory should
auto replenish for a player.

Provides methods to determine players looted state for an object
This commit is contained in:
Aikar
2016-05-01 15:19:49 -04:00
parent 391451207f
commit 397d3cac4b
16 changed files with 259 additions and 10 deletions

View File

@@ -35,6 +35,31 @@ public interface Lootable {
@Nullable
LootTable getLootTable();
// Paper start
/**
* Set the loot table and seed for a container or entity at the same time.
*
* @param table the Loot Table this {@link org.bukkit.block.Container} or {@link org.bukkit.entity.Mob} will have.
* @param seed the seed to used to generate loot. Default is 0.
*/
void setLootTable(final @Nullable LootTable table, final long seed);
/**
* Returns whether or not this object has a Loot Table
* @return Has a loot table
*/
default boolean hasLootTable() {
return this.getLootTable() != null;
}
/**
* Clears the associated Loot Table to this object
*/
default void clearLootTable() {
this.setLootTable(null);
}
// Paper end
/**
* Set the seed used when this Loot Table generates loot.
*