#✅ | It is possible to add an image of the HUD for the weapons in the Tacz mod.Do not use the inve...

1 messages · Page 1 of 1 (latest)

wintry cradleBOT
#

Yep, you can do that with SpiffyHUD by letting FancyMenu check your active hotbar slot and showing the matching weapon art via an Image element.

Here’s the rough setup:

  1. Create a Ticker that runs every tick and updates a FancyMenu variable (e.g. current_weapon_id).

    • Use a Set Variable action inside the ticker that writes the slot_item placeholder for the currently selected hotbar slot:
      {"placeholder":"slot_item","values":{"slot":"{"placeholder":"active_hotbar_slot"}"}}
    • That gives you the item ID (like minecraft:iron_sword) even without touching any inventory screens.
    • If you want to hide the HUD when the slot is empty, wrap the action in an If that only runs when slot_item isn’t empty.
  2. Add an Image element for the weapon sprite.

    • In the image’s Source field, use a path that includes the variable, e.g. /config/fancymenu/assets/weapons/{"placeholder":"getvariable","values":{"name":"current_weapon_id"}}.png.
    • That lets you drop in PNGs named after each weapon ID (minecraft:iron_sword.png, tacz:custom_rifle.png, etc.).
  3. Optional loading requirement: add an Is Text or Is Number requirement so the image only shows when current_weapon_id returns something. You can also animate/fade it via FancyMenu’s image options.

Keep everything inside /config/fancymenu/assets/ so the resources load properly.
For a refresher on the slot_item, active_hotbar_slot, and variable placeholders you’ll be using, check the Placeholders documentation.

wise dew
#

Okay, I get the ID.
But to detect the weapon, the weapon element uses the same ID, but a different NBT to identify the weapon.

wintry cradleBOT
# wise dew Okay, I get the ID. But to detect the weapon, the weapon element uses the same I...

Since the weapon integration relies on a special NBT tag rather than just the item ID, you can still do it in Spiffy by reading that NBT path and using it in your image logic:

  1. Add a Player NBT Helper element (Spiffy’s helper) to see what NBT keys the weapon exposes when it’s in your hand. That element lists every available path so you can copy the exact one you need.

  2. Use the Player NBT Data placeholder to read that path. For example:

    {"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"your.weapon.tag"}}
    

    Replace your.weapon.tag with whatever path the helper shows for the weapon identifier.

  3. Store the value in a FancyMenu variable via a Ticker (or button/script) so you can reference it from other elements. Use a Ticker that runs every tick, reads the placeholder, and sets a variable like current_weapon_tag.

  4. Point your Image element’s source to that variable (e.g., /config/fancymenu/assets/weapons/{"placeholder":"getvariable","values":{"name":"current_weapon_tag"}}.png). That way the HUD switches to the correct sprite based on the weapon-specific NBT.

  5. Add a loading requirement (Is Text or Is Number) so the image only appears when the placeholder returns a value.

All of these steps are covered in the docs:

If the mod stores the weapon identifer under a more complex structure (like custom compound tags), the Player NBT Helper is your best friend to drill down into the exact path you need to feed into the placeholder.

wise dew
#

This is basically what I need.
These three NBT data, and one of them is Inventory[0].tag.GunId.

wintry cradleBOT
# wise dew This is basically what I need. These three NBT data, and one of them is Inventor...

Perfect, you already have the exact NBT path you need (Inventory[0].tag.GunId). You don’t have to open the inventory; Spiffy can read that path directly while the weapon is in your hotbar slot.

Here’s the clean setup:

  1. Use the Player NBT Data placeholder to read the value:

    {"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"Inventory[{Slot:0b}].tag.GunId","return_type":"string"}}
    

    Adjust the slot number or selector if your active weapon is in a different slot (you can also nest the active_hotbar_slot placeholder to target whatever slot is selected).

  2. Store that string in a FancyMenu variable via a Ticker (set it every tick so it updates when you switch weapons).

    • Ticker action: Set Variable Valuecurrent_weapon_id:<?placeholder above?>
    • Wrap it in an If requirement that only runs when the placeholder returns non-empty so it doesn’t reset on empty hands.
  3. Point your HUD Image element at that variable.

    • Example source: /config/fancymenu/assets/weapons/{"placeholder":"getvariable","values":{"name":"current_weapon_id"}}.png
    • Drop PNGs named after each GunId (e.g., tacz:ak47.png).
  4. Add a loading requirement (Is Text contains or Is Number) so the image only shows once the variable has a value.

This approach keeps you out of the vanilla inventory screen while still reading the mod’s custom NBT data. For a refresher on the NBT placeholder and using variables, see the docs here:

wise dew
#

Now it throws me the variable.
tacz:[id_weapon]

And of course I don't want it with its mod ID.
Which would be tacz

wintry cradleBOT
# wise dew Now it throws me the variable. tacz:[id_weapon] And of course I don't want it w...

You can strip the namespace with a small placeholder trick before storing the variable.

  1. In your Ticker (or wherever you set current_weapon_id), wrap the NBT placeholder in a replace_text placeholder to remove the tacz: prefix:
    {"placeholder":"replace_text","values":{
      "text":"{"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@s","nbt_path":"Inventory[{Slot:0b}].tag.GunId","return_type":"string"}}",
      "search":"tacz:",
      "replacement":"",
      "use_regex":"false",
      "replace_all":"true"
    }}
    
  2. Store THAT result in the variable instead of the raw placeholder. Now current_weapon_id will be id_weapon without the tacz: prefix.

This keeps your Image lookup simple (just .../weapons/{"placeholder":"getvariable","values":{"name":"current_weapon_id"}}.png). For more placeholder helpers, check the placeholder docs.

#
Thread Marked as Solved

This support thread has been marked as solved by @wise dew.

The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!

#

✅ | It is possible to add an image of the HUD for the weapons in the Tacz mod.Do not use the inve...