3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Fix smithing recipes on 1.21.1

Dieser Commit ist enthalten in:
Camotoy 2024-11-11 20:11:03 -05:00
Ursprung e645935533
Commit fd58c729d8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -31,6 +31,7 @@ import org.geysermc.geyser.inventory.Inventory;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator;
import org.geysermc.geyser.translator.inventory.SmithingInventoryTranslator;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.InventoryUtils;
@ -74,6 +75,17 @@ public class JavaContainerSetContentTranslator extends PacketTranslator<Clientbo
session.getPlayerInventory().setCursor(GeyserItemStack.from(packet.getCarriedItem()), session);
InventoryUtils.updateCursor(session);
if (session.getInventoryTranslator() instanceof SmithingInventoryTranslator) {
// On 1.21.1, the recipe output is sometimes only updated here.
// This can be replicated with shift-clicking the last item into the smithing table.
// It seems that something in Via 5.1.1 causes 1.21.3 clients - even Java ones -
// to make the server send a slot update.
// That plus shift-clicking means that the state ID becomes outdated and forces
// a complete inventory update.
JavaContainerSetSlotTranslator.updateSmithingTableOutput(session, SmithingInventoryTranslator.OUTPUT,
packet.getItems()[SmithingInventoryTranslator.OUTPUT], inventory);
}
}
private void updateInventory(GeyserSession session, Inventory inventory, int containerId) {

Datei anzeigen

@ -224,7 +224,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
}, 150, TimeUnit.MILLISECONDS));
}
private static void updateSmithingTableOutput(GeyserSession session, int slot, ItemStack output, Inventory inventory) {
static void updateSmithingTableOutput(GeyserSession session, int slot, ItemStack output, Inventory inventory) {
if (slot != SmithingInventoryTranslator.OUTPUT) {
return;
}