Skip to content

Commit

Permalink
Fix writing modded projectile data
Browse files Browse the repository at this point in the history
Signed-off-by: Seppe Volkaerts <[email protected]>
  • Loading branch information
Cybermaxke committed Sep 24, 2024
1 parent 195951c commit 345329c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -86,7 +87,10 @@ internal val ProjectileUpdateEncoder = PacketEncoder<ProjectileUpdatePacket> { 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 ->
Expand Down

0 comments on commit 345329c

Please sign in to comment.