Compound Key Reader - Simple NBT Compound Reading
This modification allows easy access to information from NBT compound structures in Minecraft. Now you can efficiently work with keys and data within complex NBT objects.
Command Usage
function compound_key_reader:get {data:{from/value:...},result:'<ResultFunction>'}
The result is saved as a list format in storage compound_key_reader:result keys. Each list element contains information about the key, value, and sequence in the format:
[
{ "value": "(value)", "key": "(key)", "seq": "(sequence)" },
...
]
Result Processing Functions
Result processing functions are automatically called by the main module to format output data. They can be used similarly to a foreach() loop.
Important: Do not use compound_key_reader:get inside result processing functions!
Available Parameters and Return Values:
| Type | Parameter | Description |
|---|---|---|
| Arguments | c |
Element count |
| Arguments | l, r |
Current substring |
| Arguments | key |
Key name |
| Return | 0 or VOID |
No result |
| Return | +1 |
Save substring cur((l,r]) in xx.cur |
| Return | +2 |
Save key name in xx.key |
| Return | +4 |
Save key value in xx.value |
| Return | +8 |
Save sequence in xx.seq |
Preset Options:
compound_key_reader:result_preset/key- key + sequencecompound_key_reader:result_preset/key-value- key + value + sequencecompound_key_reader:result_preset/all- complete information
Substrings: Use string storage compound_key_reader:result str $(l) $(r) to get the key.
Version Upgrades
To upgrade from versions <=Beta2.0 to >=Beta2.1, refer to the UPGRADE.1.md file