From 6fd421d36e804c5a55e475eb534304a992122374 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 14 Oct 2024 15:13:46 +0200 Subject: [PATCH] Fix finish configuration state change --- .../viaversion/api/protocol/AbstractProtocol.java | 8 ++++++++ .../v1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java | 2 +- .../protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java | 2 +- .../rewriter/EntityPacketRewriter1_21_2.java | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java index 8a5b4df3a..46a431cf3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java @@ -198,6 +198,14 @@ public abstract class AbstractProtocol { + // TODO Temporary solution to handle the finish configuration packet already having changed our tracked protocol state in a previous handler + wrapper.user().getProtocolInfo().setServerState(State.CONFIGURATION); + handler.handle(wrapper); + }); + } + @Override public final void loadMappingData() { getMappingData().load(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java index 94847b64b..434e80ea9 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java @@ -70,7 +70,7 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter { + protocol.registerFinishConfiguration(ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION, wrapper -> { // Add new registries final PacketWrapper paintingRegistryPacket = wrapper.create(ClientboundConfigurationPackets1_20_5.REGISTRY_DATA); paintingRegistryPacket.write(Types.STRING, "minecraft:painting_variant"); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java index cb97f6d4e..5c85f38c6 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java @@ -129,7 +129,7 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol { + protocol.registerFinishConfiguration(ClientboundConfigurationPackets1_21.FINISH_CONFIGURATION, wrapper -> { final PacketWrapper instrumentsPacket = wrapper.create(ClientboundConfigurationPackets1_21.REGISTRY_DATA); instrumentsPacket.write(Types.STRING, "minecraft:instrument"); final RegistryEntry[] entries = new RegistryEntry[GOAT_HORN_INSTRUMENTS.length];