Package com.loohp.limbo.inventory
Class InventoryView
java.lang.Object
com.loohp.limbo.inventory.InventoryView
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents various extra properties of certain inventory windows.static class
Deprecated. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInventoryView
(Player player, net.kyori.adventure.text.Component title, Inventory topInventory, Inventory bottomInventory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
convertSlot
(int rawSlot) Converts a raw slot ID into its local slot ID into whichever of the two inventories the slot points to.int
Check the total number of slots in this view, combining the upper and lower inventories.getInventory
(int rawSlot) Gets the inventory corresponding to the given raw slot ID.getItem
(int index) getSlotType
(int slot) Determine the type of the slot by its raw slot ID.net.kyori.adventure.text.Component
getTitle()
getType()
Deprecated.boolean
isSlot
(int index) void
setCarriedItem
(ItemStack carriedItem) void
void
setProperty
(InventoryView.Property prop, int value) void
-
Field Details
-
OUTSIDE
public static final int OUTSIDE- See Also:
-
-
Constructor Details
-
InventoryView
-
-
Method Details
-
getCarriedItem
-
setCarriedItem
-
getType
-
getPlayer
-
getTitle
public net.kyori.adventure.text.Component getTitle() -
getTopInventory
-
getBottomInventory
-
getProperties
-
getInventory
Gets the inventory corresponding to the given raw slot ID. If the slot ID isOUTSIDE
null will be returned, otherwise behaviour for illegal and negative slot IDs is undefined. May be used withconvertSlot(int)
to directly index an underlying inventory.- Parameters:
rawSlot
- The raw slot ID.- Returns:
- corresponding inventory, or null
-
convertSlot
public int convertSlot(int rawSlot) Converts a raw slot ID into its local slot ID into whichever of the two inventories the slot points to.If the raw slot refers to the upper inventory, it will be returned unchanged and thus be suitable for getTopInventory().getItem(); if it refers to the lower inventory, the output will differ from the input and be suitable for getBottomInventory().getItem().
- Parameters:
rawSlot
- The raw slot ID.- Returns:
- The converted slot ID.
-
getSlotType
Determine the type of the slot by its raw slot ID.If the type of the slot is unknown, then
InventoryType.SlotType.CONTAINER
will be returned.- Parameters:
slot
- The raw slot ID- Returns:
- the slot type
-
countSlots
public int countSlots()Check the total number of slots in this view, combining the upper and lower inventories.Note though that it's possible for this to be greater than the sum of the two inventories if for example some slots are not being used.
- Returns:
- The total size
-
close
public void close() -
isSlot
public boolean isSlot(int index) -
getItem
-
setItem
-
setProperty
-
updateView
public void updateView() -
getUnsafe
Deprecated.
-