Substring custom variable parameters don't work

Published by DaanMC on
Status
Fixed
Issue description

Basically MCreator automatically makes custom variables a double, and that causes an error to happen when it is used as a 'from' or 'to' parameter in a substring block, as that block only accepts int's as parameters (makes sense). After a bit of research I have found a solution for this problem but it requires editing the code and therefore locking the element in the workspace, which can be quite frustrating if you're troubleshooting the procedure and constantly have to change the code again to remove overwritten pieces.

It would be nice if this gets fixed in a future update, it's a bug after all...

But anyways, here's the solution:

You want to go into the custom code of your element, having locked it, and change this:

CustomString.substring(CustomVariable, CustomVariable)

into this:

CustomString.substring((int)CustomVariable, (int)Customvariable)

forcing minecraft to read your variable as an int there instead of a double.

Issue comments

I can confirm that we have forgotten to add typecast. We will fix this bug in the next update.