Paper/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch
Aikar c953e51dd7
[Auto] Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
221aed6cf SPIGOT-6413: Server Corruption Changing Blocks in Piston Events
721c4966b SPIGOT-6411: The PlayerEditBookEvent is not called when the player edits a book in the off-hand.
be0e94581 Add mc-dev imports

Spigot Changes:
a25e8ed2 Remove mc-dev imports
2021-04-07 01:17:32 -04:00

22 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index c4bbc4e97ee1871ed6e4364c1fe9204b0dd2fdae..e008ef98d6902f5e1000da99870b12ae9d61bddb 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1038,6 +1038,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
if (entity.dead) {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
return false;