3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Fix resource pack sending on <= Minecraft 1.9.4

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-12-29 16:41:13 -05:00
Ursprung c8f73ea0ab
Commit f898b766f1

Datei anzeigen

@ -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
+ '}';
}