Interface BlockEntityInventory<T extends BlockEntity & Carrier>
- Type Parameters:
T- Block entity type, the specified BE must be a
- All Superinterfaces:
public interface BlockEntityInventory<T extends BlockEntity & Carrier> extends PersistentInventory, ViewableInventory, CarriedInventory<T>An
Inventorywhich is owned by a
BlockEntity. In Sponge, a BE is never seen as an Inventory itself and Block Entities are instead considered to "own" their own Inventory (much like equipable entities do). Underlying implementations are of course completely at liberty to return the BE object directly but as far as consumers are concerned the BE instance and the inventory are separate things.
This is intended to provide a consistent way of dealing with inventories regardless of the "owner" of the inventory. Thus, any code capable of dealing with a
Carrieris intrinsically able to deal with a BE inventory just as they would with any Entity inventory or any other type of Carrier for that matter.
This separation of inventory logic from the BE itself also serves to provide some flexibility for implementors, since it is possible that not all implementations may take the view that a BE embodies its own inventory.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
blockEntity()Returns the owner of this Inventory.
Methods inherited from interface org.spongepowered.api.item.inventory.Inventory
asViewable, canFit, capacity, children, clear, contains, contains, containsAny, containsChild, containsInventory, freeCapacity, get, get, hasChildren, intersect, offer, offer, parent, peek, peekAt, poll, poll, pollFrom, pollFrom, query, query, query, query, query, query, root, set, slot, slots, totalQuantity, union
Methods inherited from interface org.spongepowered.api.item.inventory.type.PersistentInventory
Methods inherited from interface org.spongepowered.api.data.value.ValueContainer
getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, supports, supports
java.util.Optional<T> blockEntity()Returns the owner of this Inventory.
- This inventory's carrier