Interface ResourceCondition
public interface ResourceCondition
A resource condition. To create a custom condition type, implement this interface,
call
ResourceConditionType.create(net.minecraft.util.Identifier, com.mojang.serialization.MapCodec<T>)
and create the type, then register
via ResourceConditions.register(net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditionType<?>)
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<ResourceCondition> A codec for a resource condition.static final com.mojang.serialization.Codec
<ResourceCondition> A codec for parsing load conditions.static final com.mojang.serialization.Codec
<List<ResourceCondition>> A codec for a list of conditions. -
Method Summary
Modifier and TypeMethodDescriptiongetType()
boolean
test
(RegistryWrapper.WrapperLookup registryLookup) Tests the condition.
-
Field Details
-
CODEC
A codec for a resource condition. It is a map with acondition
key denoting the ID of the condition, and any additional values required by the specific condition. -
LIST_CODEC
A codec for a list of conditions. -
CONDITION_CODEC
A codec for parsing load conditions. Can either be an array of conditions or a single condition.
-
-
Method Details
-
getType
ResourceConditionType<?> getType()- Returns:
- the type of the condition
-
test
Tests the condition. The passed registry lookup, if any, includes all static and dynamic entries. However, the tags are not loaded yet.- Parameters:
registryLookup
- the registry lookup, ornull
in case registry is unavailable- Returns:
- whether the condition was successful
- Implementation Note:
registryLookup
should never benull
for supported use cases (such as recipes or advancements). However, it may benull
in client-side resources, or for non-vanilla resource types.
-