LootTweaker

LootTweaker

17M Downloads

Missing Documentation

WesCook opened this issue ยท 5 comments

commented

This isn't a bug, per se, but a request to add some missing documentation to the Wiki. Specifically the syntax for conditions and functions seems to be missing.

It doesn't need to be anything elaborate, but even adding an example or two would be a big help.

commented

You mean the syntax for JSON conditions/functions? That's detailed in the MC wiki article I link in Getting Started.

commented

Do you mean the "Tags" section on the MC wiki article? Even knowing the general tree structure, it's tough to know how the JSON may look when entered into scripts. Perhaps because I've not used them with command blocks before, so I'm not used to the syntax.

But just to ask more directly, is the parent tag "functions" (or "conditions") tag used directly in the script, or just the naked curly braces? Do I wrap them in square brackets, so it's an array of JSON trees? Something like:

addItemEntry(<minecraft:skull>, 500, 0, [{
    "functions":  [
            {
              "count": {
                "min": 0.0,
                "max": 2.0
              },
              "function": "minecraft:set_count"
            }
    ]
}]);

I've tried a number of things but to no avail. This was cobbled together from looking at the loot table dumps. An example to understand the syntax would be very helpful.

commented

LootTweaker expects conditions/functions as an array of JSON strings or helper class methods, not a single JSON element. If you are using JSON strings, you need to ensure that they are strings(i.e wrapped in quotes). This means you need this

""count": {
                "min": 0.0,
                "max": 2.0
              },  "function": "minecraft:set_count""

not this

"count": {
                "min": 0.0,
                "max": 2.0
              },  "function": "minecraft:set_count"

I'll add this to the documentation. You may want to look at the helper classes, they make it much easier to use simple conditions and functions. Note that if you wish to mix JSON and helper class methods, you need to use the Mixed variant of the LootPool method(e.g addItemEntryMixed instead of addItemEntry).

commented

It's now documented on the Loot Pools page.

commented

Thanks Leviathan, that's exactly what I needed to know.

Looks like I shouldn't be using JSON in most cases, but still good to know how when I need to.