2023-06-25 23:01:20 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
Date: Sun, 25 Jun 2023 13:57:30 -0700
|
|
|
|
Subject: [PATCH] Sync vehicle position to player position on player data load
|
|
|
|
|
|
|
|
This allows the player to be re-positioned before logging into
|
|
|
|
the world without causing thread checks to trip on Folia.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2024-07-31 05:09:52 +02:00
|
|
|
index e0ff51d537dccd0018b8cb7f5a4bb25222f1219c..7203bd2660514c444a09b3be42464180a8f1154b 100644
|
2023-06-25 23:01:20 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2024-07-31 05:09:52 +02:00
|
|
|
@@ -516,7 +516,13 @@ public abstract class PlayerList {
|
2024-05-10 06:07:34 +02:00
|
|
|
if (optional.isPresent() && ((CompoundTag) optional.get()).contains("RootVehicle", 10)) {
|
|
|
|
CompoundTag nbttagcompound = ((CompoundTag) optional.get()).getCompound("RootVehicle");
|
|
|
|
ServerLevel finalWorldServer = worldserver1; // CraftBukkit - decompile error
|
2023-06-25 23:01:20 +02:00
|
|
|
+ Vec3 playerPos = player.position(); // Paper - force sync root vehicle to player position
|
2024-05-10 06:07:34 +02:00
|
|
|
Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> {
|
2023-06-25 23:01:20 +02:00
|
|
|
+ // Paper start - force sync root vehicle to player position
|
|
|
|
+ if (entity1.distanceToSqr(player) > (5.0 * 5.0)) {
|
|
|
|
+ entity1.setPosRaw(playerPos.x, playerPos.y, playerPos.z, true);
|
|
|
|
+ }
|
|
|
|
+ // Paper end - force sync root vehicle to player position
|
2024-05-10 06:07:34 +02:00
|
|
|
return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // CraftBukkit - decompile error // Paper - Entity#getEntitySpawnReason
|
2023-06-25 23:01:20 +02:00
|
|
|
});
|
2024-05-10 06:07:34 +02:00
|
|
|
|