1. I've alreadt tried:
    Code:
            private void OnItemCraftFinished(ItemCraftTask task, Item item)
            {
                return;
            }
    
    Code:
            private void OnItemCraftFinished(ItemCraftTask task, Item item)
            {
                item.amout = 0;
            }
    And when I try to use the OnItemCraft
    Code:
    OnItemCraft(CraftingInventory inventory, BlueprintDataBlock blueprint, int amount, ulong startTime)
    hook I get: "The type or namespace name `BlueprintDataBlock' could not be found. Are you missing an assembly reference?"
     
  2. Use
    Code:
    void OnItemCraft(ItemCraftTask item)
    {
    Puts("OnItemCraft works!");
    }
    Just return an empty ItemCraftTask
     
  3. Did you mean this?
    Code:
    void OnItemCraft(ItemCraftTask item)
    {
    item.amount = 0;
    }
     
  4. You need to actually return that item then.
    return item;
     
  5. Calytic

    Calytic Community Admin Community Mod

    CraftingController and ComponentBlocker both do this. Here is the method from ComponentBlocker

    Code:
    object OnItemCraft(ItemCraftTask task)
    {
        ItemDefinition def = task.blueprint.targetItem;    if (isBlocked(def.displayName.english, def.shortname)) // check if the item being crafted is blocked (reference ComponentBlocker)
        {
            task.cancelled = true;        return false; // cancels crafting of item
        }    return null; // does nothing, continue crafting
    }