Jump to content

[Solved][1.16.4] Overlay not finding capability


SovereignRed

Recommended Posts

Hi! I am really new to modding, this is my first try at it, so please forgive me if I am making a basic mistake here. Basically I have a capability attached to the player that I want displayed in an overlay at the top of the screen. The capability works and all, and the overlay displays, when it is not based off of the capability. My problem is that when I try to get the player's capability to set the width of the overlay bar, it doesn't find anything.

The mod allows players to increase their "cultivation" as they kill things, but even though the cultivation capability is properly attached on login and everything, the overlay event finds a capability of 0. Below are the links for the class with the overlay itself and the event call, respectively. I'm not really sure how to fix this.

https://github.com/Sovereign99/CultivationMod/blob/main/src/main/java/net/sovereign/cultivation/setup/gui/CultivationGui.java

https://github.com/Sovereign99/CultivationMod/blob/main/src/main/java/net/sovereign/cultivation/handlers/EventHandler.java#L41

Edited by SovereignRed
Link to comment
Share on other sites

46 minutes ago, diesieben07 said:

Capability data is not synchronized to the client by default or automatically. You have to send a custom packet.

I thought that might be the case but I haven't learned how to do that yet so I couldn't try. I'll look into that tomorrow, thank you!

Link to comment
Share on other sites

  • SovereignRed changed the title to [Solved][1.16.4] Overlay not finding capability

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.