Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ServerChunkEvents.Generate #4183

Merged
merged 3 commits into from
Oct 26, 2024
Merged

Conversation

jpenilla
Copy link
Contributor

@jpenilla jpenilla commented Oct 23, 2024

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):

@modmuss50
Copy link
Member

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

@modmuss50 modmuss50 added the enhancement New feature or request label Oct 24, 2024
After creating an SP world and waiting for all nearby chunks to generate (logging to stop), closing the SP world and opening it again should not log any fresh generation. Moving to an unexplored area will start logging again.
@jpenilla
Copy link
Contributor Author

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

@modmuss50 modmuss50 added last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge labels Oct 24, 2024
@modmuss50 modmuss50 merged commit 4402f4e into FabricMC:1.21.3 Oct 26, 2024
4 checks passed
modmuss50 pushed a commit that referenced this pull request Oct 26, 2024
* Add a new chunk generate event, fired alongside the chunk load event when a chunk is first upgraded to full status

* fix style

* Add logging test for generate event

After creating an SP world and waiting for all nearby chunks to generate (logging to stop), closing the SP world and opening it again should not log any fresh generation. Moving to an unexplored area will start logging again.

(cherry picked from commit 4402f4e)
ishland added a commit to RelativityMC/C2ME-fabric that referenced this pull request Oct 27, 2024
ishland added a commit to RelativityMC/C2ME-fabric that referenced this pull request Oct 27, 2024
ishland added a commit to RelativityMC/C2ME-neoforge that referenced this pull request Oct 28, 2024
Upstream has released updates that appear to apply and compile correctly

Upstream Changes:
f9c250b3 new: call ServerChunkEvents.CHUNK_GENERATE (FabricMC/fabric#4183)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants