Substring custom variable parameters don't work

Upvotes: 0
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

Submitted by Klemen on Wed, 02/13/2019 - 15:19

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

Submitted by Klemen on Sat, 02/23/2019 - 14:45

This bug will be fixed in MCreator 1.8.3. I am closing this ticket now.