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

[1.12] How do I do mod dependencies?


TheGoldenProof
 Share

Recommended Posts

Not really sure how any of this dependency stuff works but I kind of have an idea. My build.gradle doesn't have a "jar" section, so do I add it my self? Where is /META-INF? I don't understand what this maven stuff is and a have a very vague understanding of what a repository is from submitting bug reports on git. I think the .meta file is just a manifest file, and forge will use the .meta files if the jar doesn't have one. It gets the groupId:artifactId:version thing so it can be archived. What does that mean? I have the jar file that I want to use as a dependency and i looked in its META-INF folder and looked at its MANIFEST.MF file and all it said was "Manifest-Version: 1.0" Does that mean that it was a poorly made mod and what do I do about it? Do i give it a custom maven coordinate (Is that what the groupId:... thing is called?)? I'm not sure where I go from here.

 

Also, if  when I successfully do this dependency extraction thing, it adds the mod to minecraft but not the mods folder, correct? How to I use the mod its dependent on while making my mod? I saw that you make a folder called libs and put it in there and do some build path thing to access its code, but will that add it to the client when i run it in eclipse or do I have to add it to the run/mods folder?

 

I tried to put all of my questions into one post as much as possible but I'm bound to have more.

 

This was originally here but I was told to put it into a new post

Edited by TheGoldenProof
Link to comment
Share on other sites

Thanks for making a new thread!

I don’t have that much experience with gradle, but I believe that META-INF is part of your compiled mod. I think that currently it is only used for access-transformers and core-mods, but I believe that the entire mod metadata (currently in mcmod.info) is going to be moved into it.

Edited by Cadiboo

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

META-INF file is used for ATs, doesn't have to do anything with Maven.

If you're using IntelliJ just add the .jar files to the libs folder and it will work, you will probably have to refresh gradle by using that button in gradle module,

If you're using Eclipse you have to add something to your gradle.build file for it to work

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) // For all .jar files in folder
    compile files('libs/file_name.jar') // For one .jar file in folder
}

The mod will be ran with the client too, adding it again to the mods folder will just cause a duplicate mods error.

 

NOTE: Make sure to use deobfuscated jar files.

Edited by Terrails
Link to comment
Share on other sites

1 hour ago, Terrails said:

META-INF file is used for ATs, doesn't have to do anything with Maven.

If you're using IntelliJ just add the .jar files to the libs folder and it will work, you will probably have to refresh gradle by using that button in gradle module,

If you're using Eclipse you have to add something to your gradle.build file for it to work


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) // For all .jar files in folder
    compile files('libs/file_name.jar') // For one .jar file in folder
}

The mod will be ran with the client too, adding it again to the mods folder will just cause a duplicate mods error.

 

NOTE: Make sure to use deobfuscated jar files.

This is not what the question is about.

 

@TheGoldenProof

If your dependency is just a regular dependency, without following the Forge format for that (it does not have the Maven-Artifact manifest entry), then you can add this manually, by putting the manifest for the dependency in your own manifest (described in the last paragraph of the documentation).

You also need the ContainedDeps manifest attribute (in your own manifest), that specifies which jar files (inside your own jar) are contained dependencies.

 

All this is described in the documentation. If you have specific questions, please ask.

Link to comment
Share on other sites

so the {addedMod}.meta would be the manifest for the new mod. where is the manifest for my mod?

and where does the {addedMod}.meta go? src/main/resources

 

i dont really know what a manifest is still and dont understand how to make one and how to give it maven coordinates.

 

EDIT

kind of figuring things out. Once I make my jar file, I have to open it and edit the MANIFEST.MF in /META-INF and put 

jar {
    manifest {
        attributes("Implementation-Title": "Gradle",
                   "Implementation-Version": version,
					"ContainedDeps": "name of jar file in /META_INF/libraries",)
    }
}

and then in the mods {addedMod}.meta I put

jar {
    manifest {
        attributes("Implementation-Title": "Gradle",
                   "Implementation-Version": version,
				   "Maven-Artifact": "Maven artifact name thing")
    }
}

 

the part im confused about:

did Terrails say that i can just put 

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) // For all .jar files in folder
    compile files('libs/file_name.jar') // For one .jar file in folder
}

into my build.gradle and it will also do what im trying to do without any of this manifest stuff?

 

ANOTHER EDIT

Couldn't figure out how to do it and i finally got the manifest to have the properties in it but minecraft immediately crashed saying that the mod wasnt there. I forgot to put it in. I extracted the jar and put it in and zipped and renamed it, minecraft couldn't read it. Finally, i realized that 7zip lets you create folders and add files to an archive without having to extract it first and now it all works.

 

Thanks for the help :)

Edited by TheGoldenProof
Link to comment
Share on other sites

14 hours ago, TheGoldenProof said:

Once I make my jar file, I have to open it and edit the MANIFEST.MF in /META-INF and put 

No... no no no! That code you quoted goes in yourbuild.gradle and it will set the manifest for you. You do not need to edit your jar manually.

 

14 hours ago, TheGoldenProof said:

and then in the mods {addedMod}.meta I put

No. This is just a normal file you put in your resources directory (src/main/resources).

 

The jar file can also be added to the final jar using Gradle.

Link to comment
Share on other sites

Can you mark your topic as solved and post your final solution for future people please?

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

  • 4 months later...
  • 2 weeks later...

 

Hello I have some problems with the dependencies, I do not understand what must be put exactly in the build.gradle I put the mod with which I want to work (Immersive Engineering) in build / libs and I added that in the build.gradle:

 

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) // For all .jar files in folder
    compile files('libs/file_name.jar') // For one .jar file in folder
}

 

But once that is done then the command "gradlew setupDecompWorkspace" the mod is not added in the workspace once the project launched with Eclipse.

Link to comment
Share on other sites

This topic is about putting dependencies inside your finished mod and has nothing to do with your problem. Please create your own topic and include the version your are writing your mod for. You shouldn't need any of that in your build.gradle, everything from /libs/ is added automatically.

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

26 minutes ago, Cadiboo said:

This topic is about putting dependencies inside your finished mod and has nothing to do with your problem. Please create your own topic and include the version your are writing your mod for. You shouldn't need any of that in your build.gradle, everything from /libs/ is added automatically.

 

Excuse me this is the first time I ask for help on MinecraftForge forums thank you very much

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