How to prevent build from overwriting mod source?

Started by FrozT on

Topic category: General discussion

Last seen on 02:59, 17. Sep 2020
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to prevent build from overwriting mod source?

I need to make a small change to my source of the main mod java file on the @mod line I need it to be the following:

@Mod(modid = testenvironmentmod.MODID, version = testenvironmentmod.VERSION, acceptableRemoteVersions = "*")

But every time I go to rebuild MC overwrites that file, setting it back to default. I've tried modifying the sources in the directory by hand but they also get overwritten.

How can I make a change to my main java file and get it compiled in to my mod?

At the moment, this file…
Sat, 06/09/2018 - 09:38

At the moment, this file will be overwritten no matter what you do. Why are you adding the acceptableRemoteVersions bit of the code? We can implement a checkbox for this in MCreator if it would make sense to users.

Last seen on 02:59, 17. Sep 2020
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The checkbox would be great…
Sat, 06/09/2018 - 20:39

The checkbox would be great.  The mod I'm trying to build only needs to run on the server, not on the clients and I want to get around them complaining that they don't have the mod installed.

Last seen on 02:59, 17. Sep 2020
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
While I hope they introduce…
Mon, 06/11/2018 - 21:06

While I hope they introduce the checkbox, in the meantime I came up with a hack that I'm surprised to say actually works.  Modify the mod's jar file (inside the build jar's mod/mcreator folder) with your favorite hex editor and change the follow data:

19 61 63 63 65 70 74 65 64 4D 69 6E 65 63 72 61 66 74 56 65 72 73 69 6F 6E 73 01 00 08 5B 31 2E 31 32 2E 32 5D

to this:

18 61 63 63 65 70 74 61 62 6C 65 52 65 6D 6F 74 65 56 65 72 73 69 6F 6E 73 01 00 01 2A

Ensure you remove the extra 8 bytes of the original hex or it won't work (the new file should be 8 bytes smaller.) I know no-one can ever endorse this but I am running a non-forge vanilla client connected to a forge'd server and the mod is functioning. Even custom commands are propagated to the client and when clients issue them they are executed in the servers mod code which is exactly what I want. Unfortunately it's a bit painful to implement.

Last seen on 02:59, 17. Sep 2020
Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ugh, can't seem to edit my…
Mon, 06/11/2018 - 21:14

Ugh, can't seem to edit my last reply. In-case its not obvious, I forgot to mention those last few bytes in the replace hex, these ones:

31 2E 31 32 2E 32

translate to 1.12.2 which happens to be the version I'm running now.  For future users seeing this post, those values will change to whatever the current version of the supported client is. This hack will still work you just need to slightly modify the replace hex like 31 2E 31 32 2E 33 would be for version 1.12.3