#how to make player name text hud

1 messages Β· Page 1 of 1 (latest)

high prismBOT
#

Hello there! πŸ‘‹

To display player information like their name, health, and armor in your SpiffyHUD, you can use Text elements combined with placeholders.

Here's how you can do it:

1. Player Name

To show the player's name, you can use the playername placeholder within a Single-Line Text element (or a regular Text element):

{"placeholder":"playername"}

2. Player Health

For the player's health, you have a few options:

  • Current Health: To display the exact health points:
    {"placeholder":"current_player_health"}
    
  • Max Health: To show the maximum possible health points:
    {"placeholder":"max_player_health"}
    
  • Health Percentage: To show health as a percentage:
    {"placeholder":"current_player_health_percent"}
    

You can combine these in a Single-Line Text element to show something like 20/20 (100%):
{"placeholder":"current_player_health"}/{"placeholder":"max_player_health"} ({"placeholder":"current_player_health_percent"}%)

If you want to display health as a bar, you would use a Progress Bar element with these placeholders. For a detailed guide on creating custom progress bars, you can check out this example (for Drippy, but concepts apply).

3. Player Armor

Similarly, for player armor:

  • Current Armor: To display the current armor points:
    {"placeholder":"current_player_armor"}
    
  • Max Armor: To show the maximum possible armor points:
    {"placeholder":"max_player_armor"}
    
  • Armor Percentage: To show armor as a percentage:
    {"placeholder":"current_player_armor_percentage"}
    
#

You can combine these in a Single-Line Text element to show something like 20/20 (100%):
{"placeholder":"current_player_armor"}/{"placeholder":"max_player_armor"} ({"placeholder":"current_player_armor_percentage"}%)

You can find more information about all available placeholders in the SpiffyHUD wiki: SpiffyHUD Placeholders and the FancyMenu documentation Placeholders.

Let me know if you have any more questions! 😊

sour folio
#

Now a placeholder for the Ironspellbooks mana, just like the HP.

high prismBOT
# sour folio Now a placeholder for the Ironspellbooks mana, just like the HP.

For Iron's Spellbooks mana, you would typically need to fetch that via the NBT Data placeholder since it's mod-specific data! πŸ§™β€β™€οΈ

Let's try to set that up.

First, you need to be sure about the exact NBT path for the mana value. You can usually find this by using the /data get entity @s command in-game, which will show you all NBT data associated with your player. Look for something related to "mana" or "magic" from the Iron's Spellbooks mod.

Once you have the correct NBT path, you can use the NBT Data placeholder in a Text element. A common path (though it can vary) might look something like this:

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

Important Notes:

  • The nbt_path value might need adjustment based on the exact path returned by the /data get command. Make sure to wrap the full path in quotation marks (").
  • The NBT Data placeholder can sometimes be a bit experimental, especially with modded data. If it doesn't work right away or you get errors, it might be due to how the mod stores its NBT data or limitations with the client-side NBT fetching.

You can read more about the NBT Data placeholder here: NBT Data Placeholder

Please give this a try and let me know if you manage to find the correct NBT path or if you encounter any issues! 😊

sour folio
#

how to change text color?

high prismBOT
# sour folio how to change text color?

Oh, I understand! You'd like to change the color of the text. There are a couple of ways to do this in FancyMenu, depending on the type of text element you're using. ✨

For Text Elements (Markdown Support)

If you are using a Text element, which supports Markdown, you can apply a specific HEX color using this format:

%#RRGGBB%your text here%#%

Just replace RRGGBB with your desired HEX color code! For example, for green text:

%#00FF00%This text is green!%#%

You can find more details about Markdown text formatting here: Text Formatting - Markdown

For Other Text Content (e.g., Button Labels, Tooltips)

For text in elements that don't support Markdown (like certain button labels, tooltips, or splash text elements), you can use Minecraft's formatting codes. These use an ampersand (&) followed by a character to define color or style.

For example, to make text red:

&cThis text is red!

And for green:

&aThis text is green!

You can find a list of these codes on the Minecraft Wiki. Just remember to use & instead of Β§! More info here: Text Formatting - Minecraft Text Formatting

Which element are you trying to change the text color for? Knowing that can help me give you the most precise instructions! 😊

sour folio
#

I can't get the mana placeholder to work.

high prismBOT
# sour folio I can't get the mana placeholder to work.

Oh no, I'm sorry to hear you're having trouble with the mana placeholder! πŸ˜₯ It can be a bit tricky with mod-specific NBT data.

To help me figure out what's going on, could you please provide a bit more context?

  1. What is the exact NBT path you are using? (e.g., the full text you put after "nbt_path": in the placeholder).
  2. What does the /data get entity @s command return in-game? Please paste the relevant part of the output, especially anything related to "mana" or "irons_spellbooks".
  3. Are you seeing any specific error messages in-game or in the logs?
  4. Are you using the latest versions of SpiffyHUD and Iron's Spellbooks?

The NBT Data placeholder can sometimes be unstable for modded content, as mentioned in the Known Issues documentation. But let's see if we can get it working for you!

Looking forward to hearing more details! 😊

sour folio
#

ForgeCaps."irons_spellbooks:player_magic".mana

high prismBOT
# sour folio ForgeCaps."irons_spellbooks:player_magic".mana

Thank you for providing the NBT path! That's very helpful.

You mentioned you are using:
ForgeCaps."irons_spellbooks:player_magic".mana

And in the placeholder, you used this in the "nbt_path" value:
ForgeCaps."irons_spellbooks:player_magic".mana

The issue here is that the NBT path itself contains quotation marks, which can interfere with the JSON formatting of the placeholder. When you put this path into the placeholder, those inner quotes ("irons_spellbooks:player_magic") are ending the string prematurely or causing parsing errors.

To fix this, you need to escape the inner quotation marks within the NBT path. This tells the system that those quotes are part of the path, not the end of the string.

Try this for your nbt_path value instead:

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

Notice the backslashes (\) before each inner quote. This is how you escape them in JSON.

If this still doesn't work, could you also send me your latest.log file from your Minecraft instance's /logs/ folder after experiencing the issue? That would give me even more insight! 😊

sour folio
#

"irons_spellbooks:player_magic": {castingSpellLevel: 0, isCasting: 0b, mana: 100, effectFlags: 0L, spellSelection: { lastSlot: "", index: -1, slot: "", lastIndex: -1}, castingEquipmentSlot: "", heartStopAccumulatedDamage: 0.0f, evasionHitsRemaining: 0.0f, castingSpellId: ""},

high prismBOT
# sour folio "irons_spellbooks:player_magic": {castingSpellLevel: 0, isCasting: 0b, mana: 100...

Thank you for providing that NBT data! That's excellent context.

Based on the snippet you provided, the NBT structure looks like this:

"irons_spellbooks:player_magic": {
    castingSpellLevel: 0,
    isCasting: 0b,
    mana: 100, // <--- This is what we want!
    effectFlags: 0L,
    spellSelection: { /* ... */ },
    castingEquipmentSlot: "",
    heartStopAccumulatedDamage: 0.0f,
    evasionHitsRemaining: 0.0f,
    castingSpellId: ""
},

The correct path to access mana directly under "irons_spellbooks:player_magic" would be:
"irons_spellbooks:player_magic.mana"

So, when using the nbt_data_get placeholder, you'll want to use it like this:

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

Notice that I've simplified the path and removed the ForgeCaps prefix. Sometimes the /data get command output includes top-level tags like ForgeCaps for organizational purposes, but they aren't always part of the direct path you need to specify in the placeholder. It also seems my suggestion to escape the quotes was not correct here, as the string itself uses . as separator.

Test this nbt_path value first. If it still doesn't work, we can try including ForgeCaps by escaping quotes as initially suggested:

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

Let me know how the first (simpler) option works for you! 😊

sour folio
#

what is wrong with this placeholder?

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

high prismBOT
# sour folio what is wrong with this placeholder? {"placeholder":"nbt_data_get","values":{"s...

Oh, it looks like you sent the same placeholder twice! No worries, I see what you're asking. πŸ˜‰

The placeholder itself, with the escaped quotes:

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

... is syntactically correct for JSON. The " correctly escapes the inner quotes for "irons_spellbooks:player_magic".

However, the problem might not be with the JSON syntax itself, but rather with how the NBT system or the specific mod handles that path.

Here's why it might still not be working, despite being syntactically correct:

  1. ForgeCaps may not be a directly accessible part of the NBT path for this placeholder. As I mentioned before, sometimes the /data get command output includes top-level tags like ForgeCaps for organizational viewing, but they are not always part of the direct path you provide to nbt_data_get. The placeholder might expect the path to start directly with the mod ID's NBT, like my earlier suggestion of "irons_spellbooks:player_magic.mana".
  2. The NBT may not be client-side. The NBT Data placeholder is currently client-side only. If the irons_spellbooks:player_magic data is primarily stored server-side and not fully synchronized to the client, the placeholder won't be able to retrieve it. This is a known limitation, as mentioned in the FancyMenu Known Issues.
  3. Mod-specific NBT complexities. Some mods store NBT data in non-standard ways that are difficult for generic NBT readers (like FancyMenu's placeholder) to access.

What I recommend trying first is the simpler path, if you haven't already:

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

If that still doesn't work, could you please confirm what the full output of /data get entity @s looks like in your game? Knowing the exact top-level structure where "irons_spellbooks:player_magic" appears would be very helpful.

And if you're comfortable sharing it, your latest.log file after attempting to use the placeholder would be ideal for deeper troubleshooting! 🧐

sour folio
#

doesnt work.