Posted August 12, 20187 yr I've made two mods: Extracraft Core: this mod has my custom classes which inherit from Item and Block. Extracraft: This mod import that classes and with them creates items and blocks. I made this because I've planned in the future to make several mods and I don't want in each one have to make that classes, so I want to have a "core" mod which is used by all of them. The strange this is that when I try to compile the mods it produces to jars: Extracraft-1.0.jar Extracraft-1.0-sources.jar And if I drag the first file in the mod folder, both mods appear in Minecraft, so: It seems that the second file is useless. "Physically" in the mod folder there is only 1 jar, but "virtually" in the Minecraft mod button you can see 2 mods. So it seems that both mods get fussed in the same jar file. I compile them using "gradle.bat build" and in the build.gradle I wrote: version = "1.0" group = "net.enderlook.extracrafcore" archivesBaseName = "extracraftcore" If I let the values as default (com.example.modid) it also works but the file change of name... So my questions are: Is fine my idea of split the "common" code between my mods into a "core/lib/whatever" mod? Or is it a bit stupid/lazy? How can I split that .jar into two .jar (one for each mod)? What is the usage of Extracraft-1.0-sources.jar? If when I use "gradle.bat build" gradle compile all my mods, What would happen if I have a lot of mods? Is there a way to as gradle to only compile an specific mod? Thanks in advance!
August 12, 20187 yr 1 minute ago, Enderlook said: It seems that the second file is useless. Yes, because it contains unobfuscated source code. Hence the -sources in the file name 2 minutes ago, Enderlook said: "Physically" in the mod folder there is only 1 jar, but "virtually" in the Minecraft mod button you can see 2 mods. So it seems that both mods get fussed in the same jar file. Yes, because that's what your build.gradle file told gradle to do. This is how I split my jar file: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L153-L185 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
August 12, 20187 yr Author 10 hours ago, Draco18s said: Yes, because it contains unobfuscated source code. Hence the -sources in the file name Yes, because that's what your build.gradle file told gradle to do. This is how I split my jar file: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L153-L185 1 I've tried to do the same as you but it isn't working:: version = "1.0" group = "net.enderlook.extracraftcore" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "extracraftcore" // [...] task extracraftcore(type: Jar) { baseName = 'extracraftcore' from('etc/extracraftcore') { include '*.info','pack.mcmeta' expand 'version': '1.0', 'mcversion': project.minecraft.version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'net/enderlook/extracraftcore/**', 'assets/extracraftcore/**' exclude '**.xcf', 'net/enderlook/extracraft/**', 'assets/extracraft/**' } } task extracraft(type: Jar) { baseName = 'extracraft' from('etc/extracraft') { include '*.info','pack.mcmeta' expand 'version': '1.0', 'mcversion': project.minecraft.version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'net/enderlook/extracraft/**', 'assets/extracraft/**' exclude '**.xcf', 'net/enderlook/extracraftcore/**', 'assets/extracraftcore/**' } } extracraft.dependsOn('extracraftcore') task releaseJars(type: Copy) { from extracraftcore from extracraft //one of these lines crashes it? rename '-(.*)jar', '.jar' rename '-(.*)zip', '.zip' into '.' } task fullBuild(type: Delete) { delete jar } fullBuild.dependsOn('releaseJars') Also, I've noted something strange on your mod that I don't understand: Your "mcmod.info" is the default of forge (examplemod) (In my mcmod.info I've two dictionaries {}, one for extracraft and another for extracraftcore ).
August 12, 20187 yr 2 hours ago, Enderlook said: Also, I've noted something strange on your mod that I don't understand: Your "mcmod.info" is the default of forge (examplemod) (In my mcmod.info I've two dictionaries {}, one for extracraft and another for extracraftcore ). https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L156-L157 I pull the mcmod.info file from a different directory (that isn't on github). Not sure why it's not working off the top of my head. I know I had to mess around with things for a while before it worked. What you have looks just like what I have. Also: 2 hours ago, Enderlook said: //one of these lines crashes it? I think I get the same problem, but the output succeeds anyway. Check your build folder. Edit: May be that you need to run the right gradle command.gradlew build fullBuild 2 hours ago, Enderlook said: baseName = 'extracraftcore' I suggest including a version number like I do: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L154 The variables are defined towards the top: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L13-L22 That will let the output file have its version number in it. Edited August 12, 20187 yr by Draco18s Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
August 12, 20187 yr Author 6 hours ago, Draco18s said: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L156-L157 I pull the mcmod.info file from a different directory (that isn't on github). Not sure why it's not working off the top of my head. I know I had to mess around with things for a while before it worked. What you have looks just like what I have. Also: I think I get the same problem, but the output succeeds anyway. Check your build folder. Edit: May be that you need to run the right gradle command.gradlew build fullBuild I suggest including a version number like I do: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L154 The variables are defined towards the top: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/build.gradle#L13-L22 That will let the output file have its version number in it. Ok, I've changed just to try: baseName = 'extracraftcore-1.0' baseName = 'extracraft-1.0' And when I run "gradlew.bat build fullBuild" I get this error: FAILURE: Build failed with an exception. * What went wrong: Failed to create MD5 hash for file C:\Juegos\Minecraft\Codding\forge-1.12.2-14.23.4.2705-mdk\.gradle\2.14\taskArtifacts\cache.properties.lock. And then it says in Spanish something like "The process doesn't have access to the file because another process has blocked a part of the file". I don't know what to do
August 12, 20187 yr Never encountered that error before. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.