SPIGOT-6186: Canceling a CreatureSpawnEvent results in a "Unable to summon entity due to duplicate UUIDs" error
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
a(enumcreaturetype, worldserver, chunk, (entitytypes, blockposition, ichunkaccess) -> {
|
||||
return spawnercreature_d.a(entitytypes, blockposition, ichunkaccess);
|
||||
}, (entityinsentient, ichunkaccess) -> {
|
||||
@@ -147,10 +191,13 @@
|
||||
@@ -147,10 +191,14 @@
|
||||
entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (a(worldserver, entityinsentient, d2)) {
|
||||
groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
|
||||
@@ -81,7 +81,8 @@
|
||||
- worldserver.addAllEntities(entityinsentient);
|
||||
- spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL)) {
|
||||
+ worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL);
|
||||
+ if (!entityinsentient.dead) {
|
||||
+ ++j;
|
||||
+ ++k1;
|
||||
+ spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
@@ -90,7 +91,7 @@
|
||||
if (j >= entityinsentient.getMaxSpawnGroup()) {
|
||||
return;
|
||||
}
|
||||
@@ -333,7 +380,7 @@
|
||||
@@ -333,7 +381,7 @@
|
||||
|
||||
if (entityinsentient.a((GeneratorAccess) worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) worldaccess)) {
|
||||
groupdataentity = entityinsentient.prepare(worldaccess, worldaccess.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
|
||||
@@ -99,7 +100,7 @@
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
@@ -456,8 +503,10 @@
|
||||
@@ -456,8 +504,10 @@
|
||||
return this.d;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user