CraftTweaker

CraftTweaker

151M Downloads

Nullpointer excepting when using recipes.all, recipe.commandString and Tinkers' Construct

Guinaro opened this issue ยท 0 comments

commented

Issue Description:

Printing out the list of recipes provided by the function recipes.all results in a Nullpointer Exception when using crafttweaker together with Tinker's Construct.
See end of crafttweaker.log
Error seems related to recipe.commandString.

What happens:

From log

...
[INITIALIZATION][CLIENT][INFO] common/metals/knightslime/knightslime_block recipes.addShaped("tconstruct:common/metals/knightslime/knightslime_block", <tconstruct:metal:3>, [[null, null, null], [null, null, null], [null, null, null]]);
[INITIALIZATION][CLIENT][ERROR] [crafttweaker]: Error executing {[0:crafttweaker]: test.zs}: null
java.lang.NullPointerException
	at crafttweaker.mc1120.recipes.MCRecipeWrapper.toCommandString(MCRecipeWrapper.java:77)
	at Functions\RecipeFunctions.PrintAllRecipes(Functions\recipeFunctions.zs:8)
	at Test.__script__(test.zs:6)

I added the isNull test to my script but it results in the same error. Tinker's Construct is adding a recipe that generates an Nullpointer exception when converting the recipe to a commandstring.
And I seem unable or do not know enough Zenscript (checked the docs!) to catch this error.
The error doesn't happen when running crafttweaker alone!
It is something I would like to report to Tinkers' Construct aswell, but in any case. We need to be able to catch erroring recipes without crashing with a NPE.

What you expected to happen:

Using recipe.commandString should result in an empty string or a returned null so that we can test for isNull on recipe.commandString.

On a seperate note, some try{} catchError{} system would be nice, especially when starting to mess around with Functions. This way, at least we could properly debug our scripts.

Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):

test.zs
https://gist.github.com/Guinaro/9a41a457de24af668ed77e1bdd45cda6
and
Functions/recipeFunctions.zs
https://gist.github.com/Guinaro/eb86cb54956836e991eb1c8f1f8c613a

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/Guinaro/03a9b9151804e42af467fb7c3cbafe19


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.2.2618
  • Crafttweaker: 1.12-4.1.5
  • Tinkers' Construct: 1.12.2-2.9.1.65

Your most recent log file where the issue was present:

https://gist.github.com/Guinaro/e9dbaa002c0ea436be34bb2e69573fcc