Paper/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

45 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
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 c074f0b451b5bbaab977a7512045a6da9399ed32..43176569a34a4c6af7a3fe7acf0c00da2f6fc91c 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -815,7 +815,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 1162bf553ff6e5c5faf688b080a202dc55650ced..597d7a36d7d0b19502d92cf13da53d96c6ede58a 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