RangeProvider .java

net.minecraft.world.level.storage.loot.providers.number.RangeProvider (interface): members: Validatable, mapCodec, valueCodec, Factory, min, max, validate.

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

API Surface (0)

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

Fields & Constants (2)

Validatable
valueCodec

Code Graph: Dependencies (4)

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

Full Source

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

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