"Bad type on operand stack" when updating String json to IData json
xerberus333 opened this issue ยท 6 comments
Description:
Updating string json to IData json is returning an error
Steps to reproduce:
- Loaded CraftTweaker2-1.12-4.1.4
- Loaded LootTweaker-1.12.2-0.0.7
- Used this test script and named it "l_mobs02.zs"
- Created a world
- Received this crafttweaker.log
Version Info (Exact versions only):
LootTweaker: 1.12.2-0.0.7
CraftTweaker/Minetweaker: 1.12-4.1.4
Forge: 14.23.2.2611
Minecraft: 1.12.2
Logs, scripts and other useful information:
l_mobs02.zs = test script used
crafttweaker.log = crafttweaker log
Using MultiMC 0.6.1-1177. No other mods besides Crafttweaker and Loottweaker were used.
Note: Scripts that replicate the issue while referring to a minimal number of mods or only vanilla are preferred.
They make debugging issues much simpler as I don't have to install large quantities of mods into my development workspace.
Thank you for your cooperation
ZS is trying to cast the IData to String, presumably because it's trying to use the deprecated method. Fortunately this is easily fixed with a cast. So just do this
lp01_elder_guardian.addItemEntryHelper(<minecraft:fish>, 3, 0, [Functions.setMetadata(0, 3),Functions.setCount(0,1),Functions.lootingEnchantBonus(0,1,64),Functions.parse({"condition": 'entity_properties', "entity": 'this', "properties": {"on_fire": true}, "function":'furnace_smelt'} as IData)], [Conditions.killedByPlayer()]);
This is technically fixable by changing the name of the new method, but considering the old method will disappear in a few months, fixing the problem, and that there's a simple solution in ZS, I don't see the point.
I noticed a slight difference with the Example script.
Conditions.parse({"condition": "entity_properties", "entity": "this", "properties": {"on_fire": true}})
You used double quotes where mine would have used singles. Ex. "entity_properties" and "this"
Will this affect anything?
@xerberus333 I don't think so, ZS accepts both single and double quotes as string delimiters to my knowledge.
Just wanted to let you know that this is wrong
Functions.parse({"condition": 'entity_properties', "entity": 'this', "properties": {"on_fire": true}, "function":'furnace_smelt'} as IData)
The mob will always drop cooked item.
This is the fixed one
Functions.parse({"function": "minecraft:furnace_smelt", "conditions": [{"properties": {"minecraft:on_fire": true}, "entity": "this", "condition": "minecraft:entity_properties"}]} as IData)