CraftTweaker

CraftTweaker

151M Downloads

NullPointerException when trying to craft a recipe with copied NBT

Insane96 opened this issue ยท 2 comments

commented

Issue Description:

Trying to copy over NBT from a marked IIngredient to output and trying to craft said recipe gives a NullPointerException

What happens:

NullPointerException when trying to craft a recipe with NBT copied over

What you expected to happen:

No errors and the crafting to happen

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

https://hastebin.com/akunokinuq.cs

crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):

https://hastebin.com/ujawufijik.md


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2824
  • Crafttweaker: 1.12-4.1.17
  • Using a server: No

Your most recent log file where the issue was present:

Same as before: https://hastebin.com/ujawufijik.md

commented

As Kindlich said, you need to change your script, on line 28:

ingredients[1][1].marked("copyNBT");

should be:

ingredients[1][1] = ingredients[1][1].marked("copyNBT");
commented

Marked returns a new IIngredient object, so you need to reassign the result of the marked call to the array