13
0
geforkt von Mirrors/Paper

Add Debug Entities option to debug dupe uuid issues

Dieser Commit ist enthalten in:
Aikar 2018-07-21 08:25:40 -04:00
Ursprung 223c6c3b5a
Commit 2f4d83a219
2 geänderte Dateien mit 48 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -129,7 +129,7 @@
+ } + }
+ int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3; + int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3;
+ int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3; + int minBlockZ = Mth.floor(axisalignedbb.minZ - 1.0E-7D) - 3;
+
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3; + int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3; + int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
+ +
@ -209,7 +209,7 @@
+ chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager); + chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager);
+ } + }
+ } + }
+
+ if (gen != null) { + if (gen != null) {
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen); + chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ } + }
@ -568,7 +568,7 @@
} }
} }
@@ -939,41 +1169,86 @@ @@ -939,41 +1169,92 @@
this.entityManager.addNewEntity(player); this.entityManager.addNewEntity(player);
} }
@ -576,6 +576,12 @@
+ // CraftBukkit start + // CraftBukkit start
+ private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { + private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
+ org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot + 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()) { if (entity.isRemoved()) {
- ServerLevel.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityType.getKey(entity.getType())); - ServerLevel.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityType.getKey(entity.getType()));
+ // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit + // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
@ -660,7 +666,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next(); ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -982,6 +1257,12 @@ @@ -982,6 +1263,12 @@
double d1 = (double) pos.getY() - entityplayer.getY(); double d1 = (double) pos.getY() - entityplayer.getY();
double d2 = (double) pos.getZ() - entityplayer.getZ(); double d2 = (double) pos.getZ() - entityplayer.getZ();
@ -673,7 +679,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress)); entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress));
} }
@@ -1030,7 +1311,7 @@ @@ -1030,7 +1317,7 @@
@Override @Override
public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) { public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) {
@ -682,7 +688,7 @@
} }
public int getLogicalHeight() { public int getLogicalHeight() {
@@ -1060,7 +1341,18 @@ @@ -1060,7 +1347,18 @@
Iterator iterator = this.navigatingMobs.iterator(); Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -702,7 +708,7 @@
PathNavigation navigationabstract = entityinsentient.getNavigation(); PathNavigation navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(pos)) { if (navigationabstract.shouldRecomputePath(pos)) {
@@ -1086,11 +1378,13 @@ @@ -1086,11 +1384,13 @@
@Override @Override
public void updateNeighborsAt(BlockPos pos, Block block) { public void updateNeighborsAt(BlockPos pos, Block block) {
@ -716,7 +722,7 @@
this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation); this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, (Direction) null, orientation);
} }
@@ -1126,9 +1420,20 @@ @@ -1126,9 +1426,20 @@
@Override @Override
public void explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> soundEvent) { public void explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> soundEvent) {
@ -738,14 +744,15 @@
case NONE: case NONE:
explosion_effect = Explosion.BlockInteraction.KEEP; explosion_effect = Explosion.BlockInteraction.KEEP;
break; break;
@@ -1144,16 +1449,27 @@ @@ -1143,17 +1454,28 @@
break;
case TRIGGER: case TRIGGER:
explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK; explosion_effect = Explosion.BlockInteraction.TRIGGER_BLOCK;
break; + break;
+ // CraftBukkit start - handle custom explosion type + // CraftBukkit start - handle custom explosion type
+ case STANDARD: + case STANDARD:
+ explosion_effect = Explosion.BlockInteraction.DESTROY; + explosion_effect = Explosion.BlockInteraction.DESTROY;
+ break; break;
+ // CraftBukkit end + // CraftBukkit end
default: default:
throw new MatchException((String) null, (Throwable) null); throw new MatchException((String) null, (Throwable) null);
@ -769,7 +776,7 @@
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1162,10 +1478,11 @@ @@ -1162,10 +1484,11 @@
if (entityplayer.distanceToSqr(vec3d) < 4096.0D) { if (entityplayer.distanceToSqr(vec3d) < 4096.0D) {
Optional<Vec3> optional = Optional.ofNullable((Vec3) serverexplosion.getHitPlayers().get(entityplayer)); Optional<Vec3> optional = Optional.ofNullable((Vec3) serverexplosion.getHitPlayers().get(entityplayer));
@ -782,7 +789,7 @@
} }
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) { private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayRule) {
@@ -1226,17 +1543,29 @@ @@ -1226,17 +1549,29 @@
} }
public <T extends ParticleOptions> int sendParticles(T parameters, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double speed) { public <T extends ParticleOptions> int sendParticles(T parameters, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double speed) {
@ -818,7 +825,7 @@
++j; ++j;
} }
} }
@@ -1292,7 +1621,7 @@ @@ -1292,7 +1627,7 @@
@Nullable @Nullable
public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipReferencedStructures) { public BlockPos findNearestMapStructure(TagKey<Structure> structureTag, BlockPos pos, int radius, boolean skipReferencedStructures) {
@ -827,7 +834,7 @@
return null; return null;
} else { } else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag); Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(structureTag);
@@ -1334,11 +1663,22 @@ @@ -1334,11 +1669,22 @@
@Nullable @Nullable
@Override @Override
public MapItemSavedData getMapData(MapId id) { public MapItemSavedData getMapData(MapId id) {
@ -851,7 +858,7 @@
this.getServer().overworld().getDataStorage().set(id.key(), state); this.getServer().overworld().getDataStorage().set(id.key(), state);
} }
@@ -1649,6 +1989,11 @@ @@ -1649,6 +1995,11 @@
@Override @Override
public void blockUpdated(BlockPos pos, Block block) { public void blockUpdated(BlockPos pos, Block block) {
if (!this.isDebug()) { if (!this.isDebug()) {
@ -863,7 +870,7 @@
this.updateNeighborsAt(pos, block); this.updateNeighborsAt(pos, block);
} }
@@ -1668,12 +2013,12 @@ @@ -1668,12 +2019,12 @@
} }
public boolean isFlat() { public boolean isFlat() {
@ -878,7 +885,7 @@
} }
@Nullable @Nullable
@@ -1696,7 +2041,7 @@ @@ -1696,7 +2047,7 @@
private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) { private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) {
try { try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap(); Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -887,7 +894,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
T t0 = iterator.next(); T t0 = iterator.next();
@@ -1705,7 +2050,7 @@ @@ -1705,7 +2056,7 @@
object2intopenhashmap.addTo(s, 1); object2intopenhashmap.addTo(s, 1);
} }
@ -896,7 +903,7 @@
String s1 = (String) entry.getKey(); String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue(); return s1 + ":" + entry.getIntValue();
@@ -1717,6 +2062,7 @@ @@ -1717,6 +2068,7 @@
@Override @Override
public LevelEntityGetter<Entity> getEntities() { public LevelEntityGetter<Entity> getEntities() {
@ -904,7 +911,7 @@
return this.entityManager.getEntityGetter(); return this.entityManager.getEntityGetter();
} }
@@ -1802,6 +2148,17 @@ @@ -1802,6 +2154,17 @@
return this.serverLevelData.getGameRules(); return this.serverLevelData.getGameRules();
} }
@ -922,7 +929,7 @@
@Override @Override
public CrashReportCategory fillReportDetails(CrashReport report) { public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
@@ -1836,6 +2193,7 @@ @@ -1836,6 +2199,7 @@
} }
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
@ -930,7 +937,7 @@
ServerLevel.this.getChunkSource().addEntity(entity); ServerLevel.this.getChunkSource().addEntity(entity);
if (entity instanceof ServerPlayer entityplayer) { if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.add(entityplayer); ServerLevel.this.players.add(entityplayer);
@@ -1864,9 +2222,52 @@ @@ -1864,9 +2228,52 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@ -983,7 +990,7 @@
ServerLevel.this.getChunkSource().removeEntity(entity); ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer entityplayer) { if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.remove(entityplayer); ServerLevel.this.players.remove(entityplayer);
@@ -1895,6 +2296,15 @@ @@ -1895,6 +2302,15 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);

Datei anzeigen

@ -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);