From 52b9db5029cf59f9c37edb06102ad953300f0ea4 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 18 Jan 2024 21:22:44 +0100 Subject: [PATCH] Handle new client intent --- .../viaversion/protocols/base/BaseProtocol.java | 9 ++++++--- .../rewriter/BlockItemPacketRewriter1_20_5.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java index d9e4281ec..8bf1819bf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java @@ -35,6 +35,10 @@ import java.util.List; public class BaseProtocol extends AbstractProtocol { + private static final int STATUS_INTENT = 1; + private static final int LOGIN_INTENT = 2; + private static final int TRANSFER_INTENT = 3; + @Override protected void registerPackets() { // Handshake Packet @@ -89,10 +93,9 @@ public class BaseProtocol extends AbstractProtocol { Via.getPlatform().getLogger().info("Protocol pipeline: " + pipeline.pipes()); } - // Change state - if (state == 1) { + if (state == STATUS_INTENT) { info.setState(State.STATUS); - } else if (state == 2) { + } else if (state == LOGIN_INTENT || state == TRANSFER_INTENT) { info.setState(State.LOGIN); } }); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java index 2e1326a83..70bd00d3d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java @@ -50,7 +50,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter