2021-06-14 08:41:01 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sat, 21 Jul 2018 08:25:40 -0400
|
|
|
|
Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2024-10-25 21:24:15 +02:00
|
|
|
index 425c22fe94e83d880b331cbfb16dc67f22def1c7..a12d5de8834bbc3176be3d2c8353b2d4372dbc1d 100644
|
2021-06-14 08:41:01 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2024-10-23 12:32:08 +02:00
|
|
|
@@ -1196,6 +1196,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
2021-06-14 08:41:01 +02:00
|
|
|
// CraftBukkit start
|
2021-11-23 16:04:41 +01:00
|
|
|
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
2021-06-14 08:41:01 +02:00
|
|
|
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
2024-01-21 17:39:05 +01:00
|
|
|
+ // Paper start - extra debug info
|
2021-06-14 08:41:01 +02:00
|
|
|
+ if (entity.valid) {
|
2024-01-21 17:39:05 +01:00
|
|
|
+ MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
|
2021-06-14 08:41:01 +02:00
|
|
|
+ return true;
|
|
|
|
+ }
|
2024-01-21 17:39:05 +01:00
|
|
|
+ // Paper end - extra debug info
|
2021-06-14 08:41:01 +02:00
|
|
|
if (entity.isRemoved()) {
|
2021-11-23 16:04:41 +01:00
|
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
|
2021-06-14 08:41:01 +02:00
|
|
|
return false;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
2024-04-12 21:14:06 +02:00
|
|
|
index 38df704dca30ef08f4d0831dc1cc48c6d6f71a4d..ed6aea7a38ef6e80c300ff9b012dcdbc390ad2c7 100644
|
2021-06-14 08:41:01 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -33,6 +33,14 @@ public class EntityLookup<T extends EntityAccess> {
|
2021-06-14 08:41:01 +02:00
|
|
|
UUID uUID = entity.getUUID();
|
|
|
|
if (this.byUuid.containsKey(uUID)) {
|
|
|
|
LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity);
|
|
|
|
+ // Paper start - extra debug info
|
2024-01-21 17:39:05 +01:00
|
|
|
+ if (entity instanceof net.minecraft.world.entity.Entity) {
|
|
|
|
+ final T old = this.byUuid.get(entity.getUUID());
|
|
|
|
+ if (old instanceof net.minecraft.world.entity.Entity oldCast && oldCast.getId() != entity.getId() && oldCast.valid) {
|
|
|
|
+ LOGGER.error("Overwrote an existing entity {} with {}", oldCast, entity);
|
2021-06-14 08:41:01 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
2024-01-21 17:39:05 +01:00
|
|
|
+ // Paper end - extra debug info
|
2021-06-14 08:41:01 +02:00
|
|
|
} else {
|
|
|
|
this.byUuid.put(uUID, entity);
|
|
|
|
this.byId.put(entity.getId(), entity);
|