CraftTweaker

CraftTweaker

151M Downloads

Another NPE when calling recipes.getRecipesFor(IIngredient)

codetaylor opened this issue ยท 1 comments

commented

Issue Description:

recipes.getRecipesFor(<ore:ingotGold>);

This fails when iterating the recipes because not all recipes have a recipe output. For example, calling RecipesArmorDyes#getRecipeOutput() will return an empty item stack which is in turn translated to null by CraftTweakerMC::getIItemStack(ItemStack).

The call to CraftTweakerMC::getIItemStack(ItemStack) in this line returns null and when that null value is passed into IIngredient#matches(IItemStack), an NPE is thrown on this line because iitem is null.

I don't feel comfortable submitting PR's to this project because I don't understand the code base well enough to navigate the potential far-reaching implications of changing a small piece of code. Therefore, I defer to those who do.

Script used:

recipes.getRecipesFor(<ore:ingotGold>);

crafttweaker.log:

https://gist.github.com/codetaylor/2b9e1f0ead0dccf1546600a8652223d1


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 1.12.2-14.23.0.2546
  • Crafttweaker: code at commit c47ea6a
commented

Thank you!