From b8e375fc4032227a6d1e2e77c9df61133969c93e Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 27 Nov 2020 19:27:52 +0200 Subject: [PATCH] Expose world spawn angle (#4803) --- .../0602-Expose-world-spawn-angle.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch diff --git a/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch b/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch new file mode 100644 index 0000000000..0b0610dd98 --- /dev/null +++ b/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Tue, 17 Nov 2020 19:13:09 +0200 +Subject: [PATCH] Expose world spawn angle + + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index a86a4467a0d0ff44f19d62b436aee469cc7b1e0e..70f702680f8221cb262023814a7bae21b0074da6 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -813,7 +813,7 @@ public abstract class PlayerList { + if (location == null) { + worldserver1 = this.server.getWorldServer(World.OVERWORLD); + blockposition = entityplayer1.getSpawnPoint(worldserver1); +- location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F)); ++ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.worldData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle + } + + Player respawnPlayer = cserver.getPlayer(entityplayer1); +diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java +index faf931785ea35df4525d4a429bdb2363e26e491b..14e1762bf8669ef9e8444f5a73952daa50b3b19e 100644 +--- a/src/main/java/net/minecraft/server/WorldData.java ++++ b/src/main/java/net/minecraft/server/WorldData.java +@@ -8,6 +8,7 @@ public interface WorldData { + + int c(); + ++ default float getSpawnAngle() { return d(); } // Paper - OBFHELPER + float d(); + + long getTime(); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 299f57ca2a65887a0d7e7c584fc1bd5c783b0db2..4f8c5e8ebda3e3fe1d2f61ef24ec698caae9a0bb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -379,7 +379,7 @@ public class CraftWorld implements World { + @Override + public Location getSpawnLocation() { + BlockPosition spawn = world.getSpawn(); +- return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ()); ++ return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ(), world.worldData.getSpawnAngle(), 0.0F); // Paper - expose world spawn angle + } + + @Override