public abstract class InventoryTranslator extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
InventoryTranslator.CraftState |
| Modifier and Type | Field and Description |
|---|---|
static Map<com.github.steveice10.mc.protocol.data.game.window.WindowType,InventoryTranslator> |
INVENTORY_TRANSLATORS |
static int |
PLAYER_INVENTORY_OFFSET |
static int |
PLAYER_INVENTORY_SIZE |
static InventoryTranslator |
PLAYER_INVENTORY_TRANSLATOR |
int |
size |
| Constructor and Description |
|---|
InventoryTranslator() |
| Modifier and Type | Method and Description |
|---|---|
static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
acceptRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request,
List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> containerEntries) |
abstract int |
bedrockSlotToJava(com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData) |
boolean |
checkNetId(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData) |
abstract void |
closeInventory(GeyserSession session,
Inventory inventory) |
abstract Inventory |
createInventory(String name,
int windowId,
com.github.steveice10.mc.protocol.data.game.window.WindowType windowType,
PlayerInventory playerInventory) |
protected void |
dumpStackRequestDetails(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData source,
com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData destination)
Print out the contents of an ItemStackRequest, should the net ID check fail.
|
abstract SlotType |
getSlotType(int javaSlot) |
protected static boolean |
isCursor(com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData) |
abstract int |
javaSlotToBedrock(int javaSlot) |
abstract BedrockContainerSlot |
javaSlotToBedrockContainer(int javaSlot) |
List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> |
makeContainerEntries(GeyserSession session,
Inventory inventory,
Set<Integer> affectedSlots) |
static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ItemEntry |
makeItemEntry(GeyserSession session,
int bedrockSlot,
GeyserItemStack itemStack) |
abstract void |
openInventory(GeyserSession session,
Inventory inventory) |
abstract void |
prepareInventory(GeyserSession session,
Inventory inventory) |
static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
rejectRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
Reject an incorrect ItemStackRequest.
|
static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
rejectRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request,
boolean throwError)
Reject an incorrect ItemStackRequest.
|
boolean |
shouldHandleRequestFirst(com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData action,
Inventory inventory)
Should be overrided if this request matches a certain criteria and shouldn't be treated normally.
|
boolean |
shouldRejectItemPlace(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType bedrockSourceContainer,
int javaSourceSlot,
com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType bedrockDestinationContainer,
int javaDestinationSlot)
Should be overwritten in cases where specific inventories should reject an item being in a specific spot.
|
com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
translateAutoCraftingRequest(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request) |
com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
translateCraftingRequest(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request) |
com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
translateCreativeRequest(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
Handled in
PlayerInventoryTranslator |
com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
translateRequest(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request) |
void |
translateRequests(GeyserSession session,
Inventory inventory,
List<com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest> requests) |
com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response |
translateSpecialRequest(GeyserSession session,
Inventory inventory,
com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
If
shouldHandleRequestFirst(StackRequestActionData, Inventory) returns true, this will be called |
abstract void |
updateInventory(GeyserSession session,
Inventory inventory) |
abstract void |
updateProperty(GeyserSession session,
Inventory inventory,
int key,
int value) |
abstract void |
updateSlot(GeyserSession session,
Inventory inventory,
int slot) |
public static final InventoryTranslator PLAYER_INVENTORY_TRANSLATOR
public static final Map<com.github.steveice10.mc.protocol.data.game.window.WindowType,InventoryTranslator> INVENTORY_TRANSLATORS
public static final int PLAYER_INVENTORY_SIZE
public static final int PLAYER_INVENTORY_OFFSET
public final int size
public abstract void prepareInventory(GeyserSession session, Inventory inventory)
public abstract void openInventory(GeyserSession session, Inventory inventory)
public abstract void closeInventory(GeyserSession session, Inventory inventory)
public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value)
public abstract void updateInventory(GeyserSession session, Inventory inventory)
public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot)
public abstract int bedrockSlotToJava(com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData)
public abstract int javaSlotToBedrock(int javaSlot)
public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot)
public abstract SlotType getSlotType(int javaSlot)
public abstract Inventory createInventory(String name, int windowId, com.github.steveice10.mc.protocol.data.game.window.WindowType windowType, PlayerInventory playerInventory)
public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType bedrockSourceContainer, int javaSourceSlot, com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot)
public boolean shouldHandleRequestFirst(com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData action,
Inventory inventory)
public com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
shouldHandleRequestFirst(StackRequestActionData, Inventory) returns true, this will be calledpublic void translateRequests(GeyserSession session, Inventory inventory, List<com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest> requests)
public com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
public com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
public com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
public com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
PlayerInventoryTranslatorpublic static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response acceptRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request,
List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> containerEntries)
public static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response rejectRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request)
public static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.Response rejectRequest(com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest request,
boolean throwError)
throwError - whether this request was truly erroneous (true), or known as an outcome and should not be treated
as bad (false).protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData source, com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData destination)
public boolean checkNetId(GeyserSession session, Inventory inventory, com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData)
public List<com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ContainerEntry> makeContainerEntries(GeyserSession session, Inventory inventory, Set<Integer> affectedSlots)
public static com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack)
protected static boolean isCursor(com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData slotInfoData)
Copyright © 2021 GeyserMC. All rights reserved.