mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-28 14:37:31 +02:00
Fix MultiBlockChangePacket read
This commit is contained in:
parent
48b262fee7
commit
91a8607710
@ -17,7 +17,7 @@ public record MultiBlockChangePacket(long chunkSectionPosition,
|
||||
}
|
||||
|
||||
public MultiBlockChangePacket(BinaryReader reader) {
|
||||
this(reader.readLong(), reader.readBoolean(), reader.readLongArray());
|
||||
this(reader.readLong(), reader.readBoolean(), reader.readVarLongArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,6 +153,15 @@ public class BinaryReader extends InputStream {
|
||||
return array;
|
||||
}
|
||||
|
||||
public long[] readVarLongArray() {
|
||||
final int size = readVarInt();
|
||||
long[] array = new long[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
array[i] = readVarLong();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public long[] readLongArray() {
|
||||
final int size = readVarInt();
|
||||
long[] array = new long[size];
|
||||
|
@ -106,6 +106,8 @@ public class PacketWriteReadTest {
|
||||
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.ADD_PLAYER,
|
||||
new PlayerInfoPacket.AddPlayer(UUID.randomUUID(), "TheMode911", List.of(new PlayerInfoPacket.AddPlayer.Property("name", "value")), GameMode.CREATIVE, 5, COMPONENT)));
|
||||
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.REMOVE_PLAYER, new PlayerInfoPacket.RemovePlayer(UUID.randomUUID())));
|
||||
|
||||
//SERVER_PACKETS.add(new MultiBlockChangePacket(5,5,5,true, new long[]{0,5,543534,1321}));
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
|
Loading…
Reference in New Issue
Block a user