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

public class Container extends Inventory
Combination of Inventory and PlayerInventory
  • Field Details

  • Constructor Details

    • Container

      public Container(GeyserSession session, String title, int id, int size, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType)
  • Method Details

    • getItem

      public GeyserItemStack getItem(int slot)
      Overrides:
      getItem in class Inventory
    • getOffsetForHotbar

      public int getOffsetForHotbar(@org.jetbrains.annotations.Range(from=0L, to=8L) int slot)
      Specified by:
      getOffsetForHotbar in class Inventory
    • setItem

      public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session)
      Overrides:
      setItem in class Inventory
    • getSize

      public int getSize()
      Overrides:
      getSize in class Inventory
    • setUsingRealBlock

      public void setUsingRealBlock(boolean usingRealBlock, Block block)
      Will be overwritten for droppers.
      Parameters:
      usingRealBlock - whether this container is using a real container or not
      block - the Java block, if real
    • getPrefixedTitle

      protected String getPrefixedTitle(GeyserSession session, String title)
      Description copied from class: Inventory
      Used for setting the title, which may be modified to apply integrated pack features. See getPrefixedTitle(GeyserSession, String)
      Overrides:
      getPrefixedTitle in class Inventory
      Returns:
      the title to display
    • getIntegratedPackTitlePrefix

      public static String getIntegratedPackTitlePrefix(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

      public PlayerInventory getPlayerInventory()
    • getContainerSize

      public int getContainerSize()
    • isUsingRealBlock

      public boolean isUsingRealBlock()
      Whether we are using a real block when opening this inventory.