CraftTweaker

CraftTweaker

151M Downloads

[3.0.15] TransformConsume doesn't seem to properly decrement stacks

belathus opened this issue ยท 1 comments

commented

I know it isn't in the wiki; I'm referencing the code here: https://github.com/jaredlll08/CraftTweaker/blob/master/MineTweaker3-API/src/main/java/minetweaker/api/item/IngredientTransform.java#L98-L116

    recipes.addShapeless(<primal:flint_hatchet>, 
        [<primal:flint_hatchet>.anyDamage().marked("hatchet").noReturn(), <druidry:branch>.transformConsume(1)],
        function(output, inputs, crafting) {
            return inputs.hatchet.withDamage(max(0, inputs.hatchet.damage - 50)).withTag(inputs.hatchet.tag);
        });

So, the recipes I'm trying to make involve repairing at item. For some reason, it will not properly reduce the size of the stack at all with the recipe I'm using, nor will it destroy the tool original item I'm trying to repair, so I am using .noReturn() on the tool and trying to use .transformConsume(1) on the other items. with one item in the stack, the recipe more-or-less works, consuming the one item in the stack (though, it returns a stack with zero items). With two items in the stack, no items are consumed. With three or more items in the stack, the stack size gets larger.

So, I tried to find a different method. I did notice that in the above link that the comment suggests trying to verify that the stack has enough items to consume the required amount of items for the recipe. However, I couldn't find a way to do that. .withAmount(2) presumably only works for a stack of 2, but I couldn't get that to work in my recipe because it is an ore dictionary entry rather than an itemstack.

Going back to trying to reduce the size of the stack by one, I tried using the function's "inputs.sticks.amount()" function, but there is no function that I could see that would return the original stack's size (IE: "inputs.sticks.getAmount()"). If you've any suggestions on how to fix this issue on my end, I'm all ears.

commented

fixed in alter versions