WeightedPlacedFeature .java

net.minecraft.world.level.levelgen.feature.WeightedPlacedFeature (record, 23 lines): members: feature, chance, place, CODEC. strings: "chance", "feature".

net.minecraft.world.level.levelgen.featurerecord23 linescommon1.0 KB

API Surface (2)

record WeightedPlacedFeature(Holder<PlacedFeature> feature, float chance)
boolean place(final WorldGenLevel level, final ChunkGenerator chunkGenerator, final RandomSource random, final BlockPos origin)

Fields & Constants (1)

CODEC

String literals (2)

"feature"
"chance"

Code Graph: Dependencies (6)

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

Full Source

WeightedPlacedFeature.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.feature;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.core.Holder;
7
import net.minecraft.util.RandomSource;
8
import net.minecraft.world.level.WorldGenLevel;
9
import net.minecraft.world.level.chunk.ChunkGenerator;
10
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
11
12
@Deprecated
13
public record WeightedPlacedFeature(Holder<PlacedFeature> feature, float chance) {
14
	public static final Codec<WeightedPlacedFeature> CODEC = RecordCodecBuilder.create(
15
		i -> i.group(PlacedFeature.CODEC.fieldOf("feature").forGetter(f -> f.feature), Codec.floatRange(0.0F, 1.0F).fieldOf("chance").forGetter(f -> f.chance))
16
			.apply(i, WeightedPlacedFeature::new)
17
	);
18
19
	public boolean place(final WorldGenLevel level, final ChunkGenerator chunkGenerator, final RandomSource random, final BlockPos origin) {
20
		return this.feature.value().place(level, chunkGenerator, random, origin);
21
	}
22
}
23

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