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

SPIGOT-3165: Only increment spawncount when mob spawn succeeds

Dieser Commit ist enthalten in:
md_5 2017-04-06 21:31:27 +10:00
Ursprung 41a7d14f8c
Commit 1f6c04c0f4

Datei anzeigen

@ -83,16 +83,21 @@
int i2 = blockposition1.getX(); int i2 = blockposition1.getX();
int j2 = blockposition1.getY(); int j2 = blockposition1.getY();
int k2 = blockposition1.getZ(); int k2 = blockposition1.getZ();
@@ -126,7 +159,7 @@ @@ -125,8 +158,11 @@
if (entityinsentient.cM() && entityinsentient.canSpawn()) {
groupdataentity = entityinsentient.prepare(worldserver.D(new BlockPosition(entityinsentient)), groupdataentity); groupdataentity = entityinsentient.prepare(worldserver.D(new BlockPosition(entityinsentient)), groupdataentity);
if (entityinsentient.canSpawn()) { if (entityinsentient.canSpawn()) {
++l2; - ++l2;
- worldserver.addEntity(entityinsentient); - worldserver.addEntity(entityinsentient);
+ worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature + // CraftBukkit start
+ if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) {
+ ++l2;
+ }
+ // CraftBukkit end
} else { } else {
entityinsentient.die(); entityinsentient.die();
} }
@@ -226,8 +259,10 @@ @@ -226,8 +262,10 @@
} }
entityinsentient.setPositionRotation((double) ((float) j1 + 0.5F), (double) blockposition.getY(), (double) ((float) k1 + 0.5F), random.nextFloat() * 360.0F, 0.0F); entityinsentient.setPositionRotation((double) ((float) j1 + 0.5F), (double) blockposition.getY(), (double) ((float) k1 + 0.5F), random.nextFloat() * 360.0F, 0.0F);