MatchingBiomesPredicate .java

net.minecraft.world.level.levelgen.blockpredicates.MatchingBiomesPredicate (class): members: biomes, test, type, CODEC. strings: "biomes". imports: Biome.

net.minecraft.world.level.levelgen.blockpredicatesclass31 linescommon1.1 KB

Implements

API Surface (2)

boolean test(final LevelAccessor worldGenLevel, final BlockPos blockPos)
BlockPredicateType<?> type()

Fields & Constants (2)

CODEC
biomes

String literals (1)

"biomes"

Full Source

MatchingBiomesPredicate.java31 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.blockpredicates;
2
3
import com.mojang.serialization.MapCodec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.core.HolderSet;
7
import net.minecraft.core.registries.Registries;
8
import net.minecraft.core.registries.codec.RegistryCodecs;
9
import net.minecraft.world.level.LevelAccessor;
10
import net.minecraft.world.level.biome.Biome;
11
12
public class MatchingBiomesPredicate implements BlockPredicate {
13
	public static final MapCodec<MatchingBiomesPredicate> CODEC = RecordCodecBuilder.mapCodec(
14
		i -> i.group(RegistryCodecs.holderSet(Registries.BIOME).fieldOf("biomes").forGetter(c -> c.biomes)).apply(i, MatchingBiomesPredicate::new)
15
	);
16
	private final HolderSet<Biome> biomes;
17
18
	public MatchingBiomesPredicate(final HolderSet<Biome> biomes) {
19
		this.biomes = biomes;
20
	}
21
22
	public boolean test(final LevelAccessor worldGenLevel, final BlockPos blockPos) {
23
		return this.biomes.contains(worldGenLevel.getBiome(blockPos));
24
	}
25
26
	@Override
27
	public BlockPredicateType<?> type() {
28
		return BlockPredicateType.MATCHING_BIOMES;
29
	}
30
}
31

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