#✅ | Iron spells Mana bar

1 messages · Page 1 of 1 (latest)

inland joltBOT
#

You can absolutely build a custom mana bar by using a Progress Bar element and feeding it the Iron Spells mana value via the NBT Data placeholder. Steps:

  1. Add a Progress Bar in your HUD layout.
  2. Set its Progress value to the placeholder that reads your mana—use the Player NBT Helper element to inspect what path Iron Spells stores the mana in (the /data get command you already use is great for confirming it).
  3. Plug that path into the NBT placeholder, e.g.:
{
  "placeholder": "nbt_data_get",
  "values": {
    "source_type": "entity",
    "entity_selector": "@s",
    "nbt_path": "ForgeCaps."irons_spellbooks:player_magic".mana"
  }
}

You can scale or clamp the value through the progress bar or a calc placeholder if you need a percentage.

If FancyMenu can’t read that NBT path (the placeholder always stays empty), then unfortunately there’s no way for SpiffyHUD to display it—there’s no fallback to grab mana data in that case. For reference on how the NBT placeholder works and how to feed custom values into elements, see the NBT placeholder docs: NBT Data Placeholder.

Let me know if you need help wiring the progress bar or making it show only when mana exists!

twilit hazel
#

does that scale with the max mana and everything?

inland joltBOT
# twilit hazel does that scale with the max mana and everything?

Yes—just make the progress bar expect a percentage (0‑100 or 0.0‑1.0) and feed it a calc placeholder that divides the current mana by the max mana. Example structure:

{
  "placeholder": "calc",
  "values": {
    "decimal": "true",
    "expression": "{current_mana_placeholder} / {max_mana_placeholder} * 100"
  }
}

Replace {current_mana_placeholder} and {max_mana_placeholder} with the actual NBT placeholders you read via Player NBT Helper, then nest those placeholders inside the calc expression. That way the bar automatically scales with whatever max mana Iron Spells defines.

If you need syntax help for the calculator or the NBT placeholder, check the FancyMenu docs on calculator placeholders and NBT data placeholders.

twilit hazel
#

Oh how do I hide the manabar/health bar in creative?

inland joltBOT
# twilit hazel Oh how do I hide the manabar/health bar in creative?

Give the bar a loading requirement so it only shows up when you’re not in Creative:

  1. Right-click the Progress Bar (or whichever element you use for mana/health).
  2. Choose Loading RequirementsAdd Requirement.
  3. Select Is Creative.
  4. Click Edit Requirement Value and toggle the OPPOSITE checkbox so the element stays hidden while Creative mode is active.

That way the bar stays visible everywhere else, but disappears the moment you switch into Creative. More on requirements here: Conditions (Loading Requirements).

twilit hazel
#

Okay so you were talking about the mana bar, and that I needed to get the values myself. But I dont know how.

inland joltBOT
# twilit hazel Okay so you were talking about the mana bar, and that I needed to get the values...

You can grab the mana values with FancyMenu’s NBT tools:

  1. Place a Player NBT Helper element in your layout—right-click it and copy the NBT path for the mana field that Iron Spells uses (you can also run /data get entity @s <path> in-game to double-check the exact key).
  2. Use that path in the NBT Data placeholder inside your Progress Bar’s Progress Value (see the NBT docs for the exact syntax: NBT Data Placeholder).
  3. If you need a percentage, wrap the current/max placeholders inside a calc placeholder to divide them before feeding the bar.

If the helper doesn’t show the mana path, the placeholder won’t work—Iron Spells needs to expose that data client-side. Let me know once you have the path and I can help format the placeholder!

twilit hazel
#

Where do I copy the NBT path for the mana field that Iron Spells uses

inland joltBOT
# twilit hazel Where do I copy the NBT path for the mana field that Iron Spells uses
  1. Add the Player NBT Helper element to your HUD layout (right-click background → New Element → Player NBT Helper).
  2. Right-click it and choose Copy Path for the mana entry you want. That copies the exact NBT path Iron Spells stores the mana under.
  3. Use that path in the NBT Data placeholder for your Progress Bar, e.g.:
{
  "placeholder": "nbt_data_get",
  "values": {
    "source_type": "entity",
    "entity_selector": "@s",
    "nbt_path": "YOUR_COPIED_PATH"
  }
}

If you can’t find the entry, run /data get entity @s (or /data get entity @s <partial path>) to confirm the name and nesting of the tags. Once you have the current and max mana paths, you can divide them with a calc placeholder to feed a percentage into the Progress Bar.

Docs: NBT Data Placeholder

twilit hazel
#

I just searched through the tags I dont believe there is a current and max mana paths.

inland joltBOT
# twilit hazel I just searched through the tags I dont believe there is a current and max mana ...

If Iron Spells only exposes a single mana tag (no separate “current”/“max”), you can still show it—you just need whatever cap value the mod uses so you can turn the raw number into a percentage for the progress bar. The Player NBT Helper (right-click → copy the path it shows) or /data get entity @s are the ways to inspect what fields the mod actually writes. If there literally isn’t a max value anywhere in that data, FancyMenu can’t auto-scale the bar for you—it can only visualize what’s available client-side.

If you do spot a cap (e.g. mana_max, max_mana, etc.), plug the raw mana and that cap into a calc placeholder and divide them before feeding the bar, like in the NBT docs:

Let me know what fields you actually find and I can help you glue them into a working placeholder.

twilit hazel
#

The only thing I could find was a max mana tag.

inland joltBOT
# twilit hazel The only thing I could find was a max mana tag.

If the NBT dump only ever shows the max mana tag and no current value, FancyMenu can’t build a working progress bar—progress bars need a value + a max to calculate (%) and there’s nothing to read if the current mana isn’t exposed to the client.

Try these steps just in case it’s hidden deeper:

  1. Use the Player NBT Helper (right-click it in the editor) and expand entries under ForgeCaps/irons_spellbooks:player_magic to see if there’s anything like mana, current, value, etc.
  2. Run /data get entity @s (or /data get entity @s ForgeCaps."irons_spellbooks:player_magic") and search the output for any field that changes when you spend mana. If you find it, copy that path into the NBT placeholder.

If you really only ever find a max value, you’ll need the Iron Spells author or a datapack to expose the current mana as well—without it, SpiffyHUD can’t display a bar. For reference on how to turn those NBT values into placeholders, see NBT Data Placeholder.

twilit hazel
#

Okay lets say these were the two values I found. Can you help me plug this in?

irons_spellbooks:max_mana
irons_spellbooks:current_mana

inland joltBOT
# twilit hazel Okay lets say these were the two values I found. Can you help me plug this in? ...

Absolutely! Here’s how you plug those two NBT paths into a progress bar:

1. Get the placeholders

Use the NBT placeholder twice:

  • Current mana:
    {"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps."irons_spellbooks:player_magic".current_mana"}}
    
  • Max mana:
    {"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps."irons_spellbooks:player_magic".max_mana"}}
    

Make sure the full path matches exactly (including ForgeCaps...). You can copy it directly from the Player NBT Helper if needed.

2. Turn it into a percentage

Wrap both placeholders in a calc placeholder so the progress bar receives 0.0‑1.0 (or 0‑100) values. For a 0–1 range:

{
  "placeholder": "calc",
  "values": {
    "decimal": "true",
    "expression": "({"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.\"irons_spellbooks:player_magic\".current_mana"}}) / ({"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.\"irons_spellbooks:player_magic\".max_mana"}})"
  }
}

If you want a 0–100 percentage, multiply by 100 inside the expression.

3. Feed it to the Progress Bar

Set the Progress value of your Progress Bar element to the calc placeholder above. Now the bar fills relative to current vs. max mana.

If you want the bar hidden when mana isn’t relevant, add an Is Number loading requirement on that same placeholder so it only shows once the value exists.

Let me know if you want the bar to glow/flash when low or only appear when you have that mana system active!

twilit hazel
#

Heres like the only thing Im getting from the data get command.

inland joltBOT
# twilit hazel Heres like the only thing Im getting from the data get command.

Thanks for the screenshot—it shows that the only irons_spellbooks tag the client actually sees is the max_mana value. That means there’s no current mana value exposed client-side (or at least FancyMenu/SpiffyHUD can’t detect it), so we cannot build a percentage-based progress bar because a progress bar needs both “current” and “max”.

If you can’t find a changing current_mana tag when you spend mana (using /data get entity @s or the Player NBT Helper element), then unfortunately FancyMenu can’t read it either. The only way to make a mana bar in that case is:

  • Ask the Iron Spells author to expose the current mana to the client (via NBT or a placeholder), or
  • Use a datapack/mod that stores the current value somewhere the client can see.

If you do discover a current_mana path later, plug both values into the NBT placeholder and divide them with the calc placeholder like we showed earlier to feed the bar. Let me know what you find next!

twilit hazel
#

Okay well I found a placeholder that was previously found.

{"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.irons_spellbooks:player_magic.mana"}}

inland joltBOT
# twilit hazel Okay well I found a placeholder that was previously found. {"placeholder":"nbt_...

Perfect! Now that you’ve got the current mana placeholder, you can build the bar like this:

  1. Current mana placeholder

    {"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.irons_spellbooks:player_magic.mana"}}
    
  2. Max mana placeholder (you already spotted it):

    ForgeCaps.irons_spellbooks:player_magic.max_mana
    
  3. Feed the progress bar with a calc placeholder that divides current by max (gives you a 0–1 value):

    {
      "placeholder": "calc",
      "values": {
        "decimal": "true",
        "expression": "({"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.irons_spellbooks:player_magic.mana"}}) / ({"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"ForgeCaps.irons_spellbooks:player_magic.max_mana"}})"
      }
    }
    

    Multiply by 100 inside the expression if your progress bar expects 0–100.

  4. Set that calc placeholder as the Progress value of your Progress Bar and adjust colors/textures to taste.

If this bar should only show when that mana system is active, add an Is Number requirement on that same calc placeholder or on the mana placeholder itself. Need more help with requirements or animations?

twilit hazel
#

I dont understand any of this, and its not working. Can you give me a working reference without me having to touch any of the code.

inland joltBOT
#
Thread Message Limit Reached

This support thread has reached the maximum limit of 20 messages. To continue getting support, please start a new thread by asking your question in the #spiffy-help channel.

Creating a new thread will help keep conversations organized and ensure you get the best support possible.

jaunty creek
#

You can refer to my post.

inland joltBOT
#
How to Interact with Alice

If Alice isn't answering, you must either:

1. Mention her

Include @Alice [AI] in your message

2. Reply to her

Use Discord's reply feature on any of her messages

Note

The person who originally asked the question can send follow-up messages directly after the bot's response without mentioning or replying.

twilit hazel
jaunty creek
#

My situation is similar to yours—we're both extracting data from other mods. I've even already got the temperature system sorted out.

#

In short, it's about learning to break down these long strings of stuff into a few variables for storage—it's not as mind-boggling as it seems.

#

The first step is to create a single-line text file to directly observe the NBT values.

#

In the Set Text section, click Placeholders in the top-right corner, then select Advanced → nbt_data_get. Clicking it will automatically input the expression for you.

#

Replace the example "foodLevel" in "nbt_path" with the NBT path AI found for you. If the value includes units, first use crop_text to select the entire segment in step one; otherwise, it cannot be used to create a progress bar.

#

Check if the value is usable. If it is, go back to "set text," select all, then copy it into the newly created variable in the Variable Manager.

#

This condenses a large amount of text into a single word, greatly simplifying the subsequent calculator process.

#

You can store the current mana value and maximum mana value as separate variables.

#

Then the progress bar can be calculated as {Current MANA}/{Maximum MANA} * 100 to obtain a value between 0 and 100.

twilit hazel
# jaunty creek Then the progress bar can be calculated as {Current MANA}/{Maximum MANA} * 100 t...

Yea I get that… but the problem is, I can’t exactly find the current mana, nor the max mana. And when I looked up the mod in this discord server it seems like people are having trouble finding it too. Doesn’t seem to be a solution either. And uh. I dug deeper. Appears that someone made a fix for this, but it’s only in 1.21.1 of neoforge and not 1.20.1 of forge which is what I’m running. On top of all of this, I’m not really even a coder. I’m just trying to make a cool ui for a modpack for my friends.

#

Even when I tried running the data get or the built in nbt helper it doesn’t show up.

jaunty creek
#

Everything has its limitations. If you can't obtain MANA values, You may consider overlaying your frame on the HUD provided by the mod.

inland joltBOT
#
How to Interact with Alice

If Alice isn't answering, you must either:

1. Mention her

Include @Alice [AI] in your message

2. Reply to her

Use Discord's reply feature on any of her messages

Note

The person who originally asked the question can send follow-up messages directly after the bot's response without mentioning or replying.

jaunty creek
#

Often, I have to abandon better design solutions because they're simply unfeasible. For instance, I've encountered NBT values that don't update in SpiffyHud, and some data isn't even NBT data, making it impossible for me to read. I'm forced to settle for second-best options or give up entirely.

#

As for programming, I'm completely clueless and just winging it as I go, but this is an issue I have to tackle head-on when making HUDs.

twilit hazel
# jaunty creek Everything has its limitations. If you can't obtain MANA values, You may conside...

I would've loved to do that, but unfortunately I did want specifically a different type of mana bar which is why I was using a progress bar. Since the health bar also follows a design I was making. Using a specific shape. I think Ill try my luck and dig deeper to find a solution. But since its kind of difficult to figure out how to do these modded uis. I might give up on it soon. Thanks for the help regardless.

inland joltBOT
#

✅ | Iron spells Mana bar