Jump to content

Mods Can Changing Assets Folder Location of a mod?


jredfox

Recommended Posts

Hi I was investigating why and how buildcraft's modid was "BuildCraft|Robotics"  when their folder destination was buildcraftrobotics. 

 

I Need to know how mods are doing this so I can add support for some of my mods comparing if a mod is loaded? Why: I save the modid toFileCharacters() my own method it basically removes any invalid characters "*/<>?\":|" + "\\" along with some specific os windows names. For instance buildcraft would be incompatible since it would say this mod isn't loaded "BuildCraft|Robotics" when the name is "BuildCraftRobotics"

 

Capture.PNG

Edited by jredfox
Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

A mod can use whatever resource domain it wants. It can even use multiple.

"examplemod?" causes a crash for invalid character "?" in 1.12 but, buildcraft got away with this somehow maybe it's because I was looking at the earlier buildcraft but, it did get away with this. The modid was like Buildcraft|Robotics with invalid char of "|" and the assets folder was toLowerCase() and invalid chars removed? Did forge use to have a safeguard?

Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

Yes, the resource domain needs to be valid of course...

 

The modid and the resource domain are not related. The resource domains is not computed from the mod id. Forge simply registers mods as resource packs, which loads any resource domains present in the pack. Those can then be used in game. If a mod with mod id "examplemod" wants to use the resource domain "elephant", it can do so.

well where does a mod specify it's resource domain? just curious

Also does this mean I can register an item with "blizzardfox:23"  when blizzardfox mod isn't loaded or do registry names get tied to mod ids? 

Edited by jredfox
Link to comment
Share on other sites

1 minute ago, diesieben07 said:

Whenever it uses it, i.e. when creating a ResourceLocation or ModelResourceLocation instance. It defaults to the mod id, but it can be specified manually.

 

Yes, you can, but it will create a big warning in the console and you should not do it (unless you are intentionally overwriting an existing item).

but, the mod doesn't exist if the domain doesn't exist I would except forge to throw a crash writing to them as an enhancement for them to do. I think since they already enforce toLowerCase() they should also enforce that it has to be a valid modid not necessarily yours.

Link to comment
Share on other sites

2 hours ago, diesieben07 said:

Whenever it uses it, i.e. when creating a ResourceLocation or ModelResourceLocation instance. It defaults to the mod id, but it can be specified manually.

 

Yes, you can, but it will create a big warning in the console and you should not do it (unless you are intentionally overwriting an existing item).

It's fine I will just have to manually handle per mod that stores modid as file name toFileCharacters for everything I guess

Link to comment
Share on other sites

6 minutes ago, diesieben07 said:

Question is... what are you trying to achieve?

Well I was trying to achieve validations and optimizations by skipping invalid config/line entries. So Basically in dungeon tweaks I will use this as an example:

 

Example: when a mod loads up with say twilight forest and then you take the mod out, I don't expect it to be loading twilight forest config file if the mod isn't loaded. My mod generates all modids that have entities into files for users to edit to be parsed for dungeon tweaks.

The issue comes into play when  the mod would always skip parsing the mod generated file even when the mod was loaded. I wasn't comparing to file characters so it would return false with buildcraft and never parse it. Even if it parsed the file the other validation occurred. 

 

Solution: patch dungeon tweaks and manually handle it per mod that auto generates files like this

Edited by jredfox
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.