Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed CT 'inputs' getter, added 'nonConsumable' getter #1728

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TheDarkDnKTv
Copy link
Contributor

Closes #1439

What

While iterating recipes, in case recipe has non consumable ingredient (count = 0), it will crash. Crafttweaker has check for empty stacks.

How solved:

Added filtration of inputs, to provide only normal ingredients. Non consumables getter was missing, so I added it.

Outcome:

  • Fixed CT crash on calling Recipe.inputs.
  • Added CT getter for non consumable recipe inputs

Additional info:

Crash

java.lang.IllegalArgumentException: stack cannot be null
    at crafttweaker.mc1120.item.MCItemStack.<init>(MCItemStack.java:94)
    at crafttweaker.mc1120.item.MCItemStack.withAmount(MCItemStack.java:238)
    at crafttweaker.mc1120.item.MCItemStack.amount(MCItemStack.java:336)
    at crafttweaker.mc1120.item.MCItemStack.amount(MCItemStack.java:56)
    at gregtech.api.recipes.crafttweaker.InputIngredient.<init>(InputIngredient.java:23)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Iterator.forEachRemaining(Unknown Source)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.collect(Unknown Source)
    at gregtech.api.recipes.crafttweaker.CTRecipe.getInputs(CTRecipe.java:37)

ZenScript example

for recipe in RecipeMaps.BLAST_RECIPES.recipes {
  var ingredients = recipe.inputs;
}

Possible compatibility issue:

None, API changes only adds method, and fixing broken logic of one of old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] New implementations on InputIngredient error on null stacks
1 participant