Package org.geysermc.geyser.inventory
Class Container
java.lang.Object
org.geysermc.geyser.inventory.Inventory
org.geysermc.geyser.inventory.Container
- Direct Known Subclasses:
AnvilContainer,BeaconContainer,CartographyContainer,CrafterContainer,EnchantingContainer,Generic3X3Container,Generic9X3Container,LecternContainer,MerchantContainer,StonecutterContainer
Combination of
Inventory and PlayerInventory-
Field Summary
FieldsFields inherited from class org.geysermc.geyser.inventory.Inventory
containerType, holderId, holderPosition, items, javaId, size, title -
Constructor Summary
ConstructorsConstructorDescriptionContainer(GeyserSession session, String title, int id, int size, @Nullable org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) -
Method Summary
Modifier and TypeMethodDescriptionintstatic StringgetIntegratedPackTitlePrefix(@Nullable org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) The prefix to add to the title if the integrated pack is active.getItem(int slot) intgetOffsetForHotbar(@org.jetbrains.annotations.Range(from=0L, to=8L) int slot) protected StringgetPrefixedTitle(GeyserSession session, String title) Used for setting the title, which may be modified to apply integrated pack features.intgetSize()booleanWhether we are using a real block when opening this inventory.voidsetItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) voidsetUsingRealBlock(boolean usingRealBlock, Block block) Will be overwritten for droppers.Methods inherited from class org.geysermc.geyser.inventory.Inventory
getBedrockId, getContainerType, getHolderId, getHolderPosition, getJavaId, getNextStateId, getStateId, getTitle, incrementStateId, isDisplayed, resetNextStateId, setBedrockId, setDisplayed, setHolderId, setHolderPosition, setStateId, shouldConfirmContainerClose, toString, updateItemNetId
-
Field Details
-
playerInventory
-
-
Constructor Details
-
Container
public Container(GeyserSession session, String title, int id, int size, @Nullable org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType)
-
-
Method Details
-
getItem
-
getOffsetForHotbar
public int getOffsetForHotbar(@org.jetbrains.annotations.Range(from=0L, to=8L) int slot) - Specified by:
getOffsetForHotbarin classInventory
-
setItem
-
getSize
public int getSize() -
setUsingRealBlock
Will be overwritten for droppers.- Parameters:
usingRealBlock- whether this container is using a real container or notblock- the Java block, if real
-
getPrefixedTitle
Description copied from class:InventoryUsed for setting the title, which may be modified to apply integrated pack features. SeegetPrefixedTitle(GeyserSession, String)- Overrides:
getPrefixedTitlein classInventory- Returns:
- the title to display
-
getIntegratedPackTitlePrefix
public static String getIntegratedPackTitlePrefix(@Nullable org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) The prefix to add to the title if the integrated pack is active. It is used within the GeyserIntegratedPack to apply specific changes.This prefix should always consist of (invalid) color codes only. Color codes prevent the client from cropping the title text for being too long.
- Returns:
- a prefix for the title
-
getPlayerInventory
-
getContainerSize
public int getContainerSize() -
isUsingRealBlock
public boolean isUsingRealBlock()Whether we are using a real block when opening this inventory.
-