Skip to content

Add chunk forceloading to keep mobs active without players#28

Merged
Sharkblack3D merged 1 commit into
mainfrom
claude/farm-zone-management-system-mTHw3
Apr 21, 2026
Merged

Add chunk forceloading to keep mobs active without players#28
Sharkblack3D merged 1 commit into
mainfrom
claude/farm-zone-management-system-mTHw3

Conversation

@Sharkblack3D
Copy link
Copy Markdown
Collaborator

Even with setPersistent(true), mobs despawn if their chunks are unloaded (which happens when no players are nearby). Solution: forceload all chunks within spawning regions when the first spawn cycle begins.

  • ensureChunksForceloaded(): called before each spawnBatch, forceloads all region chunks once (idempotent via zoneKey tracking)
  • On stop(), all forceloaded chunks are released (setForceLoaded(false))
  • Ensures consistent mob activity in farm zones regardless of player proximity
  • Mobs stay active, despawn logic doesn't run, mob AI processes normally

This guarantees the contracted behavior: "continué à être actif" (remain active).

https://claude.ai/code/session_01QRahgKn43HbgkmDkQZCq9Z

Even with setPersistent(true), mobs despawn if their chunks are unloaded
(which happens when no players are nearby). Solution: forceload all chunks
within spawning regions when the first spawn cycle begins.

- ensureChunksForceloaded(): called before each spawnBatch, forceloads all
  region chunks once (idempotent via zoneKey tracking)
- On stop(), all forceloaded chunks are released (setForceLoaded(false))
- Ensures consistent mob activity in farm zones regardless of player proximity
- Mobs stay active, despawn logic doesn't run, mob AI processes normally

This guarantees the contracted behavior: "continué à être actif" (remain active).

https://claude.ai/code/session_01QRahgKn43HbgkmDkQZCq9Z
@Sharkblack3D Sharkblack3D merged commit a723f1f into main Apr 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants