3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00

Initialize entity data before spawning them. Fixes BUKKIT-3209

Vanilla does the initialize before spawning everywhere except in the
SpawnerCreature, our spawn event depends on this behavior to be
consistent.
Dieser Commit ist enthalten in:
feildmaster 2013-01-16 22:37:09 -06:00
Ursprung b581068464
Commit 315127782a

Datei anzeigen

@ -154,9 +154,10 @@ public final class SpawnerCreature {
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.canSpawn()) { if (entityliving.canSpawn()) {
++j2; ++j2;
// CraftBukkit - added a reason for spawning this creature // CraftBukkit start - added a reason for spawning this creature, moved a(entityliving, world...) up
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
a(entityliving, worldserver, f, f1, f2); a(entityliving, worldserver, f, f1, f2);
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
// CraftBukkit end
if (j2 >= entityliving.bv()) { if (j2 >= entityliving.bv()) {
continue label110; continue label110;
} }
@ -199,7 +200,6 @@ public final class SpawnerCreature {
} }
private static void a(EntityLiving entityliving, World world, float f, float f1, float f2) { private static void a(EntityLiving entityliving, World world, float f, float f1, float f2) {
if (entityliving.dead) return; // CraftBukkit
entityliving.bG(); entityliving.bG();
} }
@ -236,9 +236,10 @@ public final class SpawnerCreature {
} }
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F);
// CraftBukkit - added a reason for spawning this creature // CraftBukkit start - added a reason for spawning this creature, moved a(entity, world...) up
world.addEntity(entityliving, SpawnReason.CHUNK_GEN);
a(entityliving, world, f, f1, f2); a(entityliving, world, f, f1, f2);
world.addEntity(entityliving, SpawnReason.CHUNK_GEN);
// CraftBukkit end
flag = true; flag = true;
} }