Closed hanleybrand closed 4 years ago
I notice you are passing an array of IItemStack
to matchBlocks(string[])
. Broken blocks are matched against block strings which describe an in-world blockstate.
More info here: https://dropt.readthedocs.io/en/latest/blockstrings/ Discord: http://discord.codetaylor.com
Can you recommend a good strategy for something like this? I realize a lot of my issue is not being super familiar with zen script, but the types are pretty confusing, and there don't seem to be standardized methods for any of them (like .asBlock() or .toString()).
Should I make the array from
If it were me, I'd just change your values to the appropriate strings.
CraftTweaker has a Discord with a lot of knowledgeable people over there, I recommend checking it out: https://discord.blamejared.com
Issue Description
I am trying to replace block drops based on an associative array and a key/value loop but the loop causes the client to crash while loading. I put #debug at the top of my script
I know how to program in other languages, and know a little java but have very little zen script experience (sorry I'm pretty certain the issue is going to be something that should be obvious)
What Happens
The client fails to launch, the error is:
What You Expect to Happen
I expected it to not crash and for all of my code to work beautifully
Ha ha, no I was just hoping that the associative array loop would work, similar to the examples in the Zscript docs:
https://docs.blamejared.com/1.12/en/#AdvancedFunctions/Associative_Arrays/
except I'm basically trying to get like 8 or 9 fruit bush blocks that only drop themselves to also drop the fruits that one would expect if you break the blocks normally, but to drop themselves if broken by a shovel.
Script
Here is the script snippet that causes the crash (removing the loop fixes the crash), so it's not the associative array in itself -- I guess I should mention that
/ct syntax
reports no errors, but I know that's no guarantee something will actually work:I also tried just
key
andvalue
instead ofcrBerryBushes[key]
and/orcrBerryBushes[value]
full script at https://gist.github.com/hanleybrand/0cd9248bdf9d0f2064b7d31a9c66a3ac#file-dropt-zs
Crash Log
https://gist.githubusercontent.com/hanleybrand/0cd9248bdf9d0f2064b7d31a9c66a3ac/raw/3c63d7408125cd0d60af11940c11e947a6bf2ecf/debug.log
Affected Versions