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

This commit is contained in:
DerFrZocker 2022-09-28 20:09:43 +10:00 committed by md_5
parent c2c39089eb
commit 93061706eb
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -41,7 +41,7 @@
Objects.requireNonNull(spawnercreature_d); Objects.requireNonNull(spawnercreature_d);
SpawnerCreature.c spawnercreature_c = spawnercreature_d::canSpawn; 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); entityinsentient.moveTo(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (isValidPositionForMob(worldserver, entityinsentient, d2)) { if (isValidPositionForMob(worldserver, entityinsentient, d2)) {
groupdataentity = entityinsentient.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); groupdataentity = entityinsentient.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
@ -50,7 +50,8 @@
- worldserver.addFreshEntityWithPassengers(entityinsentient); - worldserver.addFreshEntityWithPassengers(entityinsentient);
- spawnercreature_a.run(entityinsentient, ichunkaccess); - spawnercreature_a.run(entityinsentient, ichunkaccess);
+ // CraftBukkit start + // 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()) { + if (!entityinsentient.isRemoved()) {
+ ++j; + ++j;
+ ++k1; + ++k1;
@ -60,7 +61,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) { if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return; return;
} }
@@ -384,7 +410,7 @@ @@ -384,7 +411,7 @@
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) { if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null); groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@ -69,7 +70,7 @@
flag = true; flag = true;
} }
} }
@@ -505,8 +531,10 @@ @@ -505,8 +532,10 @@
return this.unmodifiableMobCategoryCounts; return this.unmodifiableMobCategoryCounts;
} }