BlockMatchTest .java

net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest (class, 28 lines): members: block, test, getType, CODEC. strings: "block".

net.minecraft.world.level.levelgen.structure.templatesystemclass28 linescommonextends RuleTest883 B

API Surface (2)

boolean test(final BlockState blockState, final BlockPos pos, final RandomSource random)
RuleTestType<?> getType()

Fields & Constants (2)

CODEC
block

String literals (1)

"block"

Code Graph: Dependencies (7)

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

Full Source

BlockMatchTest.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.structure.templatesystem;
2
3
import com.mojang.serialization.MapCodec;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.registries.BuiltInRegistries;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.level.block.Block;
8
import net.minecraft.world.level.block.state.BlockState;
9
10
public class BlockMatchTest extends RuleTest {
11
	public static final MapCodec<BlockMatchTest> CODEC = BuiltInRegistries.BLOCK.byNameCodec().fieldOf("block").xmap(BlockMatchTest::new, t -> t.block);
12
	private final Block block;
13
14
	public BlockMatchTest(final Block block) {
15
		this.block = block;
16
	}
17
18
	@Override
19
	public boolean test(final BlockState blockState, final BlockPos pos, final RandomSource random) {
20
		return blockState.is(this.block);
21
	}
22
23
	@Override
24
	protected RuleTestType<?> getType() {
25
		return RuleTestType.BLOCK_TEST;
26
	}
27
}
28

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