How to prevent build from overwriting mod source?

Started by FrozT on Sat, 06/09/2018 - 08:52

Topic category: General discussion

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to prevent build from overwriting mod source?
Sat, 06/09/2018 - 08:52

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?

Last seen on 14:55, 24. Oct 2020
Joined Apr 2010
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
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
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 14:55, 24. Oct 2020
Joined Apr 2010
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Could you open a support…
Sun, 06/10/2018 - 08:23

Could you open a support ticket on our issue tracker so the developers will find your request and that your request will be properly considered?

Issue tracker: https://mcreator.net/tracker

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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