Class BlockInventoryHolder
java.lang.Object
org.geysermc.geyser.inventory.holder.InventoryHolder
org.geysermc.geyser.inventory.holder.BlockInventoryHolder
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 Summary
ConstructorsConstructorDescriptionBlockInventoryHolder(Block defaultJavaBlock, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks) BlockInventoryHolder(BlockState defaultJavaBlockState, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanReuseContainer(GeyserSession session, Container container, Container previous) protected booleancanUseRealBlock(GeyserSession session, Container container) protected booleancheckInteractionPosition(GeyserSession session) Will be overwritten in the beacon inventory translator to remove the check, since virtual inventories can't exist.voidcloseInventory(GeyserSession session, Container container, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType type) protected booleanisValidBlock(GeyserSession session, org.cloudburstmc.math.vector.Vector3i position, BlockState blockState) voidopenInventory(GeyserSession session, Container container) booleanprepareInventory(GeyserSession session, Container container) protected voidsetCustomName(GeyserSession session, org.cloudburstmc.math.vector.Vector3i position, Inventory inventory, BlockState javaBlockState)
-
Constructor Details
-
BlockInventoryHolder
-
BlockInventoryHolder
public BlockInventoryHolder(BlockState defaultJavaBlockState, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType containerType, Block... validBlocks)
-
-
Method Details
-
canReuseContainer
- Specified by:
canReuseContainerin classInventoryHolder
-
prepareInventory
- Specified by:
prepareInventoryin classInventoryHolder
-
canUseRealBlock
-
checkInteractionPosition
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
- Specified by:
openInventoryin classInventoryHolder
-
closeInventory
public void closeInventory(GeyserSession session, Container container, org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType type) - Specified by:
closeInventoryin classInventoryHolder
-