fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Add ServerChunkEvents.Generate

Open jpenilla opened this issue 1 year ago • 1 comments

Add a new chunk generate event, fired alongside the chunk load event when a chunk is first upgraded to full status.

My use case for this is a world map mod, I need to know when new chunks are generated to map them. I don't need to map a chunk that is just loading, only generated, I have other hooks to re-map chunks when blocks change.

Until now I've used a mixin to accomplish this, however, this makes compatibility more difficult with mods like Moonrise that rewrite the chunk system.

Some additional context (Mojang mappings):

  • https://github.com/jpenilla/squaremap/commit/cbee307394cb417b4fcc9ac67fb1b0dd5b842070
  • https://github.com/Tuinity/Moonrise/blob/a70073ae3e64ddf77829ada3c05a4c7e3c81554d/fabric/src/main/java/ca/spottedleaf/moonrise/fabric/FabricHooks.java#L88
  • https://github.com/Tuinity/Moonrise/blob/a70073ae3e64ddf77829ada3c05a4c7e3c81554d/neoforge/src/main/java/ca/spottedleaf/moonrise/neoforge/NeoForgeHooks.java#L82

jpenilla avatar Oct 23 '24 23:10 jpenilla

Please add a tests for this, fine if its something simple such as a long line or maybe place a block somewhere.

modmuss50 avatar Oct 24 '24 09:10 modmuss50

I've added a simple logging-based test with instructions to verify behavior in the Javadoc.

jpenilla avatar Oct 24 '24 17:10 jpenilla