Skip to content

Fire Fabric chunk load/unload events from NeoForge's chunk events - #303

Open
jpenilla wants to merge 1 commit into
Sinytra:26.1.2from
jpenilla:neo-chunk-events
Open

jpenilla wants to merge 1 commit into
Sinytra:26.1.2from
jpenilla:neo-chunk-events

Conversation

@jpenilla

@jpenilla jpenilla commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Fires ServerChunkEvents.CHUNK_LOAD, CHUNK_GENERATE and CHUNK_UNLOAD from NeoForge's ChunkEvent.Load/Unload (server levels only) instead of the vanilla injections in ChunkStatusTasks and ChunkMap. Mods that replace vanilla's chunk system and post NeoForge's events themselves, such as Moonrise, then get the Fabric events too. See #302.

  • ChunkEvent.Load is posted at the end of the same ChunkStatusTasks.full lambda the old injection targeted, and isNewChunk() uses the same !(protoChunk instanceof ImposterProtoChunk) check as generated.
  • ChunkMapMixin is removed. CHUNK_UNLOAD now fires after the chunk is saved, as NeoForge's ChunkEvent.Unload does, rather than before.
  • The initial FULL_CHUNK_STATUS_CHANGE transitions are still fired from ChunkStatusTasksMixin; NeoForge has no equivalent event.

Tested on a 26.1.2 dedicated server by counting events for one chunk through generate, unload, reload and server stop:

load / generate / unload / full status change
before, without Moonrise 2 / 1 / 2 / 12
after, without Moonrise 2 / 1 / 2 / 12
before, with Moonrise 0 / 0 / 0 / 0
after, with Moonrise 2 / 1 / 2 / 0

LoadedChunksCache tracks the chunk correctly in both "after" runs. Full status changes with Moonrise are left for Moonrise to handle.

This branch has not been deployed

No deployments
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.

1 participant