Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

TOML File question about ${}


American2050
 Share

Recommended Posts

So I'm slowly getting back into modding for 1.14.4 and of course, a lot of things have changed and I have many questions for sure and will have even more.

 

This is a simple one to get more information about the TOML file. We can read on it:

 

# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${file.jarVersion}" #mandatory

 

What are and where can I find the "well known" ${} variables.

 

And what would be the best way to not hardcode that value but be able to read it from one of the .java files in my mod structure?

 

Link to comment
Share on other sites

34 minutes ago, American2050 said:

What are and where can I find the "well known" ${} variables.

See the StringSubstitutor class resp. ModFile#getSubstitutionMap.

 

35 minutes ago, American2050 said:

And what would be the best way to not hardcode that value but be able to read it from one of the .java files in my mod structure?

file.jarVersion refers to the Implementation-Version manifest property of your mod jar file.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Is it common that when running from within IntelliJ it just comes as "NONE" I assume it's because we don't have a jar file yet.

 

But on my mods.toml file I have

version="${file.jarVersion}"

 

and on build.gradle I have this

 

version = '1.0'
group = 'mramericanmike.terracottaworld' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'TerracottaWorld'

jar {
    manifest {
        attributes([
            "Specification-Title": "terracottaworld",
            "Specification-Vendor": "mramericanmike",
            "Specification-Version": "1", // We are version 1 of ourselves
            "Implementation-Title": project.name,
            "Implementation-Version": "${version}",
            "Implementation-Vendor" :"mramericanmike",
            "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

 

I think it should be good to work like that right? I'm not taking the value from a java file, but at least it will update when I change it for the build.

Link to comment
Share on other sites

I use the processResources block to substitute in my version.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.