mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
38 lines
2.0 KiB
Diff
38 lines
2.0 KiB
Diff
From 6cfcac4ce43f629bdd36407b5450ec87b0b9d986 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/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
index f007af2e1..2f1488ee5 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
@@ -1050,7 +1050,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
|
}
|
|
|
|
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
|
|
// CraftBukkit end
|
|
Iterator iterator = entity.bP().iterator();
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index b6efd8506..e74b53c48 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -966,6 +966,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
|
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
|
|
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
|
|
if (entity == null) return false;
|
|
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
|
|
|
|
org.bukkit.event.Cancellable event = null;
|
|
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
|
|
--
|
|
2.18.0
|
|
|