Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Capability doesn't save when I quit the world
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Mikkolek

Capability doesn't save when I quit the world

By Mikkolek, November 3, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Mikkolek    0

Mikkolek

Mikkolek    0

  • Tree Puncher
  • Mikkolek
  • Members
  • 0
  • 3 posts
Posted November 3, 2020 (edited)

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 November 3, 2020 by Mikkolek
  • Quote

Share this post


Link to post
Share on other sites

vemerion    56

vemerion

vemerion    56

  • Creeper Killer
  • vemerion
  • Members
  • 56
  • 220 posts
Posted November 3, 2020
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
  • Quote

Share this post


Link to post
Share on other sites

Mikkolek    0

Mikkolek

Mikkolek    0

  • Tree Puncher
  • Mikkolek
  • Members
  • 0
  • 3 posts
Posted November 3, 2020

Thank you so much, this fixed the problem! 

  • Quote

Share this post


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.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By diesieben07 · Posted 33 minutes ago

      The loader is an inner class: https://github.com/MinecraftForge/MinecraftForge/blob/1.16.x/src/main/java/net/minecraftforge/client/model/SeparatePerspectiveModel.java#L164   You need to register the loader (see where Forge does it). Then the loader will be called to load the JSON model into memory.
    • Woodside
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By Woodside · Posted 46 minutes ago

      Loader, is that another class I extend off of? Is that SeparaterPerspectiveModel? I really have no context for how these pieces of information fit together. Can you explain with some more detail?
    • ChampionAsh5357
      [1.16.4] Looking to add trades to villagers/wandering traders

      By ChampionAsh5357 · Posted 1 hour ago

      Villagers can be added via VillagerTradesEvent while wandering traders via WandererTradesEvent.
    • ChampionAsh5357
      [1.16.4] How i can put my strucnures in to FlatGenerationSettings.STRUCTURES

      By ChampionAsh5357 · Posted 1 hour ago

      Yes, as you can see it has the obfuscated name which translate to its unique srg name and then finally the mapped name. You will need the srg name as your parameter. The static keyword makes the field/method available at class level meaning you do not need an instance to grab the associated value. So, a null value can be passed in instead.
    • ChampionAsh5357
      [1.16] Transparent Picture Render in GUI

      By ChampionAsh5357 · Posted 1 hour ago

      Setting the alpha state does not enable transparency. You need to set up the blend function in such a way such that the rgba inputs are being blended correctly. This is why I mentioned TRANSLUCENT_TRANSPARENCY.
  • Topics

    • Woodside
      10
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By Woodside
      Started 19 hours ago

    • basicsid
      1
      [1.16.4] Looking to add trades to villagers/wandering traders

      By basicsid
      Started 6 hours ago

    • Klarks
      9
      [1.16.4] How i can put my strucnures in to FlatGenerationSettings.STRUCTURES

      By Klarks
      Started 20 hours ago

    • monkeysHK
      3
      [1.16] Transparent Picture Render in GUI

      By monkeysHK
      Started Yesterday at 12:19 AM

    • kiou.23
      12
      Is it normal for configuration to take this long?

      By kiou.23
      Started Thursday at 09:57 PM

  • Who's Online (See full list)

    • diesieben07
    • st4s1k
    • Danebi
    • ChampionAsh5357
    • CookieLukas
    • RedCo0rp
    • Lellian
    • loordgek
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Capability doesn't save when I quit the world
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community