UnaryProvider .java

net.minecraft.world.level.storage.loot.providers.number.UnaryProvider (interface): members: Validatable, valueCodec, Factory, input, validate, codec.

net.minecraft.world.level.storage.loot.providers.numberinterface29 linescommonextends Validatable>1.1 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (2)

Validatable
valueCodec

String literals (1)

"input"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

UnaryProvider.java29 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.storage.loot.providers.number;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.MapCodec;
5
import com.mojang.serialization.codecs.RecordCodecBuilder;
6
import net.minecraft.core.Holder;
7
import net.minecraft.world.level.storage.loot.Validatable;
8
import net.minecraft.world.level.storage.loot.ValidationContext;
9
10
public interface UnaryProvider<Value extends Validatable> extends Validatable {
11
	static <Value extends Validatable, Self extends UnaryProvider<Value>> MapCodec<Self> codec(
12
		final Codec<Holder<Value>> valueCodec, final UnaryProvider.Factory<Value, Self> factory
13
	) {
14
		return RecordCodecBuilder.mapCodec(i -> i.group(valueCodec.fieldOf("input").forGetter(UnaryProvider::input)).apply(i, factory::create));
15
	}
16
17
	Holder<Value> input();
18
19
	@Override
20
	default void validate(final ValidationContext context) {
21
		Validatable.validateHolder(context, "input", this.input());
22
	}
23
24
	@FunctionalInterface
25
	interface Factory<Value extends Validatable, Self extends UnaryProvider<Value>> {
26
		Self create(Holder<Value> input);
27
	}
28
}
29

Decompiled Minecraft 26.3 source of UnaryProvider (net/minecraft/world/level/storage/loot/providers/number/UnaryProvider.java) with Mojang official mappings, stored verbatim on the site.