mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
526795bacd
* Update patches to handle vineflower decompiler * update patches again to handle inlined simple lambdas * update vf again and re-apply/rebuild patches * update patches after removal of verify-merges flag * fix compile issue * remove maven local * fix some issues * address more issues * fix collision patch * use paperweight release * more fixes * update fineflower and fix patches again * add missing comment descriptor --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
76 lines
4.6 KiB
Diff
76 lines
4.6 KiB
Diff
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/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 2a0e81a3ec0774ad98e2d74ac7672c167e28f38e..05b838f7008d5d031b18e161bbde7e72b8205b90 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -1425,6 +1425,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
} else {
|
|
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
|
|
|
|
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
|
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
|
|
playerchunkmap_entitytracker.updatePlayers(this.level.players());
|
|
if (entity instanceof ServerPlayer) {
|
|
@@ -1467,7 +1468,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
if (playerchunkmap_entitytracker1 != null) {
|
|
playerchunkmap_entitytracker1.broadcastRemoved();
|
|
}
|
|
-
|
|
+ entity.tracker = null; // Paper - We're no longer tracked
|
|
}
|
|
|
|
protected void tick() {
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 113dce44ce086272fe7f20a2007efadee142ff85..0811a2e87192b46c39f54c26ce0e56fc6e9d87e5 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1197,6 +1197,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// CraftBukkit start
|
|
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
|
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
|
+ // Paper start - extra debug info
|
|
+ if (entity.valid) {
|
|
+ MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end - extra debug info
|
|
if (entity.isRemoved()) {
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
|
|
return false;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 36f0a43cc301840406eab260b162295fe760f8bb..c46ad2013439f043145fb7fc67bbcd80728e3c16 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
|
private CraftEntity bukkitEntity;
|
|
|
|
+ public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper
|
|
public CraftEntity getBukkitEntity() {
|
|
if (this.bukkitEntity == null) {
|
|
this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
|
|
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
index 38df704dca30ef08f4d0831dc1cc48c6d6f71a4d..ed6aea7a38ef6e80c300ff9b012dcdbc390ad2c7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
@@ -33,6 +33,14 @@ public class EntityLookup<T extends EntityAccess> {
|
|
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);
|