From 4ceb5416fbe4d15cf3979d1a532a0ed322bed584 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 31 Jul 2022 09:15:59 -0400 Subject: [PATCH] fix inconsistencies with teleport updating --- .../casting/operators/spells/great/OpTeleport.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt index 27c7a42c..868e8ac2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpTeleport.kt @@ -91,21 +91,29 @@ object OpTeleport : SpellOperator { cursor = cursor.vehicle } + val playersToUpdate = mutableListOf() + if (stickyTeleport) { // this handles teleporting the passengers val target = base!!.position().add(delta) base.teleportTo(target.x, target.y, target.z) + base.indirectPassengers + .filterIsInstance() + .forEach(playersToUpdate::add) } else { // Break it into two stacks teleportee.stopRiding() - teleportee.firstPassenger?.stopRiding() + teleportee.passengers.forEach(Entity::stopRiding) teleportee.setPos(teleportee.position().add(delta)) + if (teleportee is ServerPlayer) { + playersToUpdate.add(teleportee) + } } teleportee.setPos(teleportee.position().add(delta)) - if (teleportee is ServerPlayer) { - teleportee.connection.resetPosition() - IXplatAbstractions.INSTANCE.sendPacketToPlayer(teleportee, MsgBlinkAck(delta)) + for (player in playersToUpdate) { + player.connection.resetPosition() + IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkAck(delta)) } } }