Natural spawning runtime
Server spawn selection, conservative vanilla integration and ordinary-slime combat contracts.
internal.spawning owns server data and spawn-pool composition. internal.slime owns ordinary-slime combat; neither package is a public facade. Gameplay and authoring are covered in natural spawning and natural spawning data.
What it does
NaturalSpawnHelperMixin modifies the returned natural-spawn pool, selected height and new-chunk creature probability. NaturalSpawnCadenceMixin changes the creature timing divisor in ServerChunkManager.tickChunks. The vanilla scheduler, population accounting, spawn restrictions, collision checks and successful-spawn callbacks still run.
Rule entries affect live natural spawning. Chunk-generation entries remain biome-owned. This distinction avoids querying live entity density from generation workers; only the bounded generation probability reads the immutable settings snapshot there. No terrain, biome-generation or Reterraforged implementation is copied or replaced.
Runtime model
NaturalSpawnLoader reads the highest-priority resource for each definition ID, validates all files and publishes one immutable snapshot. Syntax and semantic failures throw before publication, leaving the previous snapshot active. Definitions are ordered by priority and then identifier, and indexed by dimension and spawn group. The definition lookup reads this index. Peaceful structure bounds use a separate chunk metadata cache.
For each viable live candidate, SpawnBoundary measures horizontal distance to the nearest applicable peaceful structure, Atelier landmark or garden rectangle. Its smoothstep multiplier rises from 0 to 1 over 32 blocks. The selected encounter rolls boundary, base-chance and kill-recovery admission once. Member validation is deterministic and counts living monsters up to the rounded-up scaled cap, including already staged cohort members.
Entry objects retain identity across pool queries. Vanilla checks membership again at the eventual group-member position, so changed biome, time or light conditions can reject a member. Local density checks run after vanilla candidate validation, query loaded entities in a bounded box and stop when the limit is reached. They count alive matching types or density-tag members, including persistent ones, within the same surface/cave habitat.
EncounterPlacement stages candidates with vanilla distance, type, instance and density checks; it publishes none unless the minimum group fits. Successful members share initialization data and run the normal spawn-accounting callback. EncounterMemory saves rule-keyed quiet cells. HabitatBudget counts eligible monsters during vanilla’s existing census, partitions the existing cap and accounts for successful spawns immediately. HostilePressureState saves only separate Surface and Caves lists; there is no reader for the retired shared Cells list.
FantasySlimeMixin applies only to EntityType.SLIME; magma cubes and other slime subclasses keep their goals and mechanics. SlimeHuntGoal runs the server state machine and vanilla navigation, while SlimeHopControl follows path waypoints with discrete hops. SlimeCombat owns wind-up, committed flight, hit gating and recovery. Goal-effect suspension interrupts the controller; faction friendship vetoes direct and projectile damage.
SlimeTier groups attributes, movement, pounce, ranged and special-attack tuning by size. SlimeAttackPlanner owns independent cooldowns and range eligibility without world access. Eligible specials precede ordinary attacks, with alternating priority when both are ready. Small and medium slimes pursue during ranged cooldowns; large slimes hold a visible target within firing range and beyond pounce range. Blocked sight or a target outside that band resumes navigation.
SlimeTrajectory solves a bounded ballistic intercept using the vanilla thrown-entity air recurrence: move, apply drag, then gravity. SlimeCombat samples target position changes on the server, smooths horizontal movement and rejects teleport-sized samples. Prediction is capped and sampled at release; projectiles never home. Pounce aim locks near the end of its warning, with distance-dependent launch speed and extra lift uphill. Hop impulses mark the entity airborne before vanilla travel computes friction, avoiding the first-tick ground drag that otherwise shortens the leap.
The phase and its world start tick are tracked to clients. SlimeTelegraphRendererMixin adds squash and stretch to the existing slime renderer using each tier’s actual warning and recovery durations; it performs no gameplay mutations. Combat timers are transient, so loading an entity starts a fresh idle combat controller. Size and vanilla attributes retain their normal entity persistence.
Contracts
The loader resolves rule-level spawn_chance into each added entry, with explicit entry values overriding it. NaturalSpawnHelperMixin intercepts pickRandomSpawnEntry only inside live spawnEntitiesInChunk; NaturalSpawning.encounter rolls once before vanilla chooses the group size. An empty result follows vanilla’s encounter-exit branch without an immediate replacement selection. Later members reuse the selected entry without another chance roll. Empty selections, chance 0 and chance 1 consume no additional random values. Pool construction, membership checks and ecology inspection never roll chance; unconfigured biome and structure entries pass through with chance 1.
| Boundary | Contract |
|---|---|
| Caps and attempts | No independent scheduler, cap increase, chunk ticket or despawn override. Configured encounters perform bounded placement within the selected vanilla attempt. |
| Pool ownership | Composition only occurs when the returned pool is the current biome’s own pool object. Structure pools and externally substituted pools pass through. |
| Composition | Merge edits selected types; replace clears the biome pool. Neither mode bypasses entity restrictions. |
| Generation | The probability override is at most 0.35. New-chunk entries and generation vetoes stay with vanilla and existing hooks. |
| Protected areas | Existing dungeon and landmark vetoes remain registered. The garden also rejects natural monster-group spawns beneath its footprint; other groups below remain eligible. |
| Size and collision | Configured slime size is installed after creation and before vanilla instance collision validation; initialisation retains that chosen size. |
| Death | Ordinary slimes skip splitting while still executing normal removal. The vanilla slime loot table is replaced with direct bounded drops. |
| Projectiles | Server collision owns damage and corrosion; globs have finite lifetime, no block damage and no persistence. |
| Damage attributes | Pounce and shockwave read GENERIC_ATTACK_DAMAGE at impact. Globs snapshot it at release, multiplied by the attack’s coefficient. No attack uses a fixed damage fallback. |
| Movement attributes | Travel hops read GENERIC_MOVEMENT_SPEED; committed pounces use the tier’s bounded trajectory. |
| Compatibility | Return-value composition preserves incoming pool results. A mod replacing the same slime goals or static spawn predicate still requires integration testing. |
SlimeTier contains prototype combat tuning. Natural spawn definitions configure encounters, group sizes and slime size; they do not configure combat timings. There is one current schema, with no aliases or migration reader.
The garden policy checks cached bounds before mob creation and again at server-world or chunk-region admission for tracked natural spawn reasons. It adds no chunk loads or entity scans. See Remote Sky Garden runtime for exact scope and exemptions.
Extending it
IsekaiCombatMob consumes optional entry group rules installed by NaturalSpawning.prepareMob. Its initialize method passes MobGroup.SpawnData through vanilla’s pack EntityData, preserving one identity and initial leader per pack. Group state persists on the entity; discovery reads at most 16 nearby loaded members every 40–46 ticks (2–2.3 seconds). Cohesion and visible-threat sharing run through Brain tasks. Expiring action reservations bound concurrent attackers without a static world registry. Custom species can override movement and add Brain tasks; the shared action program remains independent of body shape.
Add rules through data/<namespace>/natural_spawning/*.json and use biome tags for habitat membership. New custom palette IDs can join those tags without changing Java. Keep new environmental predicates inside SpawnConditions; validate both range ends and add boundary tests before exposing a field.
New slime attacks need eligibility and cooldown rules in SlimeAttackPlanner, plus warning and recovery transitions in SlimeCombat. Keep local damage checks on the server and communicate presentation through tracked phase data. Follow the slime gameplay contract when changing balance or drops.
Verifying
Run ./gradlew.bat compileJava and language assembly before checking spawning and slime combat in a test world.
In a server test world, compare fresh and explored plains, a lush elevated palette and lush caves. Check /ise ecology inspect creature with empty and saturated caps, /reload with invalid definitions, day and night, Peaceful difficulty, disabled mob spawning, dungeon worlds and protected settlements. Confirm that water creatures still require their own fluid restrictions.
For combat, test each size against a moving player, a shield, walls, slopes, water and a jumping target. Verify a single pounce hit, the brief recovery, turret range, repeated acid and shockwave attacks, no death splitting, direct drops and no acid equipment damage after a blocked hit. Change the attack damage attribute and confirm that pounce, both globs and shockwave scale with it. Reconnect during a wind-up, apply an AI-suspending status, test friendly factions and verify magma cubes separately. Dedicated-server startup, multiplayer presentation and play balance require a functioning installed modpack.
Related
Natural spawning data, slimes, terrain generation and Atelier structures describe the adjacent authoring and protection contracts.