Class BlockInventoryHolder

java.lang.Object
org.geysermc.geyser.inventory.holder.InventoryHolder
org.geysermc.geyser.inventory.holder.BlockInventoryHolder

public class BlockInventoryHolder extends InventoryHolder
Manages the fake block we implement for each inventory, should we need to. This class will attempt to use a real block first, if possible.
  • Constructor Details

    • BlockInventoryHolder

      public BlockInventoryHolder(Block defaultJavaBlock, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks)
    • BlockInventoryHolder

      public BlockInventoryHolder(BlockState defaultJavaBlockState, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks)
    • BlockInventoryHolder

      public BlockInventoryHolder(BlockState defaultJavaBlockState, @Nullable Class<? extends Block> validBlockClass, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks)
  • Method Details

    • canReuseContainer

      public boolean canReuseContainer(GeyserSession session, Container container, Container previous)
      Specified by:
      canReuseContainer in class InventoryHolder
    • prepareInventory

      public boolean prepareInventory(GeyserSession session, Container container)
      Specified by:
      prepareInventory in class InventoryHolder
    • canUseRealBlock

      protected boolean canUseRealBlock(GeyserSession session, Container container)
    • checkInteractionPosition

      protected boolean checkInteractionPosition(GeyserSession session)
      Will be overwritten in the beacon inventory translator to remove the check, since virtual inventories can't exist.
      Returns:
      if the player's last interaction position and current position match. Used to ensure that we don't select a block to hold the inventory that's wildly out of range.
    • isValidBlock

      protected boolean isValidBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i position, BlockState blockState)
      Returns:
      true if this Java block ID can be used for player inventory.
    • setCustomName

      protected void setCustomName(GeyserSession session, org.cloudburstmc.math.vector.Vector3i position, Inventory inventory, BlockState javaBlockState)
    • openInventory

      public void openInventory(GeyserSession session, Container container)
      Specified by:
      openInventory in class InventoryHolder
    • closeInventory

      public void closeInventory(GeyserSession session, Container container, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType type)
      Specified by:
      closeInventory in class InventoryHolder