IACondition¶
interface IACondition
A cross-loader condition, evaluated at datapack load time, that decides whether the entry it's attached to (a recipe, tag entry, etc.) should be active. Mirrors NeoForge's/Fabric's native condition systems but is decoded through CODEC so the same condition classes work on both loaders.
Built-in implementations live alongside this file (e.g. AAndCondition, AOrCondition, ANotCondition, ATrueCondition, AModLoadedCondition, ARegistryCondition); see ABuiltinConditions for the full set and archie-datagen's AConditionBuilder for a DSL to combine them. Register custom conditions with register.
Inheritors¶
Types¶
Companion¶
object Companion
IContext¶
interface IContext
Read-only view of loaded tags/registries available to test while a condition is evaluated.
Properties¶
codec¶
abstract val codec: MapCodec<out IACondition>
The codec used to (de)serialize this condition to/from JSON.
identifier¶
abstract val identifier: ResourceLocation
The condition type's registered id, matching the key it was registered under.
neoforge¶
Wraps this condition as a NeoForge ICondition. Public so archie-datagen can attach conditions to generated recipes.
val MapCodec<out IACondition>.neoforge: MapCodec<NeoForgeCondition>
Wraps this codec as a NeoForge condition-serializer codec.
Functions¶
test¶
abstract fun test(context: IACondition.IContext): Boolean
Evaluates this condition against context, returning whether it holds.