Interface BlockEntityInventory<T extends BlockEntity & Carrier>
- Type Parameters:
T
- Block entity type, the specified BE must be aCarrier
- All Superinterfaces:
CarriedInventory<T>
,Inventory
,PersistentInventory
,ValueContainer
,ViewableInventory
public interface BlockEntityInventory<T extends BlockEntity & Carrier>
extends PersistentInventory, ViewableInventory, CarriedInventory<T>
An
Inventory
which 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 Carrier
is 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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.item.inventory.Inventory
Inventory.Builder
Nested classes/interfaces inherited from interface org.spongepowered.api.item.inventory.type.ViewableInventory
ViewableInventory.Builder
-
Method Summary
Methods inherited from interface org.spongepowered.api.item.inventory.type.CarriedInventory
carrier
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
markDirty
Methods inherited from interface org.spongepowered.api.data.value.ValueContainer
getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, supports, supports
Methods inherited from interface org.spongepowered.api.item.inventory.type.ViewableInventory
asMenu, canInteractWith, hasViewers, viewers
-
Method Details
-
blockEntity
Returns the owner of this Inventory.- Returns:
- This inventory's carrier
-