API reference Obsidian.API.Loot.Functions
LootFunction class
Modifies a generated item stack, like vanilla's LootItemConditionalFunction. Functions run in order and each receives the stack the previous one returned.
public abstract class LootFunction
In Obsidian.API.
Constructors
protected LootFunction();Properties
Conditions
public ImmutableArray<ILootCondition> Conditions { get; init; }The function only runs when all of these pass.
Methods
Apply(ItemStack, LootContext)
public ItemStack Apply(ItemStack stack, LootContext context);Runs the function if its conditions pass and returns the resulting stack, which may be a new instance.
ApplyAll(ImmutableArray<LootFunction>, ItemStack, LootContext)
public static ItemStack ApplyAll(ImmutableArray<LootFunction> functions, ItemStack stack, LootContext context);Applies functions in order.
Decorate(ImmutableArray<LootFunction>, Action<ItemStack>, LootContext)
public static Action<ItemStack> Decorate(ImmutableArray<LootFunction> functions, Action<ItemStack> output, LootContext context);Wraps output so every stack passes through functions first.
protected abstract ItemStack Run(ItemStack stack, LootContext context);