Jump to content

[Solved] [1.10.2 / 1.8.9] How to register if mod is installed?


FireController1847

Recommended Posts

Basically, let's say I wanted to make a mod, and I wanted to addon to Mr. Crayfishes Device Mod. I want this mod to work with, or without the mod. When the mod is not installed, don't register the things for the mod, and if it is, do register them.

 

How would I be able to execute this?

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

Well, there was a similar question a few days ago, about dependencies, which you state you do not want. (Directly referencing another mods' classes, which happen to not exist, even after checking if it was there or not = Crash when creating runtime, because you imported something that doesn't exist.)

You can see that conversation here.

 

You want to keep your code as subtle as possible. If you simply want "oh, that mod is in here, let me add this" Then simply use the Loader#isModLoaded(id) to flip a boolean, of which your item/block-registration checks before registering the specified object.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

If you absolutely need to reference another mod's files, you need to put that code into a separate class, put the relevant calls into a function, and then call that function inside an Loader#isModLoaded(id) check.

 

Ah la

https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/ores/OresBase.java#L754-L769

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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