CountPlacement .java

net.minecraft.world.level.levelgen.placement.CountPlacement (record): members: count, codec, CODEC. strings: "count". imports: ConstantInt, IntProviders.

net.minecraft.world.level.levelgen.placementrecord31 linescommon955 B

Implements

API Surface (4)

CountPlacement of(final IntProvider count)
CountPlacement of(final int count)
int count(final RandomSource random, final BlockPos origin)
MapCodec<CountPlacement> codec()

Fields & Constants (1)

CODEC

String literals (1)

"count"

Code Graph: Dependencies (6)

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

Full Source

CountPlacement.java31 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.placement;
2
3
import com.mojang.serialization.MapCodec;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.util.RandomSource;
6
import net.minecraft.util.valueproviders.ConstantInt;
7
import net.minecraft.util.valueproviders.IntProvider;
8
import net.minecraft.util.valueproviders.IntProviders;
9
10
public record CountPlacement(IntProvider count) implements RepeatingPlacement {
11
	public static final MapCodec<CountPlacement> CODEC = IntProviders.codec(0, 4096).fieldOf("count").xmap(CountPlacement::new, CountPlacement::count);
12
13
	public static CountPlacement of(final IntProvider count) {
14
		return new CountPlacement(count);
15
	}
16
17
	public static CountPlacement of(final int count) {
18
		return of(ConstantInt.of(count));
19
	}
20
21
	@Override
22
	public int count(final RandomSource random, final BlockPos origin) {
23
		return this.count.sample(random);
24
	}
25
26
	@Override
27
	public MapCodec<CountPlacement> codec() {
28
		return CODEC;
29
	}
30
}
31

Decompiled Minecraft 26.3 source of CountPlacement (net/minecraft/world/level/levelgen/placement/CountPlacement.java) with Mojang official mappings, stored verbatim on the site.