Always flip

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-08-03 20:02:27 +02:00
parent 9f1efb0932
commit 6db55ce91f
3 changed files with 4 additions and 7 deletions

View File

@ -153,6 +153,6 @@ public class ItemMeta implements TagReadable, Writeable {
w.writeNBT("", nbt);
this.cachedBuffer = w.getBuffer();
}
writer.write(cachedBuffer.flip());
writer.write(cachedBuffer);
}
}

View File

@ -105,7 +105,7 @@ public class ChunkDataPacket implements ServerPacket {
// Data
writer.writeVarInt(blocks.position());
writer.write(blocks.flip());
writer.write(blocks);
// Block entities
if (entries == null || entries.isEmpty()) {

View File

@ -288,14 +288,11 @@ public class BinaryWriter extends OutputStream {
}
public void write(@NotNull ByteBuffer buffer) {
this.buffer.put(buffer);
this.buffer.put(buffer.flip());
}
public void write(@NotNull BinaryWriter writer) {
var buffer = writer.buffer;
final int pos = buffer.position();
write(buffer.position(0));
buffer.position(pos);
write(writer.buffer);
}
/**