mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-22 12:16:21 +01:00
Handle new container id
This commit is contained in:
parent
708d6bed52
commit
565944c317
@ -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."
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user