3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00

SPIGOT-5399: spawn-npcs ignored during world generation

Dieser Commit ist enthalten in:
md_5 2019-12-05 11:01:56 +11:00
Ursprung e9bb2f15aa
Commit 43183eabc2

Datei anzeigen

@ -90,7 +90,24 @@
});
}
@@ -571,7 +599,7 @@
@@ -548,8 +576,15 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
+ boolean needsRemoval = false;
+ if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) {
+ entity.die();
+ needsRemoval = true;
+ }
- if (!(entity instanceof EntityHuman) && !this.world.addEntityChunk(entity)) {
+ if (!(entity instanceof EntityHuman) && (needsRemoval || !this.world.addEntityChunk(entity))) {
+ // CraftBukkit end
if (list == null) {
list = Lists.newArrayList(new Entity[]{entity});
} else {
@@ -571,7 +606,7 @@
long i = playerchunk.i().pair();
playerchunk.getClass();
@ -99,7 +116,7 @@
});
}
@@ -588,7 +616,7 @@
@@ -588,7 +623,7 @@
return Either.left(chunk);
});
}, (runnable) -> {
@ -108,7 +125,7 @@
});
completablefuture1.thenAcceptAsync((either) -> {
@@ -602,7 +630,7 @@
@@ -602,7 +637,7 @@
return Either.left(chunk);
});
}, (runnable) -> {
@ -117,7 +134,7 @@
});
return completablefuture1;
}
@@ -616,7 +644,7 @@
@@ -616,7 +651,7 @@
return chunk;
});
}, (runnable) -> {
@ -126,7 +143,7 @@
});
}
@@ -740,7 +768,8 @@
@@ -740,7 +775,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@ -136,7 +153,7 @@
return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
}).orElse(0), optional1.map((chunk) -> {
return chunk.getTileEntities().size();
@@ -751,7 +780,7 @@
@@ -751,7 +787,7 @@
private static String a(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@ -145,7 +162,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -769,7 +798,7 @@
@@ -769,7 +805,7 @@
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@ -154,7 +171,7 @@
}
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
@@ -1101,7 +1130,7 @@
@@ -1101,7 +1137,7 @@
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@ -163,7 +180,7 @@
this.tracker = entity;
this.trackingDistance = i;
this.e = SectionPosition.a(entity);
@@ -1154,7 +1183,7 @@
@@ -1154,7 +1190,7 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.tracker) {
@ -172,7 +189,7 @@
int i = Math.min(this.trackingDistance, (PlayerChunkMap.this.viewDistance - 1) * 16);
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer);
@@ -1170,6 +1199,17 @@
@@ -1170,6 +1206,17 @@
}
}