Skip to content

feat(pack-meta): add ForceLoadMeta and PackMetaReader - #24

Closed
Caedis wants to merge 8 commits into
masterfrom
caedis/forceload-packs
Closed

feat(pack-meta): add ForceLoadMeta and PackMetaReader#24
Caedis wants to merge 8 commits into
masterfrom
caedis/forceload-packs

Conversation

@Caedis

@Caedis Caedis commented Jun 28, 2026

Copy link
Copy Markdown
Member

Packs in resourcepacks/ can opt into auto-enabling on first boot via a txloader block in pack.mcmeta (forceLoad + priority top/bottom).
Enabled once, recorded in config/txloader/forceloaded.json. Player can then disable it permanently.
Edits options.txt before it is loaded

Verified in a real client.

Mainly going to be used for the GuideNH guides

Caedis added 8 commits June 27, 2026 19:43
Leaf parser for the txloader block in pack.mcmeta. Supports
directory and zip resource packs; returns empty Optional for
missing, absent-section, or malformed inputs.

Also wires JUnit 5 (test-only): gtnhconvention does not auto-
provide it, matching the pattern used by other GTNH projects.
Change parse() to accept Reader instead of InputStream. Caller now
owns the Reader lifecycle and wraps it in try-with-resources, while
parse() only calls fromJson() without closing. Prevents double-close
that occurs when both read() and parse() wrap the stream.

Add tests: zip pack with no pack.mcmeta entry, and Priority.fromString
case-insensitivity with null/unknown defaults.
Persists pack filename -> first-load timestamp in a JSON map so a
pack is force-enabled only once. Returns an empty, usable state on
missing or corrupt files.
Inserts pack filenames into the resourcePacks list of options.txt
without disturbing other settings. TOP appends (highest priority),
BOTTOM prepends; skips duplicates and creates the line/file if absent.
Scans resourcepacks/ on client startup, enables newly force-loaded
packs once via OptionsEditor, and records them in forceloaded.json.
Wired into the client path of TXLoaderCore.injectData.
Add a Force-loading resource packs section covering the txloader
block (forceLoad, priority) and the once-per-pack behavior.
OptionsEditor.enable now returns success; the handler records and
saves state only for packs actually written, so a failed write no
longer permanently marks a pack force-loaded without enabling it
(it retries next boot). Also preserve input order for multiple
bottom-priority packs and warn on an unparseable resourcePacks line.
@Caedis
Caedis requested a review from a team June 28, 2026 04:47
@Caedis Caedis added the Enhancement Improve an existing mechanic. Please explain the change with a before/after comparison. label Jun 28, 2026
@Caedis Caedis closed this Jun 29, 2026
@Caedis

Caedis commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

No longer needed with GTNewHorizons/GuideNH#33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Improve an existing mechanic. Please explain the change with a before/after comparison.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant