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

Hi,

 

I created a mod that contains some base and utility classes.

I'd like to reuse those in a second mod.

Can I simply include the classes in my second mod or am I gonna run into class loading issues?

 

What is the way to go? Do I need to create a separate jar file with those classes (without any @Mod annotated class) and use it as a library for my mods?

How to proceed with ForgeGradle?

 

Thanks a lot for your help.

Well, there are a few ways to go about this, but the most common practice would be to compile one into a jar and use it as a library for the second.

Have a look as how you would implement a feature of buildcraft into your own mod for instance.

There are tutorials about that and if you do the same thing you should be able to use it as a basic API.

As for codewise, basically make your code very trans parant with lots of getters and setters

and whatever methods you need to interact with your variables in your base mod.

In other words, decent programming behaviour is a must.

And you have to create it as if it is a mod if you want to use it in a forge environment.

An Api is just another mod that you're using so there is nothing different from the usual ones.

 

 

Well, actually a utility mod is not the same thing as an API library. An API library use usually just a jar of java classes with source in a jar (and any jar of natives if it uses the JNI system). It is normally added to the build path and parts can be included in the final jar.

 

A utility mod is one that is a dependency and is a full mod in its own right with either necessary linkage points or an API-only version. It can be made to be necessary or optional. Inter-mod coms can be useful in this case.

 

There are other permutations and variants as well, but this seems to be the norm.

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.