Skip to content

Warn staff when the resource pack has a texture over 16384 px - #42

Merged
JustinasLa merged 2 commits into
mainfrom
feat/pack-texture-guard
Oct 10, 2026
Merged

JustinasLa merged 2 commits into
mainfrom
feat/pack-texture-guard

Conversation

@JustinasLa

Copy link
Copy Markdown
Contributor

Why

ItemsAdder's legacy armour atlas grew to 16448 px. Most Intel graphics can't load textures over 16384 px, so the whole pack failed for those players (FAILED_RELOAD, then a client crash), and nobody noticed until a player couldn't join. TLibs now drops that atlas (TF-Minecraft/TLibs, fix/drop-legacy-armour-atlas); this guard catches the next oversized texture, whatever its source.

What

  • PackTextureGuard checks ItemsAdder/output/generated.zip every 30 s and scans it once per new build, reading only each PNG's header (works on ItemsAdder's protected entries).
  • Any texture over the limit is logged at SEVERE with the full list, and online and joining staff (tfmccore.admin) get a red chat warning until a fixed pack is built.
  • resource-pack.max-texture-size (default 16384; 0 turns it off). Registered whenever ItemsAdder is enabled, independent of multipart delivery.

Testing

  • mvn clean verify (JDK 21): 743 tests, 100% line coverage.
  • TFMCDev01: on startup with the old pack it logged The resource pack has 16 textures over 16384 px and listed all 16 atlas copies; after the TLibs fix and iazip, the rebuilt pack produced no warning.

Most Intel graphics can't load textures over 16384 px, and one such texture
stops the whole pack loading for those players (FAILED_RELOAD, then a
client crash). ItemsAdder's legacy armour atlas reached 16448 px this way
without anyone noticing until a player couldn't join.

PackTextureGuard reads the image header of every PNG in
ItemsAdder/output/generated.zip once per build and, when one is too large,
logs every offender at SEVERE and messages online and joining staff
(tfmccore.admin). resource-pack.max-texture-size sets the limit; 0 turns
the check off.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b69ba43a-6590-4d15-8e1c-5d32279ead86

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…id-scan

A scan that finishes after the plugin disabled no longer publishes or
schedules anything, and a scheduler rejection during disable is ignored.
The pack's stamp is read again after scanning; if ItemsAdder rewrote it
meanwhile, the result is dropped and the final file is scanned next time.
@JustinasLa

Copy link
Copy Markdown
Contributor Author

CodeRabbit skipped this PR (manual review required), so GPT-6 Astra cross-reviewed it (Claude Opus wrote it). Nothing blocking. Outcome:

  • P3 an in-flight scan can schedule after plugin disable: fixed. close() sets a flag checked before anything is published, and an IllegalPluginAccessException from the scheduler during the disable race is caught. Test added.
  • A pack rewritten during a scan can publish a mixed result: fixed. The size/mtime stamp is read again after scanning; if it changed, the result is dropped and the final file is scanned on the next check. Test added.
  • Rate-limited diagnostics for a persistently unreadable pack: not added; a pack that never reads also never gets served, which ItemsAdder and the multipart publisher already report.

Also confirmed by the review: thread safety of found/scanned, resource handling and cost on a 9000-PNG pack.

mvn clean verify (JDK 21): 745 tests, 100% line coverage.

@JustinasLa
JustinasLa merged commit 1fdd653 into main Oct 10, 2026
2 checks passed
@JustinasLa
JustinasLa deleted the feat/pack-texture-guard branch October 10, 2026 22:45
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