3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

InventoryUtils: Don't send Java packet on hotbar item selection (#1301)

The Bedrock client sends a confirmation packet we translate regardless.
Dieser Commit ist enthalten in:
Camotoy 2020-09-17 23:07:20 -04:00 committet von GitHub
Ursprung 99e72f35b3
Commit 2f2164f387
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -27,7 +27,6 @@ package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientMoveItemToHotbarPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientMoveItemToHotbarPacket;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
@ -241,8 +240,6 @@ public class InventoryUtils {
hotbarPacket.setSelectedHotbarSlot(slot - 36); hotbarPacket.setSelectedHotbarSlot(slot - 36);
hotbarPacket.setSelectHotbarSlot(true); hotbarPacket.setSelectHotbarSlot(true);
session.sendUpstreamPacket(hotbarPacket); session.sendUpstreamPacket(hotbarPacket);
ClientPlayerChangeHeldItemPacket heldItemPacket = new ClientPlayerChangeHeldItemPacket(slot); // No need to send a Java packet as Bedrock sends a confirmation packet back that we translate
session.sendDownstreamPacket(heldItemPacket);
session.getInventory().setHeldItemSlot(slot - 36);
} }
} }