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)) } } }