Creation of Core Mod

Started by GregoryAM on

Topic category: Plugins and third-party tools

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Creation of Core Mod

To start this off, I'm not sure if this belongs under "Modding", "Other", "Help and Tutorials", or a completely different sub-category. If movable, please place it under the correct category/sub-category. Currently under Other: Plugins and Third-party tools, due to it talking about Core, Libraries, and Modifications to code.

I've been working on a mod that is a decent size. So, I've decided to create a Core, or Library, that will help the main modification out. I've found that I can add an Additional Required Mod, that will help with development. I noticed that the information about the Additional Required Mod is saved in a file called, " mods.toml " found in the folder META-INF, under the Workspace file browser. I noticed there is a versionRange="[0,)". When starting the main mod, for testing, it will say, "Mod [name] requires [core name] 0 or above", Which is understandable. However, When changing versionRange="[0,)" to versionRange="[1.0.0,]" / versionRange="[1.0.0,)", it reverts back to versionRange="[0,)".

I've noticed also,
versionRange="[0,)" states, "Mod [name] requires [core name] 0 or above"
versionRange="[0,]" states, "Mod [name] requires [core name] 0 or above"
versionRange="[0,1)" states, "Mod [name] requires [core name] 0 or above, and below 1
versionRange="[0,1]" states, "Mod [name] requires [core name] 0 and 1 (inclusive)

I'm only able to find that out by spamming CTRL+S on the mods.toml tab after clicking "Run Client".

My question is: how do I keep the changes, or add a required version to the Workspace settings?

I'm trying to make sure if there is a problem with a version, tweaks can be made, then I can publish the changes.

I've also noticed that even when building the mod for distribution, it changes back to versionRange="[0,)" and I cannot spam CTRL+S while it's building that way.

Found that out by using JD-GUI [Java Decompiler]

Here is the content of mods.toml

modLoader="javafml"
loaderVersion="[36,)"
license="[Undecided]"

[[mods]]
modId="mod_name"
version="1.0.0"
displayName="Mod Name"
credits="Created using mod maker MCreator - https://mcreator.net/about"
displayURL="https://mcreator.net"
authors="PC User, MCreator"

[[dependencies.mod_name]]
    modId="minecraft"
    mandatory=true
    versionRange="[1.16.5]"
    ordering="NONE"
    side="BOTH"


[[dependencies.mod_name]]
    modId="mod_core"
    mandatory=true
    versionRange="[0,)" #This is what the post is talking about.
    ordering="NONE"
    side="BOTH"


Any help would be appreciated, or even an update to MCreator that allows creators to add custom version to their cores and libraries would be outstanding! Thank you in advance.
Sincerely, GregoryAM

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I should also mention, I…
Wed, 06/23/2021 - 01:55

I should also mention, I have used a zip extractor to open the .jar and replace the mods.toml with an edited version that contains the versions needed. I just think being able to change it from in MCreator, either from the file editor, or Workspace settings might be easier. Just putting it out there that this is something I've tried and succeeded on, but it's inconvenient, and might cause problems if there are multiple versions of a core or mod.

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
try going to your workspace…
Wed, 06/23/2021 - 02:12

try going to your workspace settings -> advanced settings -> tick the "lock base mod files" checkbox, then edit the mods.toml file again. coz if I'm right, MCreator normally overwrites code that isn't locked whenever you build/regen code, and that includes base mod files such as the main mod file, the "elements" class, mods.toml, and other core files of a mod's folder structure. just be sure not to mess up anything too much about your mod, and that you fully know Java, when you decide to lock base mod files, coz you might want to have it enabled forever if it's necessary for what you're doing (to no longer let mods.toml be overwritten) and have to rely on coding to fix compilation errors and such

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and yeah, i agree; there…
Wed, 06/23/2021 - 02:16

and yeah, i agree; there should be an easier way to edit the mods.toml file from the workspace settings, where it allows for full customization of the file through text fields, but it'll only be available when you enable "advanced mode" or something under MCreator's app settings which could show hidden, more advanced functions for more experienced modders to use. let's just cross our fingers that it'll get added to MCreator/MCToolkit anytime in the future!

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I appreciate your reply, and…
Wed, 06/23/2021 - 02:53

I appreciate your reply, and I did test checking the "lock base mod files" option you mentioned after I saw the comment. However, it still reverts the changed mods.toml back to it's original state. So it seems I might just have to keep a log file and multiple folders of changed .jar files and updated mods.toml files on hand to counteract the issue, at least until it's implemented or added in a future update. I do appreciate you taking your time to reply. Maybe a moderator or the developers will respond and possible have some insight on the issue.