Skip to content

Fix resource packs being reset on startup (symlink packs included)#31

Open
Eldrinn-Elantey wants to merge 1 commit intomasterfrom
fix/resourcepack-reset-on-startup
Open

Fix resource packs being reset on startup (symlink packs included)#31
Eldrinn-Elantey wants to merge 1 commit intomasterfrom
fix/resourcepack-reset-on-startup

Conversation

@Eldrinn-Elantey
Copy link

Problem

On client startup, enabled resource packs could be reset, which was especially visible with symlink-based packs.
This also broke expected font behavior because fonts are cached during startup.

Root cause

MinecraftDisplayer performed early resource operations with:

  • fragile reflection that could target the wrong List field in Minecraft
  • multiple mc.refreshResources() calls during startup phase

This could disturb resource-pack selection state.

Fix

  • Replaced getOnlyList() with getDefaultResourcePackList():
    • first tries defaultResourcePacks / field_110449_ao
    • fallback: finds the list containing mc.mcDefaultResourcePack
  • Removed unnecessary early mc.refreshResources() calls
  • Kept BLS resource-pack injection/removal scoped to defaultResourcePacks with safety checks

Verification

  • Compiles successfully: ./gradlew compileJava -x test
  • Manual check: startup no longer resets selected packs, including symlink packs

Impact

Low risk, targeted to startup resource-pack handling in BLS only.

Avoid resetting selected resource packs during BetterLoadingScreen startup.

- replace fragile reflection that grabbed an arbitrary List field in Minecraft
  with targeted lookup of defaultResourcePacks (and SRG fallback)
- add safe fallback that detects the default pack list by mcDefaultResourcePack
- stop calling mc.refreshResources() during early loading path
- inject/remove BLS pack only through defaultResourcePacks with null/dup checks

Result: selected packs (including symlink-based packs) are no longer dropped on startup.
@Eldrinn-Elantey Eldrinn-Elantey requested a review from a team March 1, 2026 16:11
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