diff --git a/core/src/main/java/org/geysermc/geyser/inventory/CrafterContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/CrafterContainer.java new file mode 100644 index 000000000..bcacd3587 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/inventory/CrafterContainer.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.inventory; + +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.geyser.GeyserImpl; + +@Getter +public class CrafterContainer extends Container { + + @Setter + private boolean triggered = false; + + /** + * Bedrock Edition bitmask of the *disabled* slots. + * Disabled slots are 1, enabled slots are 0 - same as Java Edition + */ + private short disabledSlotsMask = 0; + + public CrafterContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); + } + + public void setSlot(int slot, boolean enabled) { + if (slot < 0 || slot > 8) { + GeyserImpl.getInstance().getLogger().warning("Crafter slot out of bounds: " + slot); + return; + } + + if (enabled) { + disabledSlotsMask = (short) (disabledSlotsMask & ~(1 << slot)); + } else { + disabledSlotsMask = (short) (disabledSlotsMask | (1 << slot)); + } + } +} diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/CrafterInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/CrafterInventoryUpdater.java new file mode 100644 index 000000000..4474d420c --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/CrafterInventoryUpdater.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.inventory.updater; + +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.CrafterInventoryTranslator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; + +import java.util.Arrays; + +/** + * Read {@link CrafterInventoryTranslator} for context on the complete custom implementation here + */ +public class CrafterInventoryUpdater extends InventoryUpdater { + + public static final CrafterInventoryUpdater INSTANCE = new CrafterInventoryUpdater(); + + @Override + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + ItemData[] bedrockItems; + InventoryContentPacket contentPacket; + + // crafter grid - but excluding the result slot + bedrockItems = new ItemData[CrafterInventoryTranslator.GRID_SIZE]; + for (int i = 0; i < bedrockItems.length; i++) { + bedrockItems[translator.javaSlotToBedrock(i)] = inventory.getItem(i).getItemData(session); + } + contentPacket = new InventoryContentPacket(); + contentPacket.setContainerId(inventory.getBedrockId()); + contentPacket.setContents(Arrays.asList(bedrockItems)); + session.sendUpstreamPacket(contentPacket); + + // inventory and hotbar + bedrockItems = new ItemData[36]; + for (int i = 0; i < 36; i++) { + final int offset = i < 9 ? 27 : -9; + bedrockItems[i] = inventory.getItem(CrafterInventoryTranslator.GRID_SIZE + i + offset).getItemData(session); + } + contentPacket = new InventoryContentPacket(); + contentPacket.setContainerId(ContainerId.INVENTORY); + contentPacket.setContents(Arrays.asList(bedrockItems)); + session.sendUpstreamPacket(contentPacket); + + // Crafter result - it doesn't come after the grid, as explained elsewhere. + updateSlot(translator, session, inventory, CrafterInventoryTranslator.JAVA_RESULT_SLOT); + } + + @Override + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + int containerId; + if (javaSlot < CrafterInventoryTranslator.GRID_SIZE || javaSlot == CrafterInventoryTranslator.JAVA_RESULT_SLOT) { + // Parts of the Crafter UI + // It doesn't seem like BDS sends the result slot, but sending it as slot 50 does actually work (it doesn't seem to show otherwise) + containerId = inventory.getBedrockId(); + } else { + containerId = ContainerId.INVENTORY; + } + + InventorySlotPacket packet = new InventorySlotPacket(); + packet.setContainerId(containerId); + packet.setSlot(translator.javaSlotToBedrock(javaSlot)); + packet.setItem(inventory.getItem(javaSlot).getItemData(session)); + session.sendUpstreamPacket(packet); + return true; + } +} diff --git a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java index e22d1da97..c811afd2e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java @@ -32,6 +32,7 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622; import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630; import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec; +import org.geysermc.geyser.session.GeyserSession; import java.util.ArrayList; import java.util.List; @@ -81,6 +82,10 @@ public final class GameProtocol { /* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */ + public static boolean isPre1_20_50(GeyserSession session) { + return session.getUpstream().getProtocolVersion() < Bedrock_v630.CODEC.getProtocolVersion(); + } + /** * Gets the {@link PacketCodec} for Minecraft: Java Edition. * diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 80e624895..5076dbeb2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -869,4 +869,11 @@ public class LoggingPacketHandler implements BedrockPacketHandler { public PacketSignal handle(RequestNetworkSettingsPacket packet) { return defaultHandler(packet); } + + // todo: fix arrangement + + @Override + public PacketSignal handle(ToggleCrafterSlotRequestPacket packet) { + return defaultHandler(packet); + } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/CrafterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CrafterInventoryTranslator.java new file mode 100644 index 000000000..97398a207 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CrafterInventoryTranslator.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.translator.inventory; + +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.CrafterContainer; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.updater.CrafterInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.BlockEntityUtils; + +/** + * Translates the Crafter. Most important thing to know about this class is that + * the result slot comes after the 3x3 grid AND the inventory. This means that the total size of the Crafter (10) + * cannot be used to calculate the inventory slot indices. The Translator and the Updater must then + * override any methods that use the size for such calculations + */ +public class CrafterInventoryTranslator extends AbstractBlockInventoryTranslator { + + public static final int JAVA_RESULT_SLOT = 45; + public static final int BEDROCK_RESULT_SLOT = 50; + public static final int GRID_SIZE = 9; + + // Properties + private static final int SLOT_ENABLED = 0; // enabled slot value + private static final int TRIGGERED_KEY = 9; // key of triggered state + private static final int TRIGGERED = 1; // triggered value + + public CrafterInventoryTranslator() { + super(10, "minecraft:crafter", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.CRAFTER, CrafterInventoryUpdater.INSTANCE); + } + + @Override + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + // the slot bits and triggered state are sent here rather than in a BlockEntityDataPacket. Yippee. + CrafterContainer container = (CrafterContainer) inventory; + + if (key == TRIGGERED_KEY) { + container.setTriggered(value == TRIGGERED); + } else { + // enabling and disabling slots of the 3x3 grid + container.setSlot(key, value == SLOT_ENABLED); + } + + // Unfortunately this will be called 10 times when a Crafter is opened + // Kind of unavoidable because it must be invoked anytime an individual property is updated + updateBlockEntity(session, container); + } + + @Override + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { + int slot = slotInfoData.getSlot(); + switch (slotInfoData.getContainer()) { + case HOTBAR_AND_INVENTORY, HOTBAR, INVENTORY -> { + //hotbar + if (slot >= 9) { + return slot + GRID_SIZE - 9; + } else { + return slot + GRID_SIZE + 27; + } + } + } + return slot; + } + + @Override + public int javaSlotToBedrock(int slot) { + if (slot == JAVA_RESULT_SLOT) { + return BEDROCK_RESULT_SLOT; + } + + // grid slots 0-8 + if (slot < GRID_SIZE) { + return slot; + } + + // inventory and hotbar + final int tmp = slot - GRID_SIZE; + if (tmp < 27) { + return tmp + 9; + } else { + return tmp - 27; + } + } + + @Override + public BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot) { + if (javaSlot == JAVA_RESULT_SLOT) { + return new BedrockContainerSlot(ContainerSlotType.CRAFTER_BLOCK_CONTAINER, BEDROCK_RESULT_SLOT); + } + + // grid slots 0-8 + if (javaSlot < GRID_SIZE) { + return new BedrockContainerSlot(ContainerSlotType.LEVEL_ENTITY, javaSlot); + } + + // inventory and hotbar + final int tmp = javaSlot - GRID_SIZE; + if (tmp < 27) { + return new BedrockContainerSlot(ContainerSlotType.INVENTORY, tmp + 9); + } else { + return new BedrockContainerSlot(ContainerSlotType.HOTBAR, tmp - 27); + } + } + + @Override + public SlotType getSlotType(int javaSlot) { + if (javaSlot == JAVA_RESULT_SLOT) { + return SlotType.OUTPUT; + } + return SlotType.NORMAL; + } + + @Override + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + // Java sends the triggered and slot bits incrementally through properties, which we store here + return new CrafterContainer(name, windowId, this.size, containerType, playerInventory); + } + + private static void updateBlockEntity(GeyserSession session, CrafterContainer container) { + /* + Here is an example of the tag sent by BDS 1.20.50.24 + It doesn't include the position or the block entity ID in the tag, for whatever reason. + + CLIENT BOUND BlockEntityDataPacket(blockPosition=(8, 110, 45), data={ + "crafting_ticks_remaining": 0i, + "disabled_slots": 511s + }) + */ + + NbtMapBuilder tag = NbtMap.builder(); + // just send some large amount since we don't know, and it'll be resent as 0 when java updates as not triggered + tag.putInt("crafting_ticks_remaining", container.isTriggered() ? 10_000 : 0); + tag.putShort("disabled_slots", container.getDisabledSlotsMask()); + + BlockEntityUtils.updateBlockEntity(session, tag.build(), container.getHolderPosition()); + } +} diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 5262f048b..b10fa85f0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -86,6 +86,7 @@ public abstract class InventoryTranslator { put(ContainerType.BEACON, new BeaconInventoryTranslator()); put(ContainerType.BREWING_STAND, new BrewingInventoryTranslator()); put(ContainerType.CARTOGRAPHY, new CartographyInventoryTranslator()); + put(ContainerType.CRAFTER_3x3, new CrafterInventoryTranslator()); put(ContainerType.CRAFTING, new CraftingInventoryTranslator()); put(ContainerType.ENCHANTMENT, new EnchantingInventoryTranslator()); put(ContainerType.HOPPER, new HopperInventoryTranslator()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DecoratedPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DecoratedPotBlockEntityTranslator.java index 9ff864101..1774d9c76 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DecoratedPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DecoratedPotBlockEntityTranslator.java @@ -44,7 +44,6 @@ public class DecoratedPotBlockEntityTranslator extends BlockEntityTranslator { if (tag == null) { return; } - // todo 1.20.3 maybe // exact same format if (tag.get("sherds") instanceof ListTag sherds) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/TrialSpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/TrialSpawnerBlockEntityTranslator.java new file mode 100644 index 000000000..93a4daba9 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/TrialSpawnerBlockEntityTranslator.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.translator.level.block.entity; + +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import org.cloudburstmc.nbt.NbtMapBuilder; + +@BlockEntity(type = BlockEntityType.TRIAL_SPAWNER) +public class TrialSpawnerBlockEntityTranslator extends SpawnerBlockEntityTranslator { + + @Override + public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) { + if (tag != null) { + // todo 1.20.3 doesn't seem to work + super.translateTag(builder, tag, blockState); + } + } +} diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockToggleCrafterSlotRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockToggleCrafterSlotRequestTranslator.java new file mode 100644 index 000000000..5c494cd88 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockToggleCrafterSlotRequestTranslator.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.translator.protocol.bedrock; + +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerSlotStateChangedPacket; +import org.cloudburstmc.protocol.bedrock.packet.ToggleCrafterSlotRequestPacket; +import org.geysermc.geyser.inventory.CrafterContainer; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; + +@Translator(packet = ToggleCrafterSlotRequestPacket.class) +public class BedrockToggleCrafterSlotRequestTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ToggleCrafterSlotRequestPacket packet) { + if (!(session.getOpenInventory() instanceof CrafterContainer container)) { + return; + } + + // Note that the Bedrock packet uses disabled, whereas the java packet used enabled. + session.sendDownstreamGamePacket( + new ServerboundContainerSlotStateChangedPacket(packet.getSlot(), container.getJavaId(), !packet.isDisabled())); + } +} diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java index 8951f7171..1d0b4bf63 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java @@ -30,7 +30,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.Cli import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import net.kyori.adventure.text.Component; import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.translator.inventory.OldSmithingTableTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator; @@ -49,12 +51,18 @@ public class JavaOpenScreenTranslator extends PacketTranslator