Skip to content
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

Document valid characters for logoFile in neoforge.mods.toml #157

Closed
cpburnz opened this issue Aug 23, 2024 · 2 comments
Closed

Document valid characters for logoFile in neoforge.mods.toml #157

cpburnz opened this issue Aug 23, 2024 · 2 comments
Labels
addition Adding or rewriting information.

Comments

@cpburnz
Copy link

cpburnz commented Aug 23, 2024

The documentation for logoFile in neoforge.mods.toml on the Mod Files page makes no mention of the valid characters for logoFile. I was told on Discord the valid characters are lowercase letters, digits, dashes, periods, and underscores. Since uppercase letters were supported in Forge (in my experience), it may be beneficial to note what they are.

If you attempt to use uppercase letters in logoFile, Minecraft will crash when viewing the mod information with an error similar to:

java.lang.IllegalArgumentException: Illegal segment Mod_Logo.png in path [Mod_Logo.png]
    at TRANSFORMER/[email protected]/net.minecraft.FileUtil.validatePath(FileUtil.java:175) ~[client-1.20.6-20240429.153634-srg.jar%23172!/:?] {re:classloading}
    at TRANSFORMER/[email protected]/net.minecraft.server.packs.PathPackResources.getRootResource(PathPackResources.java:43) ~[client-1.20.6-20240429.153634-srg.jar%23172!/:?] {re:classloading}
    ...

This was tested in NeoForge 20.6.119 and 20.4.237.

@sciwhiz12 sciwhiz12 added the addition Adding or rewriting information. label Aug 24, 2024
@sciwhiz12
Copy link
Member

The reason uppercase characters worked in the past was because NeoForge used to have its own class net.neoforged.neoforge.resource.PathPackResources which powered the resource-handling for mod JARs, and was consequently used when getting the logo file from the mod JAR as a root resources.

However in #284 / 1.20.2, we removed that class in favor of vanilla's own implementation in net.minecraft.server.packs.PathPackResources. In doing so, we inherited the restrictions of the vanilla class, which includes enforcing essentially the same restrictions on regular resources (accessed by resource location) on root resources (accessed by string paths) -- only lowercase letters, digits, underscore, periods, and hyphens.

@ChampionAsh5357
Copy link
Contributor

Closed by #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition Adding or rewriting information.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants