Paper/Spigot-Server-Patches/0145-Fix-Double-World-Add-issues.patch

38 lines
1.9 KiB
Diff
Raw Normal View History

2017-06-08 16:16:51 +02:00
From 4dac185846e96a86266a1a4bdca819c96d9511c5 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
2017-06-08 16:16:51 +02:00
index 44f0d8831..6b5b5e912 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
2017-04-29 02:25:52 +02:00
@@ -508,7 +508,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
public static void a(Entity entity, World world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
- if (world.addEntity(entity, reason) && entity.isVehicle()) {
+ if (!entity.valid && world.addEntity(entity, reason) && entity.isVehicle()) { // Paper
// CraftBukkit end
2017-06-08 16:16:51 +02:00
Iterator iterator = entity.bF().iterator();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
2017-06-08 16:16:51 +02:00
index a44bc499a..2cdac0ebc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2017-05-14 20:05:01 +02:00
@@ -1101,6 +1101,7 @@ public abstract class World implements IBlockAccess {
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
// CraftBukkit end
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
--
2017-06-08 16:16:51 +02:00
2.13.1