Optimize packet write

This commit is contained in:
filoghost 2021-09-14 23:55:19 +02:00
parent 03b6437f23
commit 05488268b0
20 changed files with 60 additions and 50 deletions

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {

View File

@ -17,7 +17,7 @@ class EntityMountNMSPacket extends VersionNMSPacket {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID()); packetByteBuffer.writeVarInt(vehicleEntityID.getNumericID());
packetByteBuffer.writeIntArray(passengerEntityID.getNumericID()); packetByteBuffer.writeVarIntArray(passengerEntityID.getNumericID());
this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer); this.rawPacket = writeData(new PacketPlayOutMount(), packetByteBuffer);
} }

View File

@ -27,12 +27,13 @@ class PacketByteBuffer extends PacketDataSerializer {
super.d(i); super.d(i);
} }
void writeUUID(UUID uuid) { void writeVarIntArray(int i1) {
super.a(uuid); writeVarInt(1);
writeVarInt(i1);
} }
void writeIntArray(int... array) { void writeUUID(UUID uuid) {
super.a(array); super.a(uuid);
} }
<T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) { <T> void writeDataWatcherEntry(DataWatcherKey<T> key, T value) {