Jump to content

Recommended Posts

Posted

Hey Guys!

Can you find out if a specific mod is loaded? And can you get access to this mod's Blocks to add crafting recipes or something else?

 

I'm thinking about something like this:

if (isModLoaded("modid"))
GameRegistry.addRecipe(..., '#', getModsBlock("modid", "unlocalizedName");

 

You can also use this to avoid double - creation of equivalent Items.

 

Any ideas how to do this?

Posted

If the mod is using the GameRegistry, you are supposed to be able to get elements by using functions like:

 

  GameRegistry.findItem("modname", "registeredItemName")

  GameRegistry.findBlock("modname", "registeredBlockName")

 

Sometimes the modname is not obvious. You might have to ask around for particular mods.

 

I use findItem in my own mod recipes just to make sure GameRegistry is working correctly:

  GameRegistry.addSmelting(GameRegistry.findItem("MJHotdog", "RawFrank"),

      new ItemStack(MJHotdog.CookedFrank, 1), 300.0f);

 

I wish I could get GameRegistry to work with Thermal Expansion...

Posted

BTW Re: double creation of items.

 

I have put some thought into this as well.

 

If you do not create your item because some other mod creates a similar item, then someone else's mod that depends on YOUR mod might break because of the combination of mods.

 

I, too, hate the duplicate items when running multiple mods, but I am not sure what the ultimate solution should be.

 

Cheers!

Posted

Or you could access their config file and get IDs, but that wouldn't do much.. you still need to know what's the mod's id.

I try my best, so apologies if I said something obviously stupid!

Posted

Ive seen some mods with API's that provide access to their blocks etc. by reference, and dont require the full mod the be present. You could do something similar and would make it easier for anyone else that depends on your mod to deal with such things.

 

 

I'm thinking about something like this:

if (isModLoaded("modid"))
GameRegistry.addRecipe(..., '#', getModsBlock("modid", "unlocalizedName");

Potential problem with this though.

Say your mod is installed and the player has some of your items/blocks. Then installs some other mod without completely restarting their world. They will now be unable to correctly load that world because you essentially uninstalled content that the world already depended on.

 

This might be alright if your mod significantly effects terrain generation, but even for just say some new ores (and especially if your mod or another already had a compatible ore) they may want to keep their world.

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



×
×
  • Create New...

Important Information

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