Posted February 22, 201411 yr 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? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
February 22, 201411 yr 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...
February 22, 201411 yr 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!
February 22, 201411 yr 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!
February 22, 201411 yr 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. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
February 23, 201411 yr Alright, but you didn't specify your version.. I try my best, so apologies if I said something obviously stupid!
February 23, 201411 yr 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.
February 23, 201411 yr 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? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
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.