[Feature Request] allow comparing IItemStacks in IF statements
belathus opened this issue ยท 3 comments
Issue Description:
I noticed that if statements were supported in CraftTweaker (the bottom of this page: http://minetweaker3.powerofbytes.com/wiki/ZenCode_specification). Well, that's great, but it seems to only works with integers and not IItemStacks or IIngredients, so I can't compare at item to, say, null to set a condition.
Why this would be useful: I am trying to set up a large two-dimensional array of every log, plank, wooden stair, and wooden slab to change all their recipes in one fell swoop, and avoid errors by using an if statement to avoid declaring recipes for items that don't exist (since not every mod implements wooden stairs for their woods). Sadly, trying to use a comparison for anything other than integers results in an error. I'm doing similar for ingots, plates, gears, nuggets, and blocks.
The script I'm using is below. In particular, I had to comment out lines 144, 172, and 178 to get the script to not error.
https://github.com/belathus/Wanderlust-Renewed/blob/master/scripts/items.zs
What happens:
My script generates an error
What you expected to happen:
recipes for null items are ignored
Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):
Minetweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):
https://gist.github.com/belathus/8250b6d3a9e03b3e80ebe7fec9487e0c
Affected Versions (Do not use "latest"):
- Minecraft: 1.10.2
- Forge: 12.18.3.2185
- Crafttweaker: 3.0.15
Your most recent log file where the issue was present:
https://gist.github.com/belathus/2fac5857898a434542994ff5b351ff18
try doing something along the lines of:
<minecraft:dirt>.matches(<minecraft:diamond>)
that should check if they match
I'll give that a shot; it sounds like half of what I need.
I have another related question and/or request: is it possible to check if a specific item exists, or if a specific ore dictionary has zero entries?
Finally, it seems I can't declare an array with a null object in it at all. Seems only one object type can be used per array. I think it was intended to introduce an "any" type specifically to get around this, but the first line of the minetweaker.log file specifically states that type has not yet been implemented.