3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 15:20:19 +01:00

Handle new container id

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-03-01 16:09:56 +01:00
Ursprung 708d6bed52
Commit 565944c317
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 21 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.6.0-1.19.4-pre1-SNAPSHOT"
version = "4.6.0-1.19.4-pre3-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

Datei anzeigen

@ -66,7 +66,6 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
translatableRewriter.registerBossBar(ClientboundPackets1_19_4.BOSSBAR);
translatableRewriter.registerDisconnect(ClientboundPackets1_19_4.DISCONNECT);
translatableRewriter.registerTabList(ClientboundPackets1_19_4.TAB_LIST);
translatableRewriter.registerOpenWindow(ClientboundPackets1_19_4.OPEN_WINDOW);
translatableRewriter.registerCombatKill(ClientboundPackets1_19_4.COMBAT_KILL);
translatableRewriter.registerComponentPacket(ClientboundPackets1_19_4.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_19_4.DISGUISED_CHAT);

Datei anzeigen

@ -20,6 +20,7 @@ package com.viaversion.viabackwards.protocol.protocol1_19_3to1_19_4.packets;
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
import com.viaversion.viabackwards.protocol.protocol1_19_3to1_19_4.Protocol1_19_3To1_19_4;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3;
@ -43,6 +44,25 @@ public final class BlockItemPackets1_19_4 extends ItemRewriter<ClientboundPacket
blockRewriter.registerChunkData1_19(ClientboundPackets1_19_4.CHUNK_DATA, Chunk1_18Type::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_19_4.BLOCK_ENTITY_DATA);
protocol.registerClientbound(ClientboundPackets1_19_4.OPEN_WINDOW, new PacketHandlers() {
@Override
public void register() {
map(Type.VAR_INT); // Container id
map(Type.VAR_INT); // Container type
map(Type.COMPONENT); // Title
handler(wrapper -> {
final int windowType = wrapper.get(Type.VAR_INT, 1);
if (windowType == 21) { // New smithing menu
wrapper.cancel();
} else if (windowType > 21) {
wrapper.set(Type.VAR_INT, 1, windowType - 1);
}
protocol.getTranslatableRewriter().processText(wrapper.get(Type.COMPONENT, 0));
});
}
});
registerSetCooldown(ClientboundPackets1_19_4.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_19_4.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_19_4.SET_SLOT);