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-02-05 20:41:39 +01:00
|
|
|
index 93e192ea1a0cda2d7aae983980a6fead013c8b90..b19f1db38e71d9185cca9fc0e44937f91443a042 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
|
2023-12-17 00:32:48 +01:00
|
|
|
@@ -514,7 +514,13 @@ public abstract class PlayerList {
|
2023-06-25 23:01:20 +02:00
|
|
|
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
|
|
|
// CraftBukkit start
|
|
|
|
ServerLevel finalWorldServer = worldserver1;
|
|
|
|
+ Vec3 playerPos = player.position(); // Paper - force sync root vehicle to player position
|
|
|
|
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
|
|
|
|
+ // 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-02-05 20:41:39 +01:00
|
|
|
return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason
|
2023-06-25 23:01:20 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
});
|