MatchingBlocksPredicate .java

net.minecraft.world.level.levelgen.blockpredicates.MatchingBlocksPredicate (class): members: blocks, test, type, CODEC. strings: "blocks". imports: Vec3i.

net.minecraft.world.level.levelgen.blockpredicatesclass33 linescommonextends StateTestingPredicate1.1 KB

API Surface (2)

boolean test(final BlockState state)
BlockPredicateType<?> type()

Fields & Constants (2)

CODEC
blocks

String literals (1)

"blocks"

Full Source

MatchingBlocksPredicate.java33 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.HolderSet;
6
import net.minecraft.core.Vec3i;
7
import net.minecraft.core.registries.Registries;
8
import net.minecraft.core.registries.codec.RegistryCodecs;
9
import net.minecraft.world.level.block.Block;
10
import net.minecraft.world.level.block.state.BlockState;
11
12
public class MatchingBlocksPredicate extends StateTestingPredicate {
13
	public static final MapCodec<MatchingBlocksPredicate> CODEC = RecordCodecBuilder.mapCodec(
14
		i -> stateTestingCodec(i).and(RegistryCodecs.holderSet(Registries.BLOCK).fieldOf("blocks").forGetter(c -> c.blocks)).apply(i, MatchingBlocksPredicate::new)
15
	);
16
	private final HolderSet<Block> blocks;
17
18
	public MatchingBlocksPredicate(final Vec3i offset, final HolderSet<Block> blocks) {
19
		super(offset);
20
		this.blocks = blocks;
21
	}
22
23
	@Override
24
	protected boolean test(final BlockState state) {
25
		return state.is(this.blocks);
26
	}
27
28
	@Override
29
	public BlockPredicateType<?> type() {
30
		return BlockPredicateType.MATCHING_BLOCKS;
31
	}
32
}
33

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