mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 05:55:44 +01:00
Include previous spawn angle in SpawnChangeEvent (#8606)
This commit is contained in:
parent
f2075c4d3c
commit
e5e75dd008
@ -5,29 +5,35 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 95c53189e32aec6aca254fa3b157df7bc68d4d1a..0637fd424e98175f864f15c8bfa8bf696ed47fe7 100644
|
||||
index 95c53189e32aec6aca254fa3b157df7bc68d4d1a..b046d08f2c9cc78935e5b75b5367aa45d540465c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1866,6 +1866,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1863,9 +1863,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public void setDefaultSpawnPos(BlockPos pos, float angle) {
|
||||
// Paper - configurable spawn radius
|
||||
BlockPos prevSpawn = this.getSharedSpawnPos();
|
||||
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper
|
||||
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
|
||||
|
||||
this.levelData.setSpawn(pos, angle);
|
||||
+ new org.bukkit.event.world.SpawnChangeEvent(getWorld(), MCUtil.toLocation(this, prevSpawn)).callEvent(); // Paper
|
||||
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper
|
||||
if (this.keepSpawnInMemory) {
|
||||
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
|
||||
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index a25dbc2bd3005cb3d1aee61fb48522b13e7c4922..b3c28849841a0dd661ce81235914670ce6cbbfef 100644
|
||||
index a25dbc2bd3005cb3d1aee61fb48522b13e7c4922..cee8c89c5a4d3244f341205e255581086112b708 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -262,11 +262,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -261,12 +261,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
public boolean setSpawnLocation(int x, int y, int z, float angle) {
|
||||
try {
|
||||
Location previousLocation = this.getSpawnLocation();
|
||||
- Location previousLocation = this.getSpawnLocation();
|
||||
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
||||
+ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn
|
||||
+ // Location previousLocation = this.getSpawnLocation(); // Paper - moved to nms.ServerLevel
|
||||
+ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use ServerLevel#setDefaultSpawnPos
|
||||
|
||||
+ // Paper start - move to nms.World
|
||||
+ // Paper start - move to nms.ServerLevel
|
||||
// Notify anyone who's listening.
|
||||
- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
||||
- this.server.getPluginManager().callEvent(event);
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 8866507da8474e4eee767fdf6f83b95c92fb5767..f8832ebb35ceb7f70e12d6c11f435308de4ae33d 100644
|
||||
index 32c212861517fef926640dd19f596e6f0cbd8648..e6f931b8443a539441d9f918909e8244c853e43e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1931,6 +1931,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1932,6 +1932,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
});
|
||||
optional1.ifPresent((holder) -> {
|
||||
this.getServer().execute(() -> {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c8e0531dccd7cff093c304b25c62476dbcb10ff9..b91a199f2e426b49ddc72c8e9d0224c05d8a7acd 100644
|
||||
index 5570ff6fccda19343a5520dca2671045c4fc48b4..6b17c008926287f2c9f828ba656c3a77aef0fb2c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2587,6 +2587,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2588,6 +2588,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Spigot end
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
|
@ -9,7 +9,7 @@ list is only used in the tick and tickPassenger methods, so we can safely not ad
|
||||
markers to it.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java
|
||||
index ec421bb7a9d7de58688c0710a282b488ca836cf5..b500cc9b7e035ed90eaaab1277eba42488e329dd 100644
|
||||
index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..4ec1e8ded06c60d81446c67bba2aa8a04111fa9b 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java
|
||||
@@ -109,7 +109,7 @@ public final class EntityCommand implements PaperSubcommand {
|
||||
@ -22,10 +22,10 @@ index ec421bb7a9d7de58688c0710a282b488ca836cf5..b500cc9b7e035ed90eaaab1277eba424
|
||||
}
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index b91a199f2e426b49ddc72c8e9d0224c05d8a7acd..d0a19d8e04e92a39d5db19e9eb23aa44a7691567 100644
|
||||
index 6b17c008926287f2c9f828ba656c3a77aef0fb2c..a81eaee4339d7f4b0bf94c012cdbf8f4fa2f78f8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2497,6 +2497,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2498,6 +2498,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
public void onTickingStart(Entity entity) {
|
||||
|
@ -2008,7 +2008,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d0a19d8e04e92a39d5db19e9eb23aa44a7691567..4029f898b16205bf6779ee3b38dd2223d01ee27e 100644
|
||||
index a81eaee4339d7f4b0bf94c012cdbf8f4fa2f78f8..dd4bd208fba1806a298ccc76d64efdcb2a061be7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -2019,7 +2019,7 @@ index d0a19d8e04e92a39d5db19e9eb23aa44a7691567..4029f898b16205bf6779ee3b38dd2223
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
|
||||
@@ -2486,6 +2487,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2487,6 +2488,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return this.server.getWorldData().enabledFeatures();
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 02c8e154b424b7bfae9ff28b6acfc0362721d2e8..3af3dd8f151793dbcca46e110bf7fcdaabd847a7 100644
|
||||
index e9457d8a29d1f54af8415ad006b75d567e524a46..fe960b254c2c6e4f7122392ce6b5c599b6de3961 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2533,7 +2533,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2534,7 +2534,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (entity instanceof Mob) {
|
||||
Mob entityinsentient = (Mob) entity;
|
||||
|
||||
@ -17,7 +17,7 @@ index 02c8e154b424b7bfae9ff28b6acfc0362721d2e8..3af3dd8f151793dbcca46e110bf7fcda
|
||||
String s = "onTrackingStart called during navigation iteration";
|
||||
|
||||
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
|
||||
@@ -2618,7 +2618,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2619,7 +2619,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (entity instanceof Mob) {
|
||||
Mob entityinsentient = (Mob) entity;
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] check global player list where appropriate
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 3af3dd8f151793dbcca46e110bf7fcdaabd847a7..54c2b7fba83d6f06dba95b1bb5b487a02048d6e6 100644
|
||||
index fe960b254c2c6e4f7122392ce6b5c599b6de3961..e84c67f02bce4c2f9c4eeca1b888d53377fb20d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2655,4 +2655,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2656,4 +2656,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::move);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user