Class MerchantInventoryTranslator
java.lang.Object
org.geysermc.geyser.translator.inventory.InventoryTranslator<MerchantContainer>
org.geysermc.geyser.translator.inventory.BaseInventoryTranslator<MerchantContainer>
org.geysermc.geyser.translator.inventory.MerchantInventoryTranslator
-
Nested Class Summary
Nested classes/interfaces inherited from class org.geysermc.geyser.translator.inventory.InventoryTranslator
InventoryTranslator.CraftState -
Field Summary
Fields inherited from class org.geysermc.geyser.translator.inventory.InventoryTranslator
PLAYER_INVENTORY_OFFSET, PLAYER_INVENTORY_SIZE, PLAYER_INVENTORY_TRANSLATOR, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbedrockSlotToJava(org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData slotInfoData) Converts the Bedrock slot to the corresponding Java slot.voidcloseInventory(GeyserSession session, MerchantContainer container, boolean force) Closes the inventory, and if necessary, cleans up the prepared inventory.createInventory(GeyserSession session, String name, int windowId, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) Creates a new inventory.getSlotType(int javaSlot) Returns the slot type for a Java slot idintjavaSlotToBedrock(int slot) Converts a Java slot to the corresponding Bedrock slot.javaSlotToBedrockContainer(int slot, MerchantContainer container) Converts a Java slot to the corresponding Bedrock container and slotvoidopenInventory(GeyserSession session, MerchantContainer container) Opens the previously prepared inventory.booleanprepareInventory(GeyserSession session, MerchantContainer container) Prepares the inventory before opening it.org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponsetranslateAutoCraftingRequest(GeyserSession session, MerchantContainer container, org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest request) org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponsetranslateCraftingRequest(GeyserSession session, MerchantContainer container, org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest request) voidupdateInventory(GeyserSession session, MerchantContainer container) Updates the inventory by re-sending items for all slots of the inventory.voidupdateSlot(GeyserSession session, MerchantContainer container, int slot) Updates a specific slot by re-sending the item.Methods inherited from class org.geysermc.geyser.translator.inventory.BaseInventoryTranslator
updatePropertyMethods inherited from class org.geysermc.geyser.translator.inventory.InventoryTranslator
acceptRequest, canReuseInventory, checkNetId, dumpStackRequestDetails, getGridSize, inventoryTranslator, isCursor, makeContainerEntries, rejectRequest, rejectRequest, requiresOpeningDelay, shouldHandleRequestFirst, shouldRejectItemPlace, translateCreativeRequest, translateRequest, translateRequests, translateSpecialRequest
-
Constructor Details
-
MerchantInventoryTranslator
public MerchantInventoryTranslator()
-
-
Method Details
-
javaSlotToBedrock
public int javaSlotToBedrock(int slot) Description copied from class:InventoryTranslatorConverts a Java slot to the corresponding Bedrock slot.- Overrides:
javaSlotToBedrockin classBaseInventoryTranslator<MerchantContainer>
-
javaSlotToBedrockContainer
Description copied from class:InventoryTranslatorConverts a Java slot to the corresponding Bedrock container and slot- Overrides:
javaSlotToBedrockContainerin classBaseInventoryTranslator<MerchantContainer>
-
bedrockSlotToJava
public int bedrockSlotToJava(org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData slotInfoData) Description copied from class:InventoryTranslatorConverts the Bedrock slot to the corresponding Java slot.- Overrides:
bedrockSlotToJavain classBaseInventoryTranslator<MerchantContainer>
-
getSlotType
Description copied from class:InventoryTranslatorReturns the slot type for a Java slot id- Overrides:
getSlotTypein classBaseInventoryTranslator<MerchantContainer>
-
prepareInventory
Description copied from class:InventoryTranslatorPrepares the inventory before opening it. Bedrock requires the inventory to "exist" before opening it - that can be either a real block (e.g. chest), or an entity (e.g. horse)- Specified by:
prepareInventoryin classInventoryTranslator<MerchantContainer>- Returns:
- whether the inventory was successfully prepared
-
openInventory
Description copied from class:InventoryTranslatorOpens the previously prepared inventory.- Specified by:
openInventoryin classInventoryTranslator<MerchantContainer>
-
closeInventory
Description copied from class:InventoryTranslatorCloses the inventory, and if necessary, cleans up the prepared inventory.- Specified by:
closeInventoryin classInventoryTranslator<MerchantContainer>
-
translateCraftingRequest
public org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse translateCraftingRequest(GeyserSession session, MerchantContainer container, org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest request) - Overrides:
translateCraftingRequestin classInventoryTranslator<MerchantContainer>
-
translateAutoCraftingRequest
public org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse translateAutoCraftingRequest(GeyserSession session, MerchantContainer container, org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest request) - Overrides:
translateAutoCraftingRequestin classInventoryTranslator<MerchantContainer>
-
updateInventory
Description copied from class:InventoryTranslatorUpdates the inventory by re-sending items for all slots of the inventory.- Specified by:
updateInventoryin classInventoryTranslator<MerchantContainer>
-
updateSlot
Description copied from class:InventoryTranslatorUpdates a specific slot by re-sending the item.- Specified by:
updateSlotin classInventoryTranslator<MerchantContainer>
-
createInventory
public MerchantContainer createInventory(GeyserSession session, String name, int windowId, org.geysermc.mcprotocollib.protocol.data.game.inventory.ContainerType containerType) Description copied from class:InventoryTranslatorCreates a new inventory.- Overrides:
createInventoryin classBaseInventoryTranslator<MerchantContainer>
-