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

How to add a mana setting to the player character?


Recommended Posts

Hello guys,how to add a mana setting to the player character?


Like thisCQdsZSy.jpg

Each casting spell will consume a certain amount of mana,and mana will slowly recover over time.


I have done the part of casting spells within onitemrightclick(),but where should i edit the mana setting?Should i put it in Entityplayer?


What should i do next?Is there any function to do that with Entityplayer?




I'm sorry I forgot

1.7.10 - Recommended

Link to comment
Share on other sites

1.8.9+: http://mcforge.readthedocs.org/en/latest/datastorage/capabilities/

-1.8.9: http://mcforge.readthedocs.org/en/latest/datastorage/extendedentityproperties/


Make object, attach it, store mana, edit it when needed.


Regeneration can be done with PlayerTickEvent (pick event.phase).


You will NEED packets: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html


Rendering can be done with RenderGameOverlayEvent (pick sub event, most likely Post and event.type).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Something to make note of if you run in to render issues.


I had to remove my getType check for my bar to render properly. I tried with every ElementType and every single one of them made my bar render with the wrong colors.


So start out using it but if you have issues keep in mind that you may have a similar problem.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

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.

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 Terms of Use.