LootTweaker

LootTweaker

17M Downloads

"Bad type on operand stack" when updating String json to IData json

xerberus333 opened this issue ยท 6 comments

commented

Description:
Updating string json to IData json is returning an error

Steps to reproduce:

  1. Loaded CraftTweaker2-1.12-4.1.4
  2. Loaded LootTweaker-1.12.2-0.0.7
  3. Used this test script and named it "l_mobs02.zs"
  4. Created a world
  5. 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

commented

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.

commented

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?

commented

@xerberus333 I don't think so, ZS accepts both single and double quotes as string delimiters to my knowledge.

commented

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)

commented

Thanks for catching that, I hadn't noticed.

commented

The old method is gone now, so this issue should no longer occur.