From bfca25bbe3534f1c58bc05465cf27d42b1002251 Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Tue, 25 Feb 2020 22:31:55 -0900 Subject: [PATCH] Fix compile errors --- .../inventory/AnvilInventoryTranslator.java | 14 +++++----- .../inventory/BaseInventoryTranslator.java | 10 +++---- .../inventory/BrewingInventoryTranslator.java | 4 +-- .../CraftingInventoryTranslator.java | 10 +++---- .../inventory/InventoryTranslator.java | 6 ++--- .../inventory/PlayerInventoryTranslator.java | 26 +++++++++---------- ...ava => InventoryActionDataTranslator.java} | 20 +++++++------- .../updater/ChestInventoryUpdater.java | 4 +-- .../updater/ContainerInventoryUpdater.java | 4 +-- .../updater/CursorInventoryUpdater.java | 8 +++--- .../inventory/updater/InventoryUpdater.java | 4 +-- .../translators/item/ItemTranslator.java | 4 +-- .../connector/utils/InventoryUtils.java | 4 +-- .../connector/world/chunk/ChunkPosition.java | 17 ------------ 14 files changed, 58 insertions(+), 77 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/{InventoryActionTranslator.java => InventoryActionDataTranslator.java} (97%) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java index 395751888..60700ba28 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.inventory; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket; import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.ContainerType; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.ItemData; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; @@ -42,7 +42,7 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator { } @Override - public int bedrockSlotToJava(InventoryAction action) { + public int bedrockSlotToJava(InventoryActionData action) { if (action.getSource().getContainerId() == ContainerId.CURSOR) { switch (action.getSlot()) { case 1: @@ -77,10 +77,10 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - InventoryAction anvilResult = null; - InventoryAction anvilInput = null; - for (InventoryAction action : actions) { + public void translateActions(GeyserSession session, Inventory inventory, List actions) { + InventoryActionData anvilResult = null; + InventoryActionData anvilInput = null; + for (InventoryActionData action : actions) { if (action.getSource().getContainerId() == ContainerId.ANVIL_MATERIAL) { //useless packet return; @@ -100,7 +100,7 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator { String rename; com.nukkitx.nbt.tag.CompoundTag tag = itemName.getTag(); if (tag != null) { - rename = tag.getAsCompound("display").getAsString("Name"); + rename = tag.getCompound("display").getString("Name"); } else { rename = ""; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java index d64c0e78e..5deb0370a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java @@ -26,10 +26,10 @@ package org.geysermc.connector.network.translators.inventory; import com.nukkitx.protocol.bedrock.data.ContainerId; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.action.InventoryActionTranslator; +import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator; import java.util.List; @@ -44,7 +44,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator{ } @Override - public int bedrockSlotToJava(InventoryAction action) { + public int bedrockSlotToJava(InventoryActionData action) { int slotnum = action.getSlot(); if (action.getSource().getContainerId() == ContainerId.INVENTORY) { //hotbar @@ -76,7 +76,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator{ } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - InventoryActionTranslator.translate(this, session, inventory, actions); + public void translateActions(GeyserSession session, Inventory inventory, List actions) { + InventoryActionDataTranslator.translate(this, session, inventory, actions); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java index c5f67a03a..bd143698f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.inventory; import com.nukkitx.protocol.bedrock.data.ContainerType; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; @@ -66,7 +66,7 @@ public class BrewingInventoryTranslator extends BlockInventoryTranslator { } @Override - public int bedrockSlotToJava(InventoryAction action) { + public int bedrockSlotToJava(InventoryActionData action) { final int slot = super.bedrockSlotToJava(action); switch (slot) { case 0: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java index fe70609fe..92a1d90ec 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java @@ -28,13 +28,11 @@ package org.geysermc.connector.network.translators.inventory; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.ContainerType; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.TranslatorsInit; import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; import org.geysermc.connector.utils.InventoryUtils; @@ -80,7 +78,7 @@ public class CraftingInventoryTranslator extends BaseInventoryTranslator { } @Override - public int bedrockSlotToJava(InventoryAction action) { + public int bedrockSlotToJava(InventoryActionData action) { if (action.getSource().getContainerId() == ContainerId.CURSOR) { int slotnum = action.getSlot(); if (slotnum >= 32 && 42 >= slotnum) { @@ -105,9 +103,9 @@ public class CraftingInventoryTranslator extends BaseInventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { + public void translateActions(GeyserSession session, Inventory inventory, List actions) { if (session.getGameMode() == GameMode.CREATIVE) { - for (InventoryAction action : actions) { + for (InventoryActionData action : actions) { if (action.getSource().getType() == InventorySource.Type.CREATIVE) { updateInventory(session, inventory); InventoryUtils.updateCursor(session); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index 7baef61a5..2a5afb8c0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.inventory; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import lombok.AllArgsConstructor; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; @@ -42,8 +42,8 @@ public abstract class InventoryTranslator { 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(InventoryAction action); + public abstract int bedrockSlotToJava(InventoryActionData action); public abstract int javaSlotToBedrock(int slot); public abstract SlotType getSlotType(int javaSlot); - public abstract void translateActions(GeyserSession session, Inventory inventory, List actions); + public abstract void translateActions(GeyserSession session, Inventory inventory, List actions); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java index 31d898c29..555e80a0f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.TranslatorsInit; -import org.geysermc.connector.network.translators.inventory.action.InventoryActionTranslator; +import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator; import org.geysermc.connector.utils.InventoryUtils; import java.util.List; @@ -50,8 +50,8 @@ public class PlayerInventoryTranslator extends InventoryTranslator { for (int i = 1; i < 5; i++) { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.CURSOR); - slotPacket.setInventorySlot(i + 27); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(i))); + slotPacket.setSlot(i + 27); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(i))); session.getUpstream().sendPacket(slotPacket); } @@ -93,18 +93,18 @@ public class PlayerInventoryTranslator extends InventoryTranslator { if (slot >= 9) { slotPacket.setContainerId(ContainerId.INVENTORY); if (slot >= 36) { - slotPacket.setInventorySlot(slot - 36); + slotPacket.setSlot(slot - 36); } else { - slotPacket.setInventorySlot(slot); + slotPacket.setSlot(slot); } } else if (slot >= 5) { slotPacket.setContainerId(ContainerId.ARMOR); - slotPacket.setInventorySlot(slot - 5); + slotPacket.setSlot(slot - 5); } else { slotPacket.setContainerId(ContainerId.CURSOR); - slotPacket.setInventorySlot(slot + 27); + slotPacket.setSlot(slot + 27); } - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(slot))); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(slot))); session.getUpstream().sendPacket(slotPacket); } else if (slot == 45) { InventoryContentPacket offhandPacket = new InventoryContentPacket(); @@ -115,7 +115,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public int bedrockSlotToJava(InventoryAction action) { + public int bedrockSlotToJava(InventoryActionData action) { int slotnum = action.getSlot(); switch (action.getSource().getContainerId()) { case ContainerId.INVENTORY: @@ -159,10 +159,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { + public void translateActions(GeyserSession session, Inventory inventory, List actions) { if (session.getGameMode() == GameMode.CREATIVE) { //crafting grid is not visible in creative mode in java edition - for (InventoryAction action : actions) { + for (InventoryActionData action : actions) { if (action.getSource().getContainerId() == ContainerId.CURSOR && (action.getSlot() >= 28 && 31 >= action.getSlot())) { updateInventory(session, inventory); InventoryUtils.updateCursor(session); @@ -171,7 +171,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } ItemStack javaItem; - for (InventoryAction action : actions) { + for (InventoryActionData action : actions) { switch (action.getSource().getContainerId()) { case ContainerId.INVENTORY: case ContainerId.ARMOR: @@ -204,7 +204,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { return; } - InventoryActionTranslator.translate(this, session, inventory, actions); + InventoryActionDataTranslator.translate(this, session, inventory, actions); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java index 586c2c023..a94b6242a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java @@ -33,7 +33,7 @@ import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket; import com.nukkitx.protocol.bedrock.data.ContainerId; -import com.nukkitx.protocol.bedrock.data.InventoryAction; +import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.data.ItemData; import org.geysermc.connector.inventory.Inventory; @@ -45,16 +45,16 @@ import org.geysermc.connector.utils.InventoryUtils; import java.util.*; -public class InventoryActionTranslator { - public static void translate(InventoryTranslator translator, GeyserSession session, Inventory inventory, List actions) { +public class InventoryActionDataTranslator { + public static void translate(InventoryTranslator translator, GeyserSession session, Inventory inventory, List actions) { if (actions.size() != 2) return; - InventoryAction worldAction = null; - InventoryAction cursorAction = null; - InventoryAction containerAction = null; + InventoryActionData worldAction = null; + InventoryActionData cursorAction = null; + InventoryActionData containerAction = null; boolean refresh = false; - for (InventoryAction action : actions) { + for (InventoryActionData action : actions) { if (action.getSource().getContainerId() == ContainerId.CRAFTING_USE_INGREDIENT || action.getSource().getContainerId() == ContainerId.CRAFTING_RESULT) { return; } else if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION) { @@ -78,7 +78,7 @@ public class InventoryActionTranslator { session.setCraftSlot(0); if (worldAction != null) { - InventoryAction sourceAction; + InventoryActionData sourceAction; if (cursorAction != null) { sourceAction = cursorAction; } else { @@ -208,8 +208,8 @@ public class InventoryActionTranslator { return; } else { ClickPlan plan = new ClickPlan(); - InventoryAction fromAction; - InventoryAction toAction; + InventoryActionData fromAction; + InventoryActionData toAction; if (actions.get(0).getFromItem().getCount() >= actions.get(0).getToItem().getCount()) { fromAction = actions.get(0); toAction = actions.get(1); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java index 4af1fba13..ab45cdc43 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java @@ -64,8 +64,8 @@ public class ChestInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(inventory.getId()); - slotPacket.setInventorySlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); + slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); session.getUpstream().sendPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java index 7169311ed..3efe1cee9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java @@ -56,8 +56,8 @@ public class ContainerInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(inventory.getId()); - slotPacket.setInventorySlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); + slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); session.getUpstream().sendPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java index 3df8d7662..13b8554ba 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java @@ -43,8 +43,8 @@ public class CursorInventoryUpdater extends InventoryUpdater { continue; InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.CURSOR); - slotPacket.setInventorySlot(bedrockSlot); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(i))); + slotPacket.setSlot(bedrockSlot); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(i))); session.getUpstream().sendPacket(slotPacket); } } @@ -56,8 +56,8 @@ public class CursorInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.CURSOR); - slotPacket.setInventorySlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); + slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); session.getUpstream().sendPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java index e5b6f4c56..888b14b14 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java @@ -51,8 +51,8 @@ public abstract class InventoryUpdater { if (javaSlot >= translator.size) { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.INVENTORY); - slotPacket.setInventorySlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); + slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); + slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItem(javaSlot))); session.getUpstream().sendPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index aaf00169d..446b25db2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -189,13 +189,13 @@ public class ItemTranslator { continue; com.nukkitx.nbt.tag.CompoundTag tagValue = (com.nukkitx.nbt.tag.CompoundTag) value; - int bedrockId = tagValue.getAsShort("id", (short) -1); + int bedrockId = tagValue.getShort("id", (short) -1); Enchantment enchantment = Enchantment.getByBedrockId(bedrockId); if (enchantment != null) { CompoundTag javaTag = new CompoundTag(""); Map javaValue = javaTag.getValue(); javaValue.put("id", new StringTag("id", enchantment.getJavaIdentifier())); - javaValue.put("lvl", new IntTag("lvl", tagValue.getAsShort("lvl", (short) 1))); + javaValue.put("lvl", new IntTag("lvl", tagValue.getShort("lvl", (short) 1))); javaTag.setValue(javaValue); tags.add(javaTag); } else { diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index 0fb9e0fc1..8eb407d05 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -82,8 +82,8 @@ public class InventoryUtils { public static void updateCursor(GeyserSession session) { InventorySlotPacket cursorPacket = new InventorySlotPacket(); cursorPacket.setContainerId(ContainerId.CURSOR); - cursorPacket.setInventorySlot(0); - cursorPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(session.getInventory().getCursor())); + cursorPacket.setSlot(0); + cursorPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(session.getInventory().getCursor())); session.getUpstream().sendPacket(cursorPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/world/chunk/ChunkPosition.java b/connector/src/main/java/org/geysermc/connector/world/chunk/ChunkPosition.java index a59b2031e..26748dff5 100644 --- a/connector/src/main/java/org/geysermc/connector/world/chunk/ChunkPosition.java +++ b/connector/src/main/java/org/geysermc/connector/world/chunk/ChunkPosition.java @@ -53,21 +53,4 @@ public class ChunkPosition { return new Position(chunkX, chunkY, chunkZ); } - - @Override - public boolean equals(Object obj) { - if (obj == this) - return true; - if (obj == null) - return false; - if (!(obj instanceof ChunkPosition)) - return false; - ChunkPosition other = (ChunkPosition)obj; - return x == other.x && z == other.z; - } - - @Override - public int hashCode() { - return Objects.hash(x, z); - } }