mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
SPIGOT-4783: CreatureSpawnEvent causes crash when getting block type
This commit is contained in:
parent
1949f5835d
commit
86f149ff77
@ -81,19 +81,7 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -454,7 +471,10 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (!(entity instanceof EntityHuman) && !this.world.addEntityChunk(entity)) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean addEntity = !chunk.needsDecoration || CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // Only call for new chunks
|
||||
+ if (addEntity && !(entity instanceof EntityHuman) && !this.world.addEntityChunk(entity)) {
|
||||
+ // CraftBukkit end
|
||||
if (list == null) {
|
||||
list = Lists.newArrayList(new Entity[] { entity});
|
||||
} else {
|
||||
@@ -476,7 +496,7 @@
|
||||
@@ -476,7 +493,7 @@
|
||||
long i = playerchunk.h().pair();
|
||||
|
||||
playerchunk.getClass();
|
||||
@ -102,7 +90,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -493,7 +513,7 @@
|
||||
@@ -493,7 +510,7 @@
|
||||
return Either.left(chunk);
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -111,7 +99,7 @@
|
||||
});
|
||||
|
||||
completablefuture1.thenAcceptAsync((either) -> {
|
||||
@@ -507,7 +527,7 @@
|
||||
@@ -507,7 +524,7 @@
|
||||
return Either.left(chunk);
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -120,7 +108,7 @@
|
||||
});
|
||||
return completablefuture1;
|
||||
}
|
||||
@@ -517,8 +537,14 @@
|
||||
@@ -517,8 +534,14 @@
|
||||
}
|
||||
|
||||
public void saveChunk(IChunkAccess ichunkaccess) {
|
||||
@ -136,7 +124,7 @@
|
||||
try {
|
||||
this.world.checkSession();
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
@@ -569,9 +595,10 @@
|
||||
@@ -569,9 +592,10 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.h();
|
||||
Packet<?>[] apacket = new Packet[2];
|
||||
|
||||
@ -148,7 +136,7 @@
|
||||
boolean flag1 = i1 <= this.A;
|
||||
|
||||
this.sendChunk(entityplayer, chunkcoordintpair, apacket, flag, flag1);
|
||||
@@ -626,7 +653,7 @@
|
||||
@@ -626,7 +650,7 @@
|
||||
private NBTTagCompound f(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
@ -157,7 +145,7 @@
|
||||
}
|
||||
|
||||
boolean d(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -946,7 +973,7 @@
|
||||
@@ -946,7 +970,7 @@
|
||||
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
@ -166,7 +154,7 @@
|
||||
this.tracker = entity;
|
||||
this.trackingDistance = i;
|
||||
this.e = SectionPosition.a(entity);
|
||||
@@ -1015,6 +1042,17 @@
|
||||
@@ -1015,6 +1039,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user