
[1.21] Recipes that have a DamageCraftingRemainderModifier do not work
Closed this issue ยท 1 comments
Any recipe that uses DamageCraftingRemainderModifier has no crafting output, like converting logs to lumber with a saw.
from what i can tell this is caused by the AdvancedShaplessRecipe needing a primary ingredient which none of the "damageInputs" recipes have. Then the DamageCraftingRemainderModifier is trying to modify the items in the stack (which seems to be air?) and not the items in the input. Fixing these seemed to fix the lumber recipe, but made the pressure plate recipe with the chisel act weird, but I think that is because that recipe is using AdvancedShapedRecipe and not the AdvancedShapelessRecipe (it looks fine but when i take the pressure plate from the output another pressure plate can be taken from the output which then makes the chisel disappear until you put the second pressure plate in your inventory which then makes the chisel reappear).
from_logs recipe with primary input:
recipe("from_logs") .inputIsPrimary(TFCTags.Items.TOOLS_SAW) .input(logsTagOf(Registries.ITEM, wood)) .damageInputs() .shapeless(lumber, 8);
DamageCraftingRemainderModifier with my changes:
public ItemStack apply(ItemStack stack, ItemStack input, Context context) { if (input.isDamageableItem()) { final ItemStack copy = input.copy(); final @Nullable Player player = RecipeHelpers.getCraftingPlayer(); if (player != null) { Helpers.damageItem(copy, player.level()); } else { Helpers.damageItem(copy); } return copy; } else if (input.has(DataComponents.UNBREAKABLE)) // unbreakable items are not damageable, but should still be able to be used in crafting { return input.copy(); } else if (input.hasCraftingRemainingItem()) { return input.getCraftingRemainingItem(); } else { return ItemStack.EMPTY; } }
but i could be totally wrong.