2018-12-17 06:18:06 +01:00
|
|
|
From af2828a58a4f89566cc230a26042e7811491def3 Mon Sep 17 00:00:00 2001
|
2016-06-23 04:50:19 +02:00
|
|
|
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/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
2018-12-17 06:18:06 +01:00
|
|
|
index 3b39b5472..6093ae408 100644
|
2016-06-23 04:50:19 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
2018-09-27 04:35:42 +02:00
|
|
|
@@ -1052,7 +1052,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
2016-06-23 04:50:19 +02:00
|
|
|
}
|
|
|
|
|
2018-07-16 22:08:09 +02:00
|
|
|
public static void a(Entity entity, GeneratorAccess generatoraccess, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
|
|
|
- if (generatoraccess.addEntity(entity, reason) && entity.isVehicle()) {
|
|
|
|
+ if (!entity.valid && generatoraccess.addEntity(entity, reason) && entity.isVehicle()) { // Paper
|
2016-06-23 04:50:19 +02:00
|
|
|
// CraftBukkit end
|
2018-07-16 22:08:09 +02:00
|
|
|
Iterator iterator = entity.bP().iterator();
|
2016-06-23 04:50:19 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-12-17 06:18:06 +01:00
|
|
|
index 6f672aa22..0d04b14cf 100644
|
2016-06-23 04:50:19 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2018-12-17 06:18:06 +01:00
|
|
|
@@ -992,6 +992,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
|
|
|
2016-06-23 04:50:19 +02:00
|
|
|
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added 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
|
2018-12-17 06:18:06 +01:00
|
|
|
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-23 04:50:19 +02:00
|
|
|
--
|
2018-12-17 06:18:06 +01:00
|
|
|
2.20.0
|
2016-06-23 04:50:19 +02:00
|
|
|
|