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

I am wanting to add support for other mods within my mod by using other mod's APIs, but I don't want my mod to depend on having these other mods installed, so if Mod 1 wasn't installed, Mod 2 was, the support would be there for Mod 2 still. Is there a way to do this?

Your question is a bit two-sided when it comes to what you mean.

How to check if a mod is loaded?

if(Loader.isModLoaded("other_mod's_modid"))
//do stuff with things from this mod.

 

How to get rid of dependency, but still make use of X.

Dependency is the easiest and most stable way of getting cross-mod interactions. That has to be said.

However, for simple things like entities, items, blocks etc, they can all be accessed from strings (Item.getByNameOrId(modid:name), Block.getBlockFromName(modid:name) and EntityList.NAME_TO_CLASS.get(name)) though they should always have null checks, case their name changes or they are, as mentioned, not installed together with your mod.

 

However, for full and complete freedom from dependencies, you want to learn about java reflection, and find classes from strings, instantiate them from scratch, which would be very prone to complete failure should a single thing change in a constructor.

 

It's a long and twisted road to go down if you are not quite adapt with Java. You sure you want to go down it?

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

  • Author

Thanks, that clears everything up that I wanted to know, whether you fully understood what I was trying to say anyway xD For the most part I will just be using other mod's blocks/items so what you said will work fine, but then if there is any other classes I need then I might as well learn reflection at some point, but it most likely won't be necessary for what I want to do.

 

Thanks again :)

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.