BinaryProvider .java

net.minecraft.world.level.storage.loot.providers.number.BinaryProvider (interface): members: Validatable, mapCodec, valueCodec, Factory, right, left.

net.minecraft.world.level.storage.loot.providers.numberinterface35 linescommonextends Validatable>1.2 KB

API Surface (0)

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

Fields & Constants (2)

Validatable
valueCodec

String literals (2)

"left"
"right"

Code Graph: Dependencies (4)

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

Full Source

BinaryProvider.java35 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 BinaryProvider<Value extends Validatable> extends Validatable {
11
	static <Value extends Validatable, Self extends BinaryProvider<Value>> MapCodec<Self> mapCodec(
12
		final Codec<Holder<Value>> valueCodec, final BinaryProvider.Factory<Value, Self> factory
13
	) {
14
		return RecordCodecBuilder.mapCodec(
15
			i -> i.group(valueCodec.fieldOf("left").forGetter(BinaryProvider::left), valueCodec.fieldOf("right").forGetter(BinaryProvider::right))
16
				.apply(i, factory::create)
17
		);
18
	}
19
20
	@Override
21
	default void validate(final ValidationContext context) {
22
		Validatable.validateHolder(context, "left", this.left());
23
		Validatable.validateHolder(context, "right", this.right());
24
	}
25
26
	Holder<Value> left();
27
28
	Holder<Value> right();
29
30
	@FunctionalInterface
31
	interface Factory<Value extends Validatable, Self extends BinaryProvider<Value>> {
32
		Self create(Holder<Value> left, Holder<Value> right);
33
	}
34
}
35

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