Skip to content

Fix early client lifecyle events and introduce ClientResourceLoadFinishedEvent. The NeoForge event bus also starts earlier now. #2104

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

Open
wants to merge 2 commits into
base: 1.21.x
Choose a base branch
from

Conversation

shartte
Copy link
Contributor

@shartte shartte commented Apr 2, 2025

This fixes #2096, since the event will be dropped while the NeoForge event bus has not yet been started.
The fix for that is starting the event bus earlier, which introduces the problem of tick events being fired before the game has finished loading (the demarcation for this in Vanilla is the completion of the first resource load).

To then fix that problem, the tick events are now only emitted if Vanilla considers the game to be fully loaded.

Additionally, at that precise location we introduce a new event that allows mods to react to the first successful (or any subsequent successful) resource loads (ClientResourceLoadFinishedEvent).

@shartte shartte added bug A bug or error enhancement New (or improvement to existing) feature or request 1.21.5 Targeted at Minecraft 1.21.5 labels Apr 2, 2025
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Apr 2, 2025

  • Publish PR to GitHub Packages

Last commit published: 81a3e3f306440067fd474af38be2da54cb32be2b.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #2104' // https://github.com/neoforged/NeoForge/pull/2104
        url 'https://prmaven.neoforged.net/NeoForge/pr2104'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr2104.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr2104
cd NeoForge-pr2104
curl -L https://prmaven.neoforged.net/NeoForge/pr2104/net/neoforged/neoforge/21.5.25-beta-pr-2104-feature-earlier-bus-startup/mdk-pr2104.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

…shedEvent. The NeoForge event bus also starts earlier now.
@shartte shartte force-pushed the feature/earlier-bus-startup branch from 16b83d3 to 08739ca Compare April 2, 2025 20:10
…shedEvent. The NeoForge event bus also starts earlier now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.5 Targeted at Minecraft 1.21.5 bug A bug or error enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.21.5] Unable to listen to ClientStartedEvent
1 participant