Jump to content

Recommended Posts

Posted

 

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:

  1. 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?
  2. How can I split that .jar into two .jar (one for each mod)?
  3. What is the usage of Extracraft-1.0-sources.jar?
  4. 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!

 

 

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

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

Posted (edited)
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 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.

Posted
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 :(

Posted

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So, I have a minecraft world hosted with essential on forge 1.20.1, there's 149 mods, and the forge version is 47.3.0, and it's been like that for a good 2-3 weeks, and all of a sudden, it stopped loading, and I have 0 clue as to why, and this world means A LOT to me, so if anyone out there is able to help, I would GLADLY appreciate it. here's the link if ya wanna help:   [04Dec2024 22:42:24.552] [Worker-ResourceReload-3/ERROR][net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener/]: Couldn't parse data file slabsexpanded:snow_blockblocktoslab from slabsexpanded:recipes/snow_blockblocktoslab.json com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected name at line 16 column 4 path $.result.item at net.minecraft.util.GsonHelper.m_13780_(GsonHelper.java:526) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.util.GsonHelper.m_263475_(GsonHelper.java:531) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.util.GsonHelper.m_13776_(GsonHelper.java:581) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_278771_(SimpleJsonResourceReloadListener.java:41) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_5944_(SimpleJsonResourceReloadListener.java:29) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_5944_(SimpleJsonResourceReloadListener.java:17) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimplePreparableReloadListener.m_10786_(SimplePreparableReloadListener.java:11) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 16 column 4 path $.result.item at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1657) ~[gson-2.10.jar%23107!/:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:514) ~[gson-2.10.jar%23107!/:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:422) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:779) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:1007) ~[gson-2.10.jar%23107!/:?] at net.minecraft.util.GsonHelper.m_13780_(GsonHelper.java:524) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?]
    • Hello! I have been having a problem with Forgematica, Embeddium, Oculus, and create. I wanted to download litematica so I could see which blocks are in my creative mode build, so that I could collect them all in survival. However, litematica is a fabric mod. I found a port called forgematica, which I added (along with it's dependency) to my mods folder. I loaded into a new world, and built a structure. Then, I added a part from the create mod, and the game crashed instantly, with exit code -1. Thanks for any help! Crash Report and mods list: https://pastebin.com/rtzh6LAi
    • Have you found a modder for this vehicle project? Because it will be really hard and I want to know that hero who can create all this
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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