Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Capability doesn't save when I quit the world


Recommended Posts

If I understand capabilities correctly, their state is supposed to be saved when the world is quit and reload when it's open again, but in my case, the capability just resets to 0 when I reload the world. I've just started getting into modding, so I'm sorry if I made some really simple mistake, but I can't figure out what I'm doing wrong. I based my capability mainly on this tutorial from McJty: https://youtu.be/W3SS7yP4B2s and I also read the page about capabilities on the forge docs, but it seems to be quite outdated. You can find my test mod here: https://github.com/Mikkolek/TestCapabilitiesMod. I also made a simple command called "/devmode" to check the capabilities it's state and change it. 

Edited by Mikkolek
Link to post
Share on other sites
6 hours ago, Mikkolek said:

If I understand capabilities correctly, their state is supposed to be saved when the world is quit and reload when it's open again, but in my case, the capability just resets to 0 when I reload the world. I've just started getting into modding, so I'm sorry if I made some really simple mistake, but I can't figure out what I'm doing wrong. I based my capability mainly on this tutorial from McJty: https://youtu.be/W3SS7yP4B2s and I also read the page about capabilities on the forge docs, but it seems to be quite outdated. You can find my test mod here: https://github.com/Mikkolek/TestCapabilitiesMod. I also made a simple command called "/devmode" to check the capabilities it's state and change it. 

It looks like you are not correctly registering the capability. Add this:

FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);

to the constructor of your main mod class.

  • Thanks 1
Link to post
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.

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.