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'm doing my first capability, and I followed what I was referencing pretty closely albeit had to change things for my own capability. The issue comes in when running my mod, it says it needs an "addGenericListener" rather than "addListener" when the thing I'm referencing doesn't use that anywhere. I really don't how to fix the issue I'm still new to making capabilities, and I hope I explained my issue well, so any help is much appreciated.

 

Code:

Registering the Capability in the FmlCommonSetup: https://pastebin.com/5wMSrM5N

ICoolDown Interface: https://pastebin.com/jHZPwuNY

DefaultCoolDownCapability class: https://pastebin.com/pDiH3eev

CoolDownStorage class: https://pastebin.com/7e59wfuR

CoolDownProvider class: https://pastebin.com/dgCv94iG

CoolDownHandler class: https://pastebin.com/CuhG1wFR

CoolDownCapability class: https://pastebin.com/7E7Yg9Bh

Instead of subscribing event listeners like this:

MinecraftForge.EVENT_BUS.addListener(CoolDownHandler::onAttachCapabilities);
MinecraftForge.EVENT_BUS.addListener(CoolDownHandler::doCoolDown);

you can annotate the event listener class with @Mod.EventBusSubscriber()

and then anotate the event listener methods with @SubscribeEvent

 

that is not the only way to do it, but it is the one I find easier, and it should solve your listener issue

for documentation on events you can check out: https://mcforge.readthedocs.io/en/latest/events/intro/

or: https://forge.gemwire.uk/wiki/Events#Event_Listeners

  • Author
1 hour ago, kiou.23 said:

you can annotate the event listener class with @Mod.EventBusSubscriber()

and then anotate the event listener methods with @SubscribeEvent

 

that is not the only way to do it, but it is the one I find easier, and it should solve your listener issue

for documentation on events you can check out: https://mcforge.readthedocs.io/en/latest/events/intro/

or: https://forge.gemwire.uk/wiki/Events#Event_Listeners

I don't even know why I didn't think of that in the first place, thank you! It worked! I was WAY overthinking it lolol

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.