A feedback area designed for scripting and mods suggestions and feedback. Please note bug reports and support issues will be removed.

33

Iterating nbt list using scoreboard scores

4 Comments

Please sign in to leave a comment.

Sorted by oldest
  • 1
    Registered User commented
    Comment actions Permalink

    NEED THIS TOO

  • 0
    Registered User commented
    Comment actions Permalink

    This is already possible through a workaround. First copy the list to another data, then simply keep removing the last item until you get to the item you want.

  • 0
    Registered User commented
    Comment actions Permalink

    This would allow players to store objects of information and retrieve them quickly and easily using a key that is represented by a scoreboard value attached to any player or entity.

    For instance we could write this chain of commands:
    scoreboard objectives add index dummy
    scoreboard players set @s index 17 data modify storage class ListField[@s index] set value {...}

    This feature would be incredibly useful for Minecraft players who enjoy creating complex datapacks and mods. It would allow them to store and retrieve large amounts of data quickly and easily, without the need for complex command chains or convoluted systems.

    I really want they to add this feature

  • 0
    Registered User commented
    Comment actions Permalink

    Possible using Function Macroes now! I use it a lot in data-heavy Datapacks. Like this:

    data modify storage example Iteration set from storage example Sample
    function iterate:example
    # iterate:example
    function iterate:stuff with storage example Iteration[0]
    data remove storage example Iteration[0]
    function iterate:example with Iteration[0]

    Whatever components are in each entry of Sample will be used as Macro Parameters in iterate:stuff. The loop ends when iterate:example fails, which should happen when Iteration[0] is empty because the each entry has been evaluated and removed. Yall go make some awesome datapacks now!!