From 777c69a21e629822a6317b91a9d39bfc992346bc Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 12 Mar 2023 13:06:13 -0400 Subject: [PATCH] Remove armor quick change config This is now in vanilla 1.19.4. --- .../configuration/GeyserConfiguration.java | 2 - .../GeyserJacksonConfiguration.java | 3 -- ...BedrockInventoryTransactionTranslator.java | 37 ------------------- core/src/main/resources/config.yml | 4 -- core/src/main/resources/languages | 2 +- core/src/main/resources/mappings | 2 +- 6 files changed, 2 insertions(+), 48 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java index 4843df72b..ea4c31876 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java @@ -83,8 +83,6 @@ public interface GeyserConfiguration { boolean isDisableBedrockScaffolding(); - boolean isAlwaysQuickChangeArmor(); - EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround(); String getDefaultLocale(); diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java index dc675319b..bbfa37ec2 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java @@ -111,9 +111,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @JsonProperty("disable-bedrock-scaffolding") private boolean disableBedrockScaffolding = false; - @JsonProperty("always-quick-change-armor") - private boolean alwaysQuickChangeArmor = false; - @JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class) @JsonProperty("emote-offhand-workaround") private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java index 6992dada4..c770b070f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java @@ -356,43 +356,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator legacySlots = packet.getLegacySlots(); - if (packet.getActions().size() == 1 && legacySlots.size() > 0) { - InventoryActionData actionData = packet.getActions().get(0); - LegacySetItemSlotData slotData = legacySlots.get(0); - if (slotData.getContainerId() == 6 && actionData.getToItem().getId() != 0) { - // The player is trying to swap out an armor piece that already has an item in it - if (session.getGeyser().getConfig().isAlwaysQuickChangeArmor()) { - // Java doesn't know when a player is in its own inventory and not, so we - // can abuse this feature to send a swap inventory packet - int bedrockHotbarSlot = packet.getHotbarSlot(); - Click click = InventoryUtils.getClickForHotbarSwap(bedrockHotbarSlot); - if (click != null && slotData.getSlots().length != 0) { - Inventory playerInventory = session.getPlayerInventory(); - // Bedrock sends us the index of the slot in the armor container; armor in Java - // Edition is offset by 5 in the player inventory - int armorSlot = slotData.getSlots()[0] + 5; - GeyserItemStack armorSlotItem = playerInventory.getItem(armorSlot); - GeyserItemStack hotbarItem = playerInventory.getItem(playerInventory.getOffsetForHotbar(bedrockHotbarSlot)); - playerInventory.setItem(armorSlot, hotbarItem, session); - playerInventory.setItem(bedrockHotbarSlot, armorSlotItem, session); - - Int2ObjectMap changedSlots = new Int2ObjectOpenHashMap<>(2); - changedSlots.put(armorSlot, hotbarItem.getItemStack()); - changedSlots.put(bedrockHotbarSlot, armorSlotItem.getItemStack()); - - ServerboundContainerClickPacket clickPacket = new ServerboundContainerClickPacket( - playerInventory.getJavaId(), playerInventory.getStateId(), armorSlot, - click.actionType, click.action, null, changedSlots); - session.sendDownstreamPacket(clickPacket); - } - } else { - // Disallowed; let's revert - session.getInventoryTranslator().updateInventory(session, session.getPlayerInventory()); - } - } - } } case 2 -> { int blockState = session.getGameMode() == GameMode.CREATIVE ? diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index eb5b7e73c..421ad4c1c 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -130,10 +130,6 @@ show-coordinates: true # Whether Bedrock players are blocked from performing their scaffolding-style bridging. disable-bedrock-scaffolding: false -# Whether Bedrock players can right-click outside of their inventory to replace armor in their inventory, even if the -# armor slot is already occupied (which Java Edition doesn't allow) -always-quick-change-armor: false - # If set, when a Bedrock player performs any emote, it will swap the offhand and mainhand items, just like the Java Edition keybind # There are three options this can be set to: # disabled - the default/fallback, which doesn't apply this workaround diff --git a/core/src/main/resources/languages b/core/src/main/resources/languages index 24be9ef7f..f6685c4cc 160000 --- a/core/src/main/resources/languages +++ b/core/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 24be9ef7f850f7d180650a65792c266c709cadf5 +Subproject commit f6685c4ccc6e77b07402d45cb41213559004b7d6 diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index 677c5b087..eab643ddb 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 677c5b0872d2f0c99ad834c0ca49a0ae3b45fde3 +Subproject commit eab643ddbaf31c4d76531376838f8fd30633bb8e