public void TakeOrDamage(InWorldCraftingRecipe recipe, ItemSlot slot, IPlayer byPlayer) { if (recipe.IsTool) { slot.Itemstack.Collectible.DamageItem(byPlayer.Entity.World, byPlayer.Entity, slot); } else { slot.TakeOut(recipe.Tool.StackSize); } }
public bool IsValid(IPlayer byPlayer, InWorldCraftingRecipe recipe, ItemSlot slot) => (slot.Itemstack?.Collectible?.Code?.WildCardMatch(recipe?.Tool?.Code, slot.Itemstack.Collectible.ItemClass, byPlayer.Entity.World.Api) ?? false && slot.Itemstack?.StackSize >= recipe.Tool.StackSize) || (recipe.Tool.Code.IsWildCard && recipe.Tool.Code.GetMatches(byPlayer.Entity.Api).Any(t => t.ToString() == slot.Itemstack?.Collectible?.Code?.ToString() && slot.Itemstack?.StackSize >= recipe.Tool.StackSize)) && ((recipe.Tool.Attributes != null) && (recipe.Tool.Attributes == slot.Itemstack?.Collectible?.Attributes));