Remove armor quick change config

This is now in vanilla 1.19.4.
This commit is contained in:
Camotoy 2023-03-12 13:06:13 -04:00
parent b3f1c64249
commit 777c69a21e
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
6 changed files with 2 additions and 48 deletions

View file

@ -83,8 +83,6 @@ public interface GeyserConfiguration {
boolean isDisableBedrockScaffolding();
boolean isAlwaysQuickChangeArmor();
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
String getDefaultLocale();

View file

@ -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;

View file

@ -356,43 +356,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
ServerboundUseItemPacket useItemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND, session.getWorldCache().nextPredictionSequence());
session.sendDownstreamPacket(useItemPacket);
List<LegacySetItemSlotData> 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<ItemStack> 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 ?

View file

@ -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

@ -1 +1 @@
Subproject commit 24be9ef7f850f7d180650a65792c266c709cadf5
Subproject commit f6685c4ccc6e77b07402d45cb41213559004b7d6

@ -1 +1 @@
Subproject commit 677c5b0872d2f0c99ad834c0ca49a0ae3b45fde3
Subproject commit eab643ddbaf31c4d76531376838f8fd30633bb8e