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:
@@ -5,4 +5,4 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* Represents a captured state of a Barrel.
|
||||
*/
|
||||
public interface Barrel extends Container, Lootable, Lidded { }
|
||||
public interface Barrel extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory, Lidded { } // Paper
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableBlockInventory; // Paper
|
||||
import org.bukkit.Nameable; // Paper
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -7,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a chest.
|
||||
*/
|
||||
public interface Chest extends Container, Lootable, Lidded {
|
||||
public interface Chest extends Container, LootableBlockInventory, Lidded { // Paper
|
||||
|
||||
/**
|
||||
* Gets the inventory of the chest block represented by this block state.
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* Represents a captured state of a crafter.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface Crafter extends Container, Lootable {
|
||||
public interface Crafter extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory { // Paper - LootTable API
|
||||
|
||||
/**
|
||||
* Gets the number of ticks which this block will remain in the crafting
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.Nameable;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
@@ -8,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a dispenser.
|
||||
*/
|
||||
public interface Dispenser extends Container, Nameable, Lootable {
|
||||
public interface Dispenser extends Container, Nameable, LootableBlockInventory { // Paper
|
||||
|
||||
/**
|
||||
* Gets the BlockProjectileSource object for the dispenser.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a dropper.
|
||||
*/
|
||||
public interface Dropper extends Container, Lootable {
|
||||
public interface Dropper extends Container, LootableBlockInventory { // Paper
|
||||
|
||||
/**
|
||||
* Tries to drop a randomly selected item from the dropper's inventory,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a hopper.
|
||||
*/
|
||||
public interface Hopper extends Container, Lootable { }
|
||||
public interface Hopper extends Container, LootableBlockInventory { } // Paper
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -7,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a ShulkerBox.
|
||||
*/
|
||||
public interface ShulkerBox extends Container, Lootable, Lidded {
|
||||
public interface ShulkerBox extends Container, LootableBlockInventory, Lidded { // Paper
|
||||
|
||||
/**
|
||||
* Get the {@link DyeColor} corresponding to this ShulkerBox
|
||||
|
||||
@@ -6,5 +6,5 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* A {@link Boat} with a chest.
|
||||
*/
|
||||
public interface ChestBoat extends Boat, InventoryHolder, Lootable {
|
||||
public interface ChestBoat extends Boat, InventoryHolder, com.destroystokyo.paper.loottable.LootableEntityInventory { // Paper
|
||||
}
|
||||
|
||||
@@ -61,4 +61,12 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
*/
|
||||
@Nullable
|
||||
public Sound getAmbientSound();
|
||||
|
||||
// Paper start - LootTable API
|
||||
@Override
|
||||
default void setLootTable(final @Nullable org.bukkit.loot.LootTable table, final long seed) {
|
||||
this.setLootTable(table);
|
||||
this.setSeed(seed);
|
||||
}
|
||||
// Paper end - LootTable API
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.entity.minecart;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableEntityInventory;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.loot.Lootable;
|
||||
@@ -7,7 +8,7 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* Represents a Minecart with a Hopper inside it
|
||||
*/
|
||||
public interface HopperMinecart extends Minecart, InventoryHolder, Lootable {
|
||||
public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntityInventory {
|
||||
|
||||
/**
|
||||
* Checks whether or not this Minecart will pick up
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.entity.minecart;
|
||||
|
||||
import com.destroystokyo.paper.loottable.LootableEntityInventory;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.loot.Lootable;
|
||||
@@ -9,5 +10,5 @@ import org.bukkit.loot.Lootable;
|
||||
* minecarts} have their own inventory that can be accessed using methods
|
||||
* from the {@link InventoryHolder} interface.
|
||||
*/
|
||||
public interface StorageMinecart extends Minecart, InventoryHolder, Lootable {
|
||||
public interface StorageMinecart extends Minecart, InventoryHolder, LootableEntityInventory { // Paper
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user