3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

#730: Let World#setSpawnLocation() support an angle

Dieser Commit ist enthalten in:
Parker Hawke 2020-08-18 17:54:36 +10:00 committet von md_5
Ursprung fad5fb9e8c
Commit 2e178b09c6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11

Datei anzeigen

@ -310,14 +310,14 @@ public class CraftWorld implements World {
public boolean setSpawnLocation(Location location) { public boolean setSpawnLocation(Location location) {
Preconditions.checkArgument(location != null, "location"); Preconditions.checkArgument(location != null, "location");
return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()) : false; return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw()) : false;
} }
@Override @Override
public boolean setSpawnLocation(int x, int y, int z) { public boolean setSpawnLocation(int x, int y, int z, float angle) {
try { try {
Location previousLocation = getSpawnLocation(); Location previousLocation = getSpawnLocation();
world.worldData.setSpawn(new BlockPosition(x, y, z), 0.0F); world.worldData.setSpawn(new BlockPosition(x, y, z), angle);
// Notify anyone who's listening. // Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
@ -329,6 +329,11 @@ public class CraftWorld implements World {
} }
} }
@Override
public boolean setSpawnLocation(int x, int y, int z) {
return setSpawnLocation(x, y, z, 0.0F);
}
@Override @Override
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk; return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk;