Skip to content

Delay the initial setScreen call.#747

Open
Acuadragon100 wants to merge 2 commits intoKiltMC:version/1.20.1from
Acuadragon100:version/1.20.1-fire-early-screen-event
Open

Delay the initial setScreen call.#747
Acuadragon100 wants to merge 2 commits intoKiltMC:version/1.20.1from
Acuadragon100:version/1.20.1-fire-early-screen-event

Conversation

@Acuadragon100
Copy link
Copy Markdown
Contributor

Some Forge mods like Aether and Aether addons like to replace the menu screen using the opening screen event.

Only problem is that on Fabric the screen is set before the mods are initialized, which means they never receive the first screen opening event. On Forge, the game is patched to move this code into the end of method_29338 (the lambda inside the constructor of Minecraft that runs after the loading overlay is done). So I basically just replicated this with mixins that store the setScreen call in a variable until the forge mods have been initialized and runs it then. I specifically chose to put this in a separate mixin with a lower priority so that any Fabric mods wrapping the setScreen function calls with @WrapOperation will still run at the original time.

// Use lower priority for screen delay. This gives priority to Fabric mods,
// allowing them to set their menu screen without interference from the Forge event.
@Mixin(value = Minecraft.class, priority = 500)
public static class Early {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer for this to be brought into Kilt's own mixin classes rather than the injects package. Prefer the name to stay as MinecraftMixin, following a convention for the mixin package, maybe under mixin.workarounds.early_screen_delay?

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