2026-07-12 19:30:52 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: MrHua269 <mrhua269@gmail.com>
|
|
|
|
|
Date: Wed, 8 Jul 2026 21:37:19 +0800
|
|
|
|
|
Subject: [PATCH] Fix teleport missing original rotation and velocity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/io/papermc/paper/threadedregions/TeleportUtils.java b/io/papermc/paper/threadedregions/TeleportUtils.java
|
2026-07-14 15:09:17 +08:00
|
|
|
index 2a64a5b2cf049661fe3f5a22ddfa39979624f5ec..0879af04be9dca539f0543f858e2fe460c301de3 100644
|
2026-07-12 19:30:52 +08:00
|
|
|
--- a/io/papermc/paper/threadedregions/TeleportUtils.java
|
|
|
|
|
+++ b/io/papermc/paper/threadedregions/TeleportUtils.java
|
|
|
|
|
@@ -41,7 +41,7 @@ public final class TeleportUtils {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
(useFromRootVehicle ? realFrom.getRootVehicle() : realFrom).teleportAsync(
|
|
|
|
|
- ((CraftWorld)loc.getWorld()).getHandle(), pos, null, null, null,
|
2026-07-14 11:32:51 +08:00
|
|
|
+ ((CraftWorld)loc.getWorld()).getHandle(), pos, yaw, pitch, null, // Shiroha - Fix teleport missing original rotation and velocity
|
2026-07-12 19:30:52 +08:00
|
|
|
cause, teleportFlags, onComplete
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
diff --git a/net/minecraft/server/commands/TeleportCommand.java b/net/minecraft/server/commands/TeleportCommand.java
|
2026-07-14 15:09:17 +08:00
|
|
|
index 13d7965fd4f99f0848b080349df41f8b1c31a19b..4e58868bfb23671bde6296ee9361931564a77f9c 100644
|
2026-07-12 19:30:52 +08:00
|
|
|
--- a/net/minecraft/server/commands/TeleportCommand.java
|
|
|
|
|
+++ b/net/minecraft/server/commands/TeleportCommand.java
|
|
|
|
|
@@ -248,8 +248,8 @@ public class TeleportCommand {
|
|
|
|
|
// Folia start - region threading
|
|
|
|
|
if (true) {
|
|
|
|
|
Vec3 posFinal = new Vec3(x, y, z);
|
|
|
|
|
- Float yawFinal = Float.valueOf(newYRot);
|
|
|
|
|
- Float pitchFinal = Float.valueOf(newXRot);
|
2026-07-14 11:32:51 +08:00
|
|
|
+ Float yawFinal = Float.valueOf(newYRot + victim.getYRot()); // Shiroha - Fix teleport missing original rotation and velocity
|
|
|
|
|
+ Float pitchFinal = Float.valueOf(newXRot + victim.getXRot()); // Shiroha - Fix teleport missing original rotation and velocity
|
2026-07-12 19:30:52 +08:00
|
|
|
victim.getBukkitEntity().taskScheduler.schedule((Entity nmsEntity) -> {
|
|
|
|
|
nmsEntity.stopRiding();
|
|
|
|
|
nmsEntity.teleportAsync(
|
|
|
|
|
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
2026-07-14 15:09:17 +08:00
|
|
|
index e8015ed6f4885fb324964a44752014bf0bbd7326..93aee574b340739c6686f8ad9ab523e6257023f7 100644
|
2026-07-12 19:30:52 +08:00
|
|
|
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
|
|
|
|
@@ -99,7 +99,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entity.teleportAsync(
|
|
|
|
|
- checkWorld, to, null, null, null,
|
2026-07-14 11:32:51 +08:00
|
|
|
+ checkWorld, to, null, null, entity.getDeltaMovement(), // Shiroha - Fix teleport missing original rotation and velocity
|
2026-07-12 19:30:52 +08:00
|
|
|
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.ENDER_PEARL,
|
|
|
|
|
// chunk could have been unloaded
|
|
|
|
|
Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS | Entity.TELEPORT_FLAG_LOAD_CHUNK,
|