From 345329c425abd2993977d38cda1b389ee21ee3e6 Mon Sep 17 00:00:00 2001 From: Seppe Volkaerts Date: Tue, 24 Sep 2024 20:09:43 +0200 Subject: [PATCH] Fix writing modded projectile data Signed-off-by: Seppe Volkaerts --- .../terre/impl/network/packet/ProjectileUpdatePacket.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/kotlin/org/lanternpowered/terre/impl/network/packet/ProjectileUpdatePacket.kt b/proxy/src/main/kotlin/org/lanternpowered/terre/impl/network/packet/ProjectileUpdatePacket.kt index ab170b2..1921f97 100644 --- a/proxy/src/main/kotlin/org/lanternpowered/terre/impl/network/packet/ProjectileUpdatePacket.kt +++ b/proxy/src/main/kotlin/org/lanternpowered/terre/impl/network/packet/ProjectileUpdatePacket.kt @@ -22,6 +22,7 @@ import org.lanternpowered.terre.impl.network.buffer.readVarInt import org.lanternpowered.terre.impl.network.buffer.readVec2f import org.lanternpowered.terre.impl.network.buffer.writePlayerId import org.lanternpowered.terre.impl.network.buffer.writeProjectileId +import org.lanternpowered.terre.impl.network.buffer.writeVarInt import org.lanternpowered.terre.impl.network.buffer.writeVec2f import org.lanternpowered.terre.math.Vec2f import org.lanternpowered.terre.util.Bytes @@ -86,7 +87,10 @@ internal val ProjectileUpdateEncoder = PacketEncoder { b buf.writeShortLE(packet.uniqueId) if (packet.ai2 != 0f) buf.writeFloatLE(packet.ai2) - buf.writeBytes(modData) + if (modData.isNotEmpty()) { + buf.writeVarInt(modData.size) + buf.writeBytes(modData) + } } internal val ProjectileUpdateDecoder = PacketDecoder { buf ->