"Missing function/condition, expected to find string"
SeriousCreeper opened this issue · 4 comments
Describe the bug
I've been trying to modify an entities loot table that uses a custom function and condition, but having trouble to get it working properly. I copied the function and condition json directly from the loot table dump, only modified what item it's suppose to drop.
This is my current entry:
pool.addItemEntry(<pyrotech:generated_slag_syrmorite>, 3, 0, [{
"function": "thebetweenlands:set_count_from_anadia",
"size_start": 0.125,
"size_end": 0.95,
"min_count": 4,
"max_count": 8
}], [{
"condition": "entity_properties",
"entity": "this",
"properties": {
"thebetweenlands:anadia_body_type": 0
}
}]);
But after restarting i get the message "Missing condition, expected to find string". Sometimes it says "missing function" instead.
Dumping the loot table after my modification shows this:
{
"entryName": "loottweaker#1",
"weight": 3,
"quality": 0,
"conditions": [
{
"properties": {},
"entity": "this",
"condition": "minecraft:entity_properties"
}
],
"type": "item",
"functions": [
{
"size_start": 0.125,
"size_end": 0.95,
"min_count": 4,
"max_count": 8,
"function": "thebetweenlands:set_count_from_anadia"
}
],
"name": "pyrotech:generated_slag_syrmorite"
}
For the most part everything got copied over properly, except for the properties field, which is empty.
Any idea what i might be doing wrong?
Cheers!
Version Info (Exact versions only):
LootTweaker: LootTweaker-0.3.0+MC1.12.2.jar
CraftTweaker/Minetweaker: CraftTweaker2-1.12-4.1.20.660.jar
Forge: 2854
Minecraft: 1.12.2
It's a known issue with 0.3.0. The new parser breaks when the passed JSON object contains another JSON object, a scenario not covered by LootTweaker's test suite. ZenScript tries to deserialise the nested object as another condition/function, instead of parsing the whole thing at once.
I've yet to have the time and motivation to look into it further, but Uni is calming down so I should be able to soon.
Unfortunately the deprecated methods use the new parser too, so they have the same issue. The only "solution" is downgrading to 0.2.0.
Ahh that makes a lot of sense, was wondering if it was the nested one. Okay cool i'll switch to 0.2.0 in the meantime then. And no worries, totally understand the lack of motivation/time part.
Found time to take a look at this, but I'm utterly stumped. I know what's happening, but not how to fix it.
I've created a variant of 0.3.0 with the old parsing system so that users can benefit from 0.3.0's bugfixes. It's available here and will be on CurseForge soon.