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

Is there a way, with Forge, to detect which mods are installed? I'd like to try to make a mod that detects if the client has Optifine installed and decide based on that whether to use HD textures or not.

 

Something along the lines of:

//psuedocode
public String getTextureFile() {
   if (client has Optifine) {
      return "hdterrain.png";
   } else {
      return "terrain.png";
   }
}

Well, first, Lex is gonna flip at the mention of optifine.

Second, I think there's a method like <MainFMLClassthing>.isModLoaded(...) or something.

 

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Well, first, Lex is gonna flip at the mention of optifine.

Why would I do that? Optifine is the good one, MCPatcher is the shit one.

But yes, FML detects optifine and sticks a fake mod container in there so people can detect it as a mod.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

So, am I looking in the wrong class/method?

 

I have this in my block class:

 

 

@Override
public String getTextureFile() {
    for (int i = 0; i < Loader.instance().getModList().size(); i++) {
        System.out.println(Loader.instance().getModList().get(i).getName());
    }

    if (Loader.isModLoaded("optifine")) {
        return "/com/drin/mods/gfx/hdterrain.png";
    } else {
        return "/com/drin/mods/gfx/terrain.png";
    }
}

 

 

 

And I am getting this stack trace:

 

 

2012-09-14 19:03:50 [iNFO] [ForgeModLoader] Forge Mod Loader version 3.0.196.366 for Minecraft client:1.3.2, server:1.3.2 loading
2012-09-14 19:03:52 [iNFO] [sTDOUT] 27 achievements
2012-09-14 19:03:52 [iNFO] [sTDOUT] 195 recipes
2012-09-14 19:03:52 [iNFO] [sTDOUT] Setting user: Player883, -
2012-09-14 19:03:52 [iNFO] [sTDERR] Client asked for parameter: server
2012-09-14 19:03:52 [iNFO] [sTDOUT] LWJGL Version: 2.4.2
2012-09-14 19:03:53 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization
2012-09-14 19:03:53 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization
2012-09-14 19:03:53 [iNFO] [ForgeModLoader] Forge Mod Loader has detected optifine OptiFine_1.3.2_HD_U_B3, enabling compatibility features
2012-09-14 19:03:53 [iNFO] [ForgeModLoader] Searching H:\workspace\TutorialGui\jars\mods for mods
2012-09-14 19:03:53 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 3 mods to load
2012-09-14 19:03:54 [iNFO] [sTDOUT] Forge Mod Loader
2012-09-14 19:03:54 [iNFO] [sTDOUT] Minecraft Forge
2012-09-14 19:03:54 [iNFO] [sTDOUT] EnigmaCraft
2012-09-14 19:03:54 [iNFO] [sTDOUT] Forge Mod Loader
2012-09-14 19:03:54 [iNFO] [sTDOUT] Minecraft Forge
2012-09-14 19:03:54 [iNFO] [sTDOUT] EnigmaCraft
2012-09-14 19:03:54 [iNFO] [sTDOUT] Starting up SoundSystem...
2012-09-14 19:03:54 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2012-09-14 19:03:54 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2012-09-14 19:03:54 [iNFO] [sTDOUT] OpenAL initialized.
2012-09-14 19:03:55 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 3 mods

 

 

 

But I know I have Optifine installed (and working), as shown here:

 

 

qBpdL.png

 

 

 

And yes, I know I'm a few builds behind on Forge :P

 

What am I doing wrong?

Well, first, Lex is gonna flip at the mention of optifine.

Why would I do that? Optifine is the good one, MCPatcher is the shit one.

But yes, FML detects optifine and sticks a fake mod container in there so people can detect it as a mod.

Oh.

I get the two mixed up sometimes, and I wans't really awake...

Anyway, that's a pretty easy way to detect mods.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

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.