SPIGOT-3165: Only increment spawncount when mob spawn succeeds

This commit is contained in:
md_5 2017-04-06 21:31:27 +10:00
parent 41a7d14f8c
commit 1f6c04c0f4

View File

@ -83,16 +83,21 @@
int i2 = blockposition1.getX();
int j2 = blockposition1.getY();
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);
if (entityinsentient.canSpawn()) {
++l2;
- ++l2;
- 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 {
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);