SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2022-09-28 20:09:43 +10:00
parent b42b04fecd
commit 34ab403aa0

View File

@ -41,7 +41,7 @@
Objects.requireNonNull(spawnercreature_d);
SpawnerCreature.c spawnercreature_c = spawnercreature_d::canSpawn;
@@ -200,10 +222,14 @@
@@ -200,10 +222,15 @@
entityinsentient.moveTo(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (isValidPositionForMob(worldserver, entityinsentient, d2)) {
groupdataentity = entityinsentient.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
@ -50,7 +50,8 @@
- worldserver.addFreshEntityWithPassengers(entityinsentient);
- spawnercreature_a.run(entityinsentient, ichunkaccess);
+ // CraftBukkit start
+ worldserver.addFreshEntityWithPassengers(entityinsentient, SpawnReason.NATURAL);
+ // SPIGOT-7045: Give ocelot babies back their special spawn reason. Note: This is the only modification required as ocelots count as monsters which means they only spawn during normal chunk ticking and do not spawn during chunk generation as starter mobs.
+ worldserver.addFreshEntityWithPassengers(entityinsentient, (entityinsentient instanceof net.minecraft.world.entity.animal.EntityOcelot && !((org.bukkit.entity.Ageable) entityinsentient.getBukkitEntity()).isAdult()) ? SpawnReason.OCELOT_BABY : SpawnReason.NATURAL);
+ if (!entityinsentient.isRemoved()) {
+ ++j;
+ ++k1;
@ -60,7 +61,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return;
}
@@ -384,7 +410,7 @@
@@ -384,7 +411,7 @@
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@ -69,7 +70,7 @@
flag = true;
}
}
@@ -505,8 +531,10 @@
@@ -505,8 +532,10 @@
return this.unmodifiableMobCategoryCounts;
}