Skip to content

CanCraft

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void CanCraft( ItemCrafter instance, ItemBlueprint bp, int amount, bool free )
{
    Puts( "CanCraft works!" );
}
csharp
private void CanCraft( PlayerBlueprints instance, ItemDefinition itemDefinition, int skinItemId )
{
    Puts( "CanCraft works!" );
}

Location

  • ItemCrafter::CanCraft(ItemBlueprint bp, int amount, bool free)
  • PlayerBlueprints::CanCraft(int itemid, int skinItemId, ulong playerId)
csharp
//---
	}
	if (num > 8f)
	{
		return false;
	}
	object returnvar = Interface.CallHook("CanCraft", this, bp, amount, free);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	if (amount < 1 || amount > bp.targetItem.craftingStackable)
//---
csharp
//---
	ItemDefinition itemDefinition = ItemManager.FindItemDefinition(itemid);
	if (itemDefinition == null)
	{
		return false;
	}
	object returnvar = Interface.CallHook("CanCraft", this, itemDefinition, skinItemId);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return (skinItemId == 0 || base.baseEntity.UnlockAllSkins || this.CheckSkinOwnership(skinItemId, playerId)) && base.baseEntity.currentCraftLevel >= (float)itemDefinition.Blueprint.workbenchLevelRequired && this.HasUnlocked(itemDefinition);
//---

Released under the MIT License.