Package org.geysermc.geyser.inventory
Class Inventory
java.lang.Object
org.geysermc.geyser.inventory.Inventory
- Direct Known Subclasses:
Container,PlayerInventory
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerTypeUsed for smooth transitions between two windows of the same type.protected longThe entity id of the entity holding the inventory.protected org.cloudburstmc.math.vector.Vector3iThe location of the inventory block.protected final GeyserItemStack[]protected final intprotected final intprotected final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInventory(GeyserSession session, int id, int size, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) protectedInventory(GeyserSession session, String title, int javaId, int size, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) -
Method Summary
Modifier and TypeMethodDescriptionintorg.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerTypeUsed for smooth transitions between two windows of the same type.longThe entity id of the entity holding the inventory.org.cloudburstmc.math.vector.Vector3iThe location of the inventory block.getItem(int slot) intintSeeClickPlan.execute(boolean); used as a hackabstract intgetOffsetForHotbar(@org.jetbrains.annotations.Range(from=0L, to=8L) int slot) intgetSize()intThe Java inventory state ID from the server.getTitle()voidincrementStateId(int count) SeeClickPlan.execute(boolean)for more details.booleanWhether this inventory is currently shown to the Bedrock player.voidvoidsetBedrockId(int bedrockId) voidsetDisplayed(boolean displayed) Whether this inventory is currently shown to the Bedrock player.voidsetHolderId(long holderId) The entity id of the entity holding the inventory.voidsetHolderPosition(org.cloudburstmc.math.vector.Vector3i holderPosition) The location of the inventory block.voidsetItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) voidsetStateId(int stateId) The Java inventory state ID from the server.booleanWhether we should be sending aServerboundContainerClosePacketwhen closing the inventory.toString()static voidupdateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session)
-
Field Details
-
javaId
protected final int javaId -
size
protected final int size -
containerType
protected final org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerTypeUsed for smooth transitions between two windows of the same type. -
title
-
items
-
holderPosition
protected org.cloudburstmc.math.vector.Vector3i holderPositionThe location of the inventory block. Will either be a fake block above the player's head, or the actual block location. -
holderId
protected long holderIdThe entity id of the entity holding the inventory. Either this, or the holder position must be set in order for Bedrock to open inventories.
-
-
Constructor Details
-
Inventory
protected Inventory(GeyserSession session, int id, int size, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) -
Inventory
protected Inventory(GeyserSession session, String title, int javaId, int size, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType)
-
-
Method Details
-
getItem
-
getOffsetForHotbar
public abstract int getOffsetForHotbar(@org.jetbrains.annotations.Range(from=0L, to=8L) int slot) -
setItem
-
updateItemNetId
public static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session) -
incrementStateId
public void incrementStateId(int count) SeeClickPlan.execute(boolean)for more details. -
resetNextStateId
public void resetNextStateId() -
shouldConfirmContainerClose
public boolean shouldConfirmContainerClose()Whether we should be sending aServerboundContainerClosePacketwhen closing the inventory. -
toString
-
getJavaId
public int getJavaId() -
setBedrockId
public void setBedrockId(int bedrockId) -
getBedrockId
public int getBedrockId() -
getStateId
public int getStateId()The Java inventory state ID from the server. As of Java Edition 1.18.1 this value has one instance per player. If this is out of sync with the server when a packet containing it is handled, the server will resync items. This field has existed since Java Edition 1.17.1. -
setStateId
public void setStateId(int stateId) The Java inventory state ID from the server. As of Java Edition 1.18.1 this value has one instance per player. If this is out of sync with the server when a packet containing it is handled, the server will resync items. This field has existed since Java Edition 1.17.1. -
getNextStateId
public int getNextStateId()SeeClickPlan.execute(boolean); used as a hack -
getSize
public int getSize() -
getContainerType
public org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType getContainerType()Used for smooth transitions between two windows of the same type. -
getTitle
-
getHolderPosition
public org.cloudburstmc.math.vector.Vector3i getHolderPosition()The location of the inventory block. Will either be a fake block above the player's head, or the actual block location. -
setHolderPosition
public void setHolderPosition(org.cloudburstmc.math.vector.Vector3i holderPosition) The location of the inventory block. Will either be a fake block above the player's head, or the actual block location. -
getHolderId
public long getHolderId()The entity id of the entity holding the inventory. Either this, or the holder position must be set in order for Bedrock to open inventories. -
setHolderId
public void setHolderId(long holderId) The entity id of the entity holding the inventory. Either this, or the holder position must be set in order for Bedrock to open inventories. -
isDisplayed
public boolean isDisplayed()Whether this inventory is currently shown to the Bedrock player. -
setDisplayed
public void setDisplayed(boolean displayed) Whether this inventory is currently shown to the Bedrock player.
-