Add Debug Entities option to debug dupe uuid issues

This commit is contained in:
Aikar
2018-07-21 08:25:40 -04:00
parent 223c6c3b5a
commit 2f4d83a219
2 changed files with 48 additions and 24 deletions

View File

@@ -0,0 +1,17 @@
--- a/net/minecraft/world/level/entity/EntityLookup.java
+++ b/net/minecraft/world/level/entity/EntityLookup.java
@@ -33,6 +33,14 @@
UUID uUID = entity.getUUID();
if (this.byUuid.containsKey(uUID)) {
LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity);
+ // Paper start - extra debug info
+ 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);
+ }
+ }
+ // Paper end - extra debug info
} else {
this.byUuid.put(uUID, entity);
this.byId.put(entity.getId(), entity);