3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/patches/server-remapped/0601-Expose-world-spawn-angle.patch

45 Zeilen
2.7 KiB
Diff

2021-06-11 14:02:28 +02:00
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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cda21726f4929b03191e912550d4e4b1232b3b0b..7e07fd0c8dec9f9cdeda65dfa0ccf42b4dde010e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -890,7 +890,7 @@ public abstract class PlayerList {
if (location == null) {
worldserver1 = this.server.getLevel(Level.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.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
}
Player respawnPlayer = cserver.getPlayer(entityplayer1);
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelData.java b/src/main/java/net/minecraft/world/level/storage/LevelData.java
index 12a2371b15588ae84824d7a2d36a6d4c37e77013..078cee770a77b77d9b4a777754599d7b0b31f54b 100644
--- a/src/main/java/net/minecraft/world/level/storage/LevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/LevelData.java
@@ -12,6 +12,7 @@ public interface LevelData {
int getZSpawn();
+ default float getSpawnAngle() { return getSpawnAngle(); } // Paper - OBFHELPER
float getSpawnAngle();
long getGameTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 28bf53bc9fca21f57cd4851adf508d833ecdd33b..aaf97c13babce3b0ffc639ef950d59d1eba1398a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -362,7 +362,7 @@ public class CraftWorld implements World {
@Override
public Location getSpawnLocation() {
BlockPos spawn = world.getSpawn();
- return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ());
+ return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ(), world.levelData.getSpawnAngle(), 0.0F); // Paper - expose world spawn angle
}
@Override