mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-02-23 13:08:37 +01:00
Fix visual glitch when swapping out armor that's already equipped (#2173)
Bedrock Edition allows you to swap out armor by right-clicking an item in your inventory, even when armor in that slot is already equipped. This PR prevents Bedrock from performing this action if both slots are occupied (which Java Edition will not do).
This commit is contained in:
parent
dda0172ded
commit
51aa96de2e
1 changed files with 10 additions and 1 deletions
|
@ -238,7 +238,16 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
|||
session.setInteracting(true);
|
||||
break;
|
||||
case 1:
|
||||
// Handled in Entity.java
|
||||
if (packet.getActions().size() == 1) {
|
||||
InventoryActionData actionData = packet.getActions().get(0);
|
||||
if (actionData.getSlot() == 6 && actionData.getToItem().getId() != 0) {
|
||||
// The player is trying to swap out an armor piece that already has an item in it
|
||||
// Java Edition does not allow this; let's revert it
|
||||
session.getInventoryTranslator().updateInventory(session, session.getPlayerInventory());
|
||||
}
|
||||
}
|
||||
|
||||
// Handled when sneaking
|
||||
if (session.getPlayerInventory().getItemInHand().getJavaId() == ItemRegistry.SHIELD.getJavaId()) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue