Jump to content

[1.15.2] Registering capability multiple times ERROR


xanderindalzone

Recommended Posts

Hi, I'm new to capabilities, I followed a few tutorials on how to create your own, and after creating the interfaces, capability classes, storage, providers and registering them and attatching them to entities, I'm getting an exception crash saying I'm registering capabilities multiple times, I dont see where. :/

 

Quote

[29jul2020 09:55:22.252] [modloading-worker-1/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event FMLCommonSetupEvent dispatch for modid customgunsmod
java.lang.IllegalArgumentException: Cannot register a capability implementation multiple times : com.xanderindalzone.customgunsmod.capabilities.entity.IGunAim
    at net.minecraftforge.common.capabilities.CapabilityManager.register(CapabilityManager.java:72) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?]
    at com.xanderindalzone.customgunsmod.init.InitCapabilities.registerCapabilities(InitCapabilities.java:19) ~[main/:?]
    at com.xanderindalzone.customgunsmod.CustomGunsMod.setup(CustomGunsMod.java:111) ~[main/:?]
    at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.2.0-service.jar:?]
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.2.0-service.jar:?]
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?]
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[?:31.2]
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source) ~[?:1.8.0_251]
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source) ~[?:1.8.0_251]
    at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[?:?]
    at net.minecraftforge.fml.ModList.lambda$null$10(ModList.java:135) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[?:1.8.0_251]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source) ~[?:1.8.0_251]
    at java.util.concurrent.CountedCompleter.exec(Unknown Source) ~[?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source) ~[?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.invoke(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[?:1.8.0_251]
    at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:1.8.0_251]
    at net.minecraftforge.fml.ModList.lambda$dispatchParallelEvent$11(ModList.java:135) ~[?:?]
    at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [?:1.8.0_251]
    at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [?:1.8.0_251]

 

 

Main Mod class

Quote

 

Capability package with providers

Quote

 

Event that attatches capabilities to the player

Quote

 

 

I know I'm doing 1 capability per variable, I've seen that you can have multiple variables in 1 capability, I just wanted to make them as simpler as posible for start.

Link to comment
Share on other sites

You do understand that this line:

https://github.com/xanderindalzone/customgunsmod/blob/master/src/main/java/com/xanderindalzone/customgunsmod/CustomGunsMod.java#L93

And this line:

https://github.com/xanderindalzone/customgunsmod/blob/master/src/main/java/com/xanderindalzone/customgunsmod/CustomGunsMod.java#L89

 

Do basically the same thing, right? Lines 89 and 91 each register one method specified, line 93 registers "all annotated methods" which happens to be...one method (line 137).

 

Then you have this line:

https://github.com/xanderindalzone/customgunsmod/blob/master/src/main/java/com/xanderindalzone/customgunsmod/CustomGunsMod.java#L80

Which literally does the same thing as line 89, registering the same method a second time.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.