Package org.geysermc.geyser.inventory
Class InventoryHolder<T extends Inventory>
java.lang.Object
org.geysermc.geyser.inventory.InventoryHolder<T>
A helper class storing the current inventory, translator, and session.
-
Constructor Summary
ConstructorsConstructorDescriptionInventoryHolder(GeyserSession session, Inventory newInventory, InventoryTranslator<? extends Inventory> newTranslator) -
Method Summary
Modifier and TypeMethodDescriptionintvoidcloseInventory(boolean force) intStores the number of attempts to open virtual inventories.containerOpenAttempts(int containerOpenAttempts) Stores the number of attempts to open virtual inventories.voidvoidinheritFromExisting(InventoryHolder<? extends Inventory> existing) intjavaId()voidvoidbooleanpending()Whether this inventory is currently pending.pending(boolean pending) Whether this inventory is currently pending.booleanbooleansession()booleanshouldConfirmClose(boolean confirm) booleantoString()voidtranslateRequests(List<org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest> requests) voidvoidupdateProperty(int rawProperty, int value) voidupdateSlot(int slot)
-
Constructor Details
-
InventoryHolder
public InventoryHolder(GeyserSession session, Inventory newInventory, InventoryTranslator<? extends Inventory> newTranslator)
-
-
Method Details
-
markCurrent
public void markCurrent() -
shouldSetPending
public boolean shouldSetPending() -
shouldConfirmClose
public boolean shouldConfirmClose(boolean confirm) -
inheritFromExisting
-
updateInventory
public void updateInventory() -
updateProperty
public void updateProperty(int rawProperty, int value) -
updateSlot
public void updateSlot(int slot) -
openInventory
public void openInventory() -
closeInventory
public void closeInventory(boolean force) -
requiresOpeningDelay
public boolean requiresOpeningDelay() -
prepareInventory
public boolean prepareInventory() -
translateRequests
public void translateRequests(List<org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest> requests) -
session
-
inventory
-
translator
-
incrementContainerOpenAttempts
public void incrementContainerOpenAttempts() -
javaId
public int javaId() -
bedrockId
public int bedrockId() -
toString
-
pending
public boolean pending()Whether this inventory is currently pending. It can be pending if this inventory was opened while another inventory was still open, or because opening this inventory takes more time (e.g. virtual inventories). -
containerOpenAttempts
public int containerOpenAttempts()Stores the number of attempts to open virtual inventories. Capped at 3, and isn't used in ideal circumstances. Used to resolve container closing issues. -
pending
Whether this inventory is currently pending. It can be pending if this inventory was opened while another inventory was still open, or because opening this inventory takes more time (e.g. virtual inventories).- Returns:
this.
-
containerOpenAttempts
Stores the number of attempts to open virtual inventories. Capped at 3, and isn't used in ideal circumstances. Used to resolve container closing issues.- Returns:
this.
-