Skip to content

API reference Obsidian.API.Data

NumberContext class

Inputs shared by context number providers in loot, recipes and other data-driven systems. Create one context per evaluation; providers themselves are immutable and reusable.

public sealed class NumberContext

In Obsidian.API.

Constructors

public NumberContext();

Properties

public int? EnchantmentLevel { get; init; }public Func<string, float?> FloatEnvironmentAttribute { get; init; }public Func<string, string, float?> FloatStorage { get; init; }public Func<string, int?> IntEnvironmentAttribute { get; init; }public Func<string, string, int?> IntStorage { get; init; }public required IRandomSource Random { get; init; }public Func<string, ContextFloatProvider> ResolveFloat { get; init; }public Func<string, ContextIntProvider> ResolveInt { get; init; }public Func<JsonElement, string, int?> Score { get; init; }

TestCondition

public Func<JsonElement, bool> TestCondition { get; init; }

Evaluates an inline predicate or predicate id in the caller's domain.

On this page