3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +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 { public class ResourcePackResponse implements MinecraftPacket {
private String hash = "";
@MonotonicNonNull @MonotonicNonNull
private Status status; private Status status;
@ -23,11 +24,17 @@ public class ResourcePackResponse implements MinecraftPacket {
@Override @Override
public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { 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)]; this.status = Status.values()[ProtocolUtils.readVarInt(buf)];
} }
@Override @Override
public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { 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()); ProtocolUtils.writeVarInt(buf, status.ordinal());
} }
@ -39,6 +46,7 @@ public class ResourcePackResponse implements MinecraftPacket {
@Override @Override
public String toString() { public String toString() {
return "ResourcePackResponse{" return "ResourcePackResponse{"
+ "hash=" + hash + ", "
+ "status=" + status + "status=" + status
+ '}'; + '}';
} }