Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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?

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

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!

This is resolved by Loader.isModLoaded(ID). ID is the @Mod's modid String.

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!

  • Author

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

Alright, but you didn't specify your version..

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

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.

  • Author
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?

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.