Skip to content

Commit

Permalink
Update Network.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
EngineMachiner committed Aug 19, 2024
1 parent cd21a22 commit 1633705
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/main/kotlin/com/enginemachiner/harmony/Network.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,7 @@ class Sender( id: Identifier, write: Write? = null ) : AbstractSender(id, write)
/** Send packets to clients. */
fun toClients( world: World, canSend: CanSend = ::isNotSender ) {

val buf = buf() // Get it once. Not in the loop.

world.players.forEach {

val canSend = canSend(it, sender)

if ( !canSend ) return@forEach; it as ServerPlayerEntity

ServerPlayNetworking.send( it, id, buf )

}
toClients( world.players.toSet(), canSend )

}

Expand Down

0 comments on commit 1633705

Please sign in to comment.