From 30c007d04bb755111ed18bc7fc1152cc454aaaed Mon Sep 17 00:00:00 2001 From: rtm516 Date: Tue, 21 Jul 2020 18:17:55 +0100 Subject: [PATCH] Fix buckets not working on mobile (#767) Desktop clients send an extra item use packet for buckets whereas mobile clients dont send the second use packet causing the issue as a ClientPlayerUseItemPacket doesn't get sent to the Java server. Buckets on mobile may still be glitchy as the player must be directly facing the block they want to place liquid on. --- ...BedrockInventoryTransactionTranslator.java | 20 ++++++++++++------- .../translators/item/ItemRegistry.java | 9 +++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index d4168709..c7047a1e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -36,12 +36,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket; -import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket; - +import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ItemFrameEntity; import org.geysermc.connector.entity.living.merchant.AbstractMerchantEntity; @@ -98,11 +97,11 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator ITEMS = new ArrayList<>(); public static final Int2ObjectMap ITEM_ENTRIES = new Int2ObjectOpenHashMap<>(); - // Shield ID, used in Entity.java - public static ItemEntry SHIELD; // Boat ID, used in BedrockInventoryTransactionTranslator.java public static ItemEntry BOAT; + // Gold ID, used in BedrockInventoryTransactionTranslator.java + public static ItemEntry BUCKET; // Gold ID, used in PiglinEntity.java public static ItemEntry GOLD; + // Shield ID, used in Entity.java + public static ItemEntry SHIELD; public static int BARRIER_INDEX = 0; @@ -138,6 +140,9 @@ public class ItemRegistry { case "minecraft:shield": SHIELD = ITEM_ENTRIES.get(itemIndex); break; + case "minecraft:bucket": + BUCKET = ITEM_ENTRIES.get(itemIndex); + break; default: break; }