NBT Data placeholder always returns nothing
joel4848 opened this issue · 1 comments
(latest.zip because the bug report asked for it, though I'm 99.9% sure there's nothing useful in there. I had to zip it because, unzipped, it's >50mb somehow)
Describe the bug
Using the NBT Data placeholder appears to always return nothing. I have tested:
- Armor stand
- Marker entity
- Chicken
- Myself
I've tested with a variety of keys including Tags, Pos[0], foodLevel (the default one in the example Placeholder).
I'm certain that the selectors I used are correct.
The 'explain like I'm 5 years old' you asked for (sorry if this isn't what you meant):
Every entity in Minecraft (mobs, items, players, etc.) is stored as a big block of NBT data.
Think of it as a tree. Inside it are 'keys'; each key stores something about the entity — its position, health, name, tags, etc. The keys have specific names e.g. Health, Tags, Pos, Rotation etc. Keys can hold numbers, text, list, more nested objects etc. You can use /data get to read the whole blob, or specific keys
Getting the entity’s whole NBT
Summon a chicken named test:
/summon minecraft:chicken ~ ~ ~ {CustomName:'"test"'}Then get the chicken's NBT:
/data get entity @e[type=minecraft:chicken,limit=1,sort=nearest,name=test]Example output:
[Entity data: {
id: "minecraft:chicken",
CustomName: "\"test\"",
Health: 4.0f,
Pos: [123.0d, 64.0d, -45.0d],
Motion: [0.0d, 0.0d, 0.0d],
UUID: [I; 123456, 789012, 345678, 901234],
...other keys...
}]
Getting a specific key from the NBT
The Pos key stores the entity’s position as an array: [x, y, z]. To get just the X coordinate:
/data get entity @e[type=minecraft:chicken,limit=1,sort=nearest,name=test] Pos[0]Example output:
123.0d
To Reproduce
- Summon a chicken with the CustomName test (or rename one 'test' with a nametag)
- Create an FM text box with the placeholder
{"placeholder":"nbt_data_get","values":{"source_type":"entity","entity_selector":"@e[type=minecraft:chicken,name=text,limit=1]","nbt_path":"Health","return_type":"value"}}as its text content - Create an FM button with the action send chat message, with the same placeholder as #3.
- Enter GUI - text box is blank. Press button - a blank chat message is sent.
Expected behavior
Text box contains 4f and chat message says 4f
Game Log
Please always include your .minecraft/logs/latest.log file right after the issue happened.
Please don't send the whole log as plain text here. Upload the file to https://gist.github.com and send the link.
DON'T SEND LOG SNIPPETS OR CRASH LOGS, PLEASE SEND THE WHOLE LATEST.LOG FILE!
Screenshots
If screenshots would help to explain the issue, please include these.
Basic Information (please complete the following information):
- Windows
- FancyMenu 3.6.4
- Fabric 0.16.10
- Minecraft 1.21.1
- Active Mods - see latest.log
A bit of an update on this - I can get an output but only if I use the selectors @s, @p and @e on their own i.e. not with anything else like tag, limit, customname etc.
If I try and get nbt data from a block then my logs spam the error from logger e.g. [FANCYMENU] Error in nbt_data_get placeholder: Found no elements matching id if the block_pos is correct - if I put incorrect coordinates in nothing appears in the logs. So, it's finding the chest, but not the NBT data.