Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
c0936a71bd
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 01aa02eb PR-858: Add LivingEntity#playHurtAnimation() 9421320f PR-884: Refinements to new ban API for improved compatibility and correctness 37a60b45 SPIGOT-6455, SPIGOT-7030, PR-750: Improve ban API 4eeb174b All smithing inventories are now the new smithing inventory f2bb168e PR-880: Add methods to get/set FallingBlock CancelDrop e7a807fa PR-879: Add Player#sendHealthUpdate() 692b8e96 SPIGOT-7370: Remove float value conversion in plugin.yml 2d033390 SPIGOT-7403: Add direct API for waxed signs 16a08373 PR-876: Add missing Raider API and 'no action ticks' CraftBukkit Changes: b60a95c8c PR-1189: Add LivingEntity#playHurtAnimation() 95c335c63 PR-1226: Fix VehicleEnterEvent not being called for certain entities 0a0fc3bee PR-1227: Refinements to new ban API for improved compatibility and correctness 0d0b1e5dc Revert bad change to PathfinderGoalSit causing all cats to sit 648196070 SPIGOT-6455, SPIGOT-7030, PR-1054: Improve ban API 31fe848d6 All smithing inventories are now the new smithing inventory 9a919a143 SPIGOT-7416: SmithItemEvent not firing in Smithing Table 9f64f0d22 PR-1221: Add methods to get/set FallingBlock CancelDrop 3be9ac171 PR-1220: Add Player#sendHealthUpdate() c1279f775 PR-1209: Clean up various patches c432e4397 Fix Raider#setCelebrating() implementation 504d96665 SPIGOT-7403: Add direct API for waxed signs c68c1f1b3 PR-1216: Add missing Raider API and 'no action ticks' 85b89c3dd Increase outdated build delay Spigot Changes: 9ebce8af Rebuild patches 64b565e6 Rebuild patches
130 Zeilen
7.5 KiB
Diff
130 Zeilen
7.5 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
|
|
|
|
Add -Ddebug.entities=true to your JVM flags to gain more information
|
|
|
|
1.17: Needs to be reworked for new entity storage system
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 8dc2a217d018e0a11fb852cf46d4e9b5290ea6a0..af92411006c3d281815b3f4c3de5f0280d3a5901 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -897,6 +897,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) {
|
|
@@ -939,7 +940,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 33ce550ea68d4862e0966ed827200cf426909d85..6b157b362cffedae26133fc0f0af1094655ee11f 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -221,6 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
public final LevelStorageSource.LevelStorageAccess convertable;
|
|
public final UUID uuid;
|
|
public boolean hasPhysicsEvent = true; // Paper
|
|
+ public static Throwable getAddToWorldStackTrace(Entity entity) {
|
|
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
|
+ }
|
|
|
|
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
|
return this.chunkSource.getChunk(x, z, false);
|
|
@@ -1411,7 +1414,28 @@ 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
|
|
+ if (entity.valid) {
|
|
+ MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
|
|
+
|
|
+ if (DEBUG_ENTITIES) {
|
|
+ Throwable thr = entity.addedToWorldStack;
|
|
+ if (thr == null) {
|
|
+ MinecraftServer.LOGGER.error("Double add entity has no add stacktrace");
|
|
+ } else {
|
|
+ MinecraftServer.LOGGER.error("Double add stacktrace: ", thr);
|
|
+ }
|
|
+ }
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end
|
|
if (entity.isRemoved()) {
|
|
+ // Paper start
|
|
+ if (DEBUG_ENTITIES) {
|
|
+ new Throwable("Tried to add entity " + entity + " but it was marked as removed already").printStackTrace(); // CraftBukkit
|
|
+ getAddToWorldStackTrace(entity).printStackTrace();
|
|
+ }
|
|
+ // Paper end
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
|
|
return false;
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 0f4d3a883fe54b102d1b2dc696a02310493b7f00..0cddb74633ebcf85f019c6015767719a07f1c9a7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -238,6 +238,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
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 @Nullable Throwable addedToWorldStack; // Paper - entity debug
|
|
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/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 8a53284a5846b25864352e18a5e6b2deb8d3e3ed..75df40ab76f9813cf08682f06fd3ae499c70b4ba 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -150,6 +150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
public boolean pvpMode;
|
|
public boolean keepSpawnInMemory = true;
|
|
public org.bukkit.generator.ChunkGenerator generator;
|
|
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
|
|
|
|
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
|
|
public boolean captureBlockStates = 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
|
|
index 21a2800db22f287b9c6a8290326fdf3b94ae94b1..d45d832232be5017dde53816191c2b1830a0da32 100644
|
|
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
|
|
@@ -34,6 +34,26 @@ 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 entityCast) {
|
|
+ if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) {
|
|
+ entityCast.addedToWorldStack = net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace(entityCast);
|
|
+ }
|
|
+
|
|
+ T old = this.byUuid.get(entity.getUUID());
|
|
+ if (old instanceof net.minecraft.world.entity.Entity oldCast && old != null && oldCast.getId() != entity.getId() && oldCast.valid) {
|
|
+ LOGGER.error("Overwrote an existing entity " + oldCast + " with " + entity);
|
|
+ if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) {
|
|
+ if (oldCast.addedToWorldStack != null) {
|
|
+ oldCast.addedToWorldStack.printStackTrace();
|
|
+ } else {
|
|
+ LOGGER.error("Oddly, the old entity was not added to the world in the normal way. Plugins?");
|
|
+ }
|
|
+ entityCast.addedToWorldStack.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
} else {
|
|
this.byUuid.put(uUID, entity);
|
|
this.byId.put(entity.getId(), entity);
|