Invalid-inputs mishap from Thoth reads the stack backwards
Robotgiggle opened this issue · 0 comments
Modloader
Fabric
Minecraft version
1.20.1
Hex Casting version
0.11.1-7-pre-634
Modloader version
Fabric: loader 0.15.9, api 0.92.1+1.20.1
Modpack info
HexxyTest (https://github.com/walksanatora/HexxyTestPack)
The latest.log file
No response
Issue description
When you attempt to cast a pattern without having the correct input types on the stack, you'll get a mishap message saying <spell>: expected a <type> at index <number> of the stack, but got <actual value>
. Normally, the index in this message counts down from the top of the stack – ie, if the topmost iota is the problem it'll say "index 0" and if the second iota down is the problem it'll say "index 1".
However, when the pattern triggering the mishap is Thoth's Gambit, it acts differently. It seems to count the indices from the bottom of the stack instead of the top, with the lowest iota being "index 0" and the top two (which are the only ones thoth actually cares about) being "index N-1" and "index N-2" with N as the current size of the stack.
Even stranger, the actual effect of the mishap (that is, replacing the problematic iota with Garbage) seems to be reading this incorrect number according to the normal system. If Thoth's Gambit gets an incorrect type at the top of a stack of 5 iotas, the mishap message will read "index 4" and then replace the iota which is actually at index 4 (the one all the way at the bottom) with Garbage.
Steps to reproduce
- Push any number of iotas onto the stack, making sure that at least one of the top two is not a valid input for Thoth's Gambit
- Cast Thoth's Gambit, and observe that an iota all the way at the bottom of the stack gets Garbage'd instead of one of the top two
- Cast any other pattern for which the top iotas are not valid, and observe that the correct iota gets Garbage'd
Other information
A full video demonstration of the bug can be found here: https://imgur.com/a/wHALWxN