mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-21 14:26:22 +01:00
Clean up inventory packet sending
This commit is contained in:
parent
fb868e41ed
commit
264a914d41
15 changed files with 29 additions and 97 deletions
|
@ -15,7 +15,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
|
|||
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
|
||||
|
||||
## Supported Versions
|
||||
Geyser is currently supporting Minecraft Bedrock 1.20.80 - 1.21.30 and Minecraft Java 1.21/1.21.1. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
|
||||
Geyser is currently supporting Minecraft Bedrock 1.20.80 - 1.21.40 and Minecraft Java 1.21/1.21.1. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
|
||||
|
||||
## Setting Up
|
||||
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.
|
||||
|
|
|
@ -31,8 +31,6 @@ import net.kyori.adventure.text.Component;
|
|||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
|
@ -80,8 +78,6 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(bedrockSlot);
|
||||
slotPacket.setItem(inventory.getItem(i).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +98,6 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
} else if (lastTargetSlot != javaSlot) {
|
||||
// Update the previous target slot to remove repair cost changes
|
||||
|
@ -111,8 +105,6 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(lastTargetSlot));
|
||||
slotPacket.setItem(inventory.getItem(lastTargetSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
|
||||
|
@ -176,8 +168,6 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(slot));
|
||||
slotPacket.setItem(itemData);
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,10 @@
|
|||
|
||||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
@ -63,8 +61,6 @@ public class ChestInventoryUpdater extends InventoryUpdater {
|
|||
InventoryContentPacket contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(inventory.getBedrockId());
|
||||
contentPacket.setContents(bedrockItems);
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
}
|
||||
|
||||
|
@ -77,8 +73,6 @@ public class ChestInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(inventory.getBedrockId());
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
@ -51,8 +49,6 @@ public class ContainerInventoryUpdater extends InventoryUpdater {
|
|||
InventoryContentPacket contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(inventory.getBedrockId());
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
}
|
||||
|
||||
|
@ -65,8 +61,6 @@ public class ContainerInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(inventory.getBedrockId());
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
@ -58,8 +56,6 @@ public class CrafterInventoryUpdater extends InventoryUpdater {
|
|||
contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(inventory.getBedrockId());
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
|
||||
// inventory and hotbar
|
||||
|
@ -71,8 +67,6 @@ public class CrafterInventoryUpdater extends InventoryUpdater {
|
|||
contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(ContainerId.INVENTORY);
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
|
||||
// Crafter result - it doesn't come after the grid, as explained elsewhere.
|
||||
|
@ -94,8 +88,6 @@ public class CrafterInventoryUpdater extends InventoryUpdater {
|
|||
packet.setContainerId(containerId);
|
||||
packet.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
packet.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
packet.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
packet.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(packet);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
@ -51,8 +49,6 @@ public class HorseInventoryUpdater extends InventoryUpdater {
|
|||
InventoryContentPacket contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(inventory.getBedrockId());
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
}
|
||||
|
||||
|
@ -65,8 +61,6 @@ public class HorseInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(4); // Horse GUI?
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
@ -47,8 +45,6 @@ public class InventoryUpdater {
|
|||
InventoryContentPacket contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(ContainerId.INVENTORY);
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
}
|
||||
|
||||
|
@ -58,8 +54,6 @@ public class InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.INVENTORY);
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
package org.geysermc.geyser.inventory.updater;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -49,8 +46,6 @@ public class UIInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(bedrockSlot);
|
||||
slotPacket.setItem(inventory.getItem(i).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +59,6 @@ public class UIInventoryUpdater extends InventoryUpdater {
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,14 @@ package org.geysermc.geyser.translator.inventory;
|
|||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.*;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.PlaceAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TakeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
|
@ -140,8 +143,6 @@ public class OldSmithingTableTranslator extends AbstractBlockInventoryTranslator
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(53);
|
||||
slotPacket.setItem(UPGRADE_TEMPLATE.apply(session.getUpstream().getProtocolVersion()));
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,17 +30,25 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.*;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftCreativeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DestroyAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.geysermc.geyser.inventory.*;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.inventory.PlayerInventory;
|
||||
import org.geysermc.geyser.inventory.SlotType;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.skin.FakeHeadProvider;
|
||||
|
@ -84,8 +92,6 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
contents[i - 36] = inventory.getItem(i).getItemData(session);
|
||||
}
|
||||
inventoryContentPacket.setContents(Arrays.asList(contents));
|
||||
inventoryContentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
inventoryContentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(inventoryContentPacket);
|
||||
|
||||
// Armor
|
||||
|
@ -102,16 +108,12 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
}
|
||||
armorContentPacket.setContents(Arrays.asList(contents));
|
||||
armorContentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
armorContentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(armorContentPacket);
|
||||
|
||||
// Offhand
|
||||
InventoryContentPacket offhandPacket = new InventoryContentPacket();
|
||||
offhandPacket.setContainerId(ContainerId.OFFHAND);
|
||||
offhandPacket.setContents(Collections.singletonList(inventory.getItem(45).getItemData(session)));
|
||||
offhandPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
offhandPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(offhandPacket);
|
||||
}
|
||||
|
||||
|
@ -133,8 +135,6 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
slotPacket.setItem(inventory.getItem(i).getItemData(session));
|
||||
}
|
||||
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
}
|
||||
}
|
||||
|
@ -171,15 +171,11 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
slotPacket.setSlot(slot + 27);
|
||||
}
|
||||
slotPacket.setItem(bedrockItem);
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
} else if (slot == 45) {
|
||||
InventoryContentPacket offhandPacket = new InventoryContentPacket();
|
||||
offhandPacket.setContainerId(ContainerId.OFFHAND);
|
||||
offhandPacket.setContents(Collections.singletonList(bedrockItem));
|
||||
offhandPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
offhandPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(offhandPacket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ package org.geysermc.geyser.translator.inventory.horse;
|
|||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
|
@ -95,8 +94,6 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven
|
|||
InventoryContentPacket contentPacket = new InventoryContentPacket();
|
||||
contentPacket.setContainerId(ContainerId.INVENTORY);
|
||||
contentPacket.setContents(Arrays.asList(bedrockItems));
|
||||
contentPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
contentPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(contentPacket);
|
||||
|
||||
ItemData[] horseItems = new ItemData[chestSize + 1];
|
||||
|
@ -110,8 +107,6 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven
|
|||
InventoryContentPacket horseContentsPacket = new InventoryContentPacket();
|
||||
horseContentsPacket.setContainerId(inventory.getBedrockId());
|
||||
horseContentsPacket.setContents(Arrays.asList(horseItems));
|
||||
horseContentsPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
horseContentsPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(horseContentsPacket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,6 @@ import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
|||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket;
|
||||
|
@ -170,8 +167,6 @@ public class JavaEntityEventTranslator extends PacketTranslator<ClientboundEntit
|
|||
InventoryContentPacket offhandPacket = new InventoryContentPacket();
|
||||
offhandPacket.setContainerId(ContainerId.OFFHAND);
|
||||
offhandPacket.setContents(Collections.singletonList(InventoryUtils.getTotemOfUndying().apply(session.getUpstream().getProtocolVersion())));
|
||||
offhandPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
offhandPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(offhandPacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
|
||||
package org.geysermc.geyser.translator.protocol.java.inventory;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.Ingredient;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.RecipeUnlockingRequirement;
|
||||
|
@ -48,6 +43,9 @@ import org.geysermc.geyser.translator.item.ItemTranslator;
|
|||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
import org.geysermc.geyser.util.InventoryUtils;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.recipe.Ingredient;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -182,8 +180,6 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(col + (row * gridDimensions) + offset);
|
||||
slotPacket.setItem(ItemData.AIR);
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
index++;
|
||||
}
|
||||
|
@ -216,8 +212,6 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
|||
slotPacket.setContainerId(ContainerId.UI);
|
||||
slotPacket.setSlot(col + (row * gridDimensions) + offset);
|
||||
slotPacket.setItem(ingredients[index]);
|
||||
slotPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
slotPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
index++;
|
||||
}
|
||||
|
|
|
@ -32,13 +32,15 @@ import org.cloudburstmc.nbt.NbtMapBuilder;
|
|||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.FullContainerName;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerHotbarPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.inventory.*;
|
||||
import org.geysermc.geyser.inventory.Container;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
import org.geysermc.geyser.inventory.LecternContainer;
|
||||
import org.geysermc.geyser.inventory.PlayerInventory;
|
||||
import org.geysermc.geyser.inventory.click.Click;
|
||||
import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
|
||||
import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe;
|
||||
|
@ -182,8 +184,6 @@ public class InventoryUtils {
|
|||
cursorPacket.setContainerId(ContainerId.UI);
|
||||
cursorPacket.setSlot(0);
|
||||
cursorPacket.setItem(session.getPlayerInventory().getCursor().getItemData(session));
|
||||
cursorPacket.setContainerNameData(new FullContainerName(ContainerSlotType.ANVIL_INPUT, null));
|
||||
cursorPacket.setStorageItem(ItemData.AIR);
|
||||
session.sendUpstreamPacket(cursorPacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ netty-io-uring = "0.0.25.Final-SNAPSHOT"
|
|||
guava = "29.0-jre"
|
||||
gson = "2.3.1" # Provided by Spigot 1.8.8
|
||||
websocket = "1.5.1"
|
||||
protocol-connection = "3.0.0.Beta5-20241021.154858-12"
|
||||
protocol-common = "3.0.0.Beta5-20241021.154858-12"
|
||||
protocol-codec = "3.0.0.Beta5-20241021.154858-12"
|
||||
protocol-connection = "3.0.0.Beta5-20241022.154658-14"
|
||||
protocol-common = "3.0.0.Beta5-20241022.154658-14"
|
||||
protocol-codec = "3.0.0.Beta5-20241022.154658-14"
|
||||
raknet = "1.0.0.CR3-20240416.144209-1"
|
||||
minecraftauth = "4.1.1"
|
||||
mcprotocollib = "1.21-20241010.155958-24"
|
||||
|
|
Loading…
Reference in a new issue