Posted April 27, 20214 yr 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
April 27, 20214 yr 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
April 28, 20214 yr 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.