From f898b766f1b3f3b774d7cc85cc0fa16f4d6253e7 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 29 Dec 2018 16:41:13 -0500 Subject: [PATCH] Fix resource pack sending on <= Minecraft 1.9.4 --- .../proxy/protocol/packet/ResourcePackResponse.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java index a37af73fe..d78c5d96e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java @@ -11,6 +11,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; public class ResourcePackResponse implements MinecraftPacket { + private String hash = ""; @MonotonicNonNull private Status status; @@ -23,11 +24,17 @@ public class ResourcePackResponse implements MinecraftPacket { @Override public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { + if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_4) <= 0) { + this.hash = ProtocolUtils.readString(buf); + } this.status = Status.values()[ProtocolUtils.readVarInt(buf)]; } @Override public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { + if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_4) <= 0) { + ProtocolUtils.writeString(buf, hash); + } ProtocolUtils.writeVarInt(buf, status.ordinal()); } @@ -39,6 +46,7 @@ public class ResourcePackResponse implements MinecraftPacket { @Override public String toString() { return "ResourcePackResponse{" + + "hash=" + hash + ", " + "status=" + status + '}'; }