PacketSoundEffect, PacketNamedSoundEffect: fix reading category

This commit is contained in:
Bixilon 2020-09-01 23:37:52 +02:00
parent 8901f38824
commit ff09e06647
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 4 additions and 8 deletions

View File

@ -43,11 +43,9 @@ public class PacketNamedSoundEffect implements ClientboundPacket {
location = new Location(buffer.readInt() * 8, buffer.readInt() * 8, buffer.readInt() * 8); // ToDo: check if it is not * 4
}
if (buffer.getProtocolId() < 321 && buffer.getProtocolId() >= 326) {
if (buffer.getProtocolId() >= 95) {
if (buffer.getProtocolId() >= 95 && (buffer.getProtocolId() < 321 || buffer.getProtocolId() >= 326)) {
category = SoundCategories.byId(buffer.readVarInt());
}
}
if (buffer.getProtocolId() >= 95) {
location = new Location(buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4);
}

View File

@ -39,11 +39,9 @@ public class PacketSoundEffect implements ClientboundPacket {
if (buffer.getProtocolId() >= 321 && buffer.getProtocolId() < 326) {
buffer.readString(); // parrot entity type
}
if (buffer.getProtocolId() < 321 && buffer.getProtocolId() >= 326) {
if (buffer.getProtocolId() >= 95) {
if (buffer.getProtocolId() >= 95 && (buffer.getProtocolId() < 321 || buffer.getProtocolId() >= 326)) {
category = SoundCategories.byId(buffer.readVarInt());
}
}
location = new Location(buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4);
volume = buffer.readFloat();
if (buffer.getProtocolId() < 201) {