Jump to content

Access to other mods?!


Bedrock_Miner

Recommended Posts

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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@mjhotdog: Sounds great, I'm going to try this soon.. And I think IF someone creates a mod which depends on mine he should ask me about this.

 

@Alexiy: Thanks also for this fast reply, gonna try this out soon.

 

@Frost: This would work in 1.6 and lower but no more in 1.7 because you don't have IDs any more.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

And how exactly can I do this?

Link to comment
Share on other sites

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.