-
Notifications
You must be signed in to change notification settings - Fork 150
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
[BUG] New implementations on InputIngredient error on null stacks #1439
Comments
This might be something to fix on CraftTweaker's end. |
Thank you for informing us about this issue. This is not good and should be fixed. @eutropius225 Can you please elaborate on this? |
The issue is representing nonConsumable ingredients in crafttweaker. In particular the integrated circuits. GT's InputIngredent class does:
But here getCount() is zero because the ingredient is not consumed. Crafttweaker effectively does a
Then validates it with a call to ItemStack.isEmpty() which throws that misleading error about it being null. There are 3 possbile workarounds we can do in GT that I can see:
|
Well canonically unconsumed ingredients are represented as having a count of 1 and just not being consumed. Having an ingredient with a count of 0 sounds absurd, why is it even there if 0 is required from it? |
because it needs to be there, just like items that are not consumed? Ingredient with zero count represents non-consumable item, that's it. |
Of course, unconsumed ingredients need to be represented somehow. I'm just saying that using What does it mean to say "this recipe takes as input 0 cobblestone"? Is that actually, well, zero cobblestone, so it doesn't require cobblestone? Does it need at least one cobblestone as a catalyst? Does it require a stack of it? In this case it's the second, you need one, but it's not consumed. Why can't there just be an extra flag on |
Because CountableIngredient is literally IIngredient with a count, that's it? It doesn't care how you interpret count or ingredient object in question, it's just a simple data holder class that you can use for whatever reason. It was never intended to be mapped to CT ingredient representation or back, neither it was ever supposed to be operated on directly. It's just an internal representation recipe system is using, there are wrapper methods like notConsumable which abstract it away. Besides, original Ingredient implementation in Minecraft does NOT define any standards or utilities for counting ingredients or checking their amounts. CraftTweaker's ability to set amount of ingredients is purely it's own extension to the standard system, and you should NOT expect it to be compatible with anything else if you just blindly map one data object to another. |
For reference, CT represents the wildcard ingredient as -1, i.e. negative 1 items :-) |
Actually, other mods (non-GregTech) are solving this problem on some way and maintaining compabibility with CraftTweaker. There is a lot of mods that use catalytic items in ingredients. I am not a mod developer, but I am curious if others can solve this issue without breaking the compatibility, what could prevent GregTech to do same? I am not trolling, I am genuiely curious. Also, Minecraft itself also has a replaceable ingredient (where a bucket of milk become a bucket), what if you replace the non-consuming item with itself? |
Describe the bug
Whenever you call the method
recipe.inputs
and the stack is null it'll error.Versions
GTCE: Latest
Setup
Errors on load up with CraftTweaker scripts.
Steps To Reproduce
wrote ```import mods.gregtech.recipe.RecipeMap;
for machine in RecipeMap.getRecipeMaps() {
for recipe in machine.recipes {
var inputs = recipe.inputs;
if(inputs.length > 0) {
for input in inputs {
print(input.commandString);
}
}
}
}```
And the log is,
The text was updated successfully, but these errors were encountered: