Skip to content

Commit

Permalink
fix teleport command can't teleport ships between two dimensions. (#908)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiewuzhiying authored Sep 23, 2024
1 parent a9ed052 commit 17a8173
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.valkyrienskies.core.impl.game.ShipTeleportDataImpl
import org.valkyrienskies.core.util.x
import org.valkyrienskies.core.util.y
import org.valkyrienskies.core.util.z
import org.valkyrienskies.mod.common.dimensionId
import org.valkyrienskies.mod.common.getShipManagingPos
import org.valkyrienskies.mod.common.util.toJOML
import org.valkyrienskies.mod.common.util.toJOMLD
Expand Down Expand Up @@ -96,8 +97,12 @@ object VSCommands {
val r = ShipArgument.getShips(it, "ships").toList() as List<ServerShip>
val position =
Vec3Argument.getVec3(it as CommandContext<CommandSourceStack>, "position")
val dimensionId = (it.source as CommandSourceStack).level.dimensionId
val shipTeleportData: ShipTeleportData =
ShipTeleportDataImpl(newPos = position.toJOML())
ShipTeleportDataImpl(
newPos = position.toJOML(),
newDimension = dimensionId
)
r.forEach { ship ->
vsCore.teleportShip(
(it as CommandContext<VSCommandSource>).source.shipWorld as ServerShipWorld,
Expand Down Expand Up @@ -125,12 +130,14 @@ object VSCommands {
)

val source = it.source as CommandSourceStack
val dimensionId = (it.source as CommandSourceStack).level.dimensionId
val shipTeleportData: ShipTeleportData =
ShipTeleportDataImpl(
newPos = position.toJOML(),
newRot = eulerAngles.toEulerRotationFromMCEntity(
source.rotation.x.toDouble(), source.rotation.y.toDouble(),
)
),
newDimension = dimensionId
)
r.forEach { ship ->
vsCore.teleportShip(
Expand Down Expand Up @@ -164,13 +171,15 @@ object VSCommands {
)

val source = it.source as CommandSourceStack
val dimensionId = (it.source as CommandSourceStack).level.dimensionId
val shipTeleportData: ShipTeleportData =
ShipTeleportDataImpl(
newPos = position.toJOML(),
newRot = eulerAngles.toEulerRotationFromMCEntity(
source.rotation.x.toDouble(), source.rotation.y.toDouble(),
),
newVel = velocity.toVector3d(0.0, 0.0, 0.0)
newVel = velocity.toVector3d(0.0, 0.0, 0.0),
newDimension = dimensionId
)
r.forEach { ship ->
vsCore.teleportShip(
Expand Down Expand Up @@ -209,14 +218,16 @@ object VSCommands {
)

val source = it.source as CommandSourceStack
val dimensionId = (it.source as CommandSourceStack).level.dimensionId
val shipTeleportData: ShipTeleportData =
ShipTeleportDataImpl(
newPos = position.toJOML(),
newRot = eulerAngles.toEulerRotationFromMCEntity(
source.rotation.x.toDouble(), source.rotation.y.toDouble(),
),
newVel = velocity.toVector3d(0.0, 0.0, 0.0),
newOmega = angularVelocity.toVector3d(0.0, 0.0, 0.0)
newOmega = angularVelocity.toVector3d(0.0, 0.0, 0.0),
newDimension = dimensionId
)
r.forEach { ship ->
vsCore.teleportShip(
Expand Down

0 comments on commit 17a8173

Please sign in to comment.