BlockStateMatchTest .java

net.minecraft.world.level.levelgen.structure.templatesystem.BlockStateMatchTest (class): members: blockState, test, getType, CODEC. strings: "block_state".

net.minecraft.world.level.levelgen.structure.templatesystemclass26 linescommonextends RuleTest830 B

API Surface (2)

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

Fields & Constants (2)

CODEC
blockState

String literals (1)

"block_state"

Code Graph: Dependencies (5)

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

Full Source

BlockStateMatchTest.java26 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.util.RandomSource;
6
import net.minecraft.world.level.block.state.BlockState;
7
8
public class BlockStateMatchTest extends RuleTest {
9
	public static final MapCodec<BlockStateMatchTest> CODEC = BlockState.CODEC.fieldOf("block_state").xmap(BlockStateMatchTest::new, t -> t.blockState);
10
	private final BlockState blockState;
11
12
	public BlockStateMatchTest(final BlockState blockState) {
13
		this.blockState = blockState;
14
	}
15
16
	@Override
17
	public boolean test(final BlockState blockState, final BlockPos pos, final RandomSource random) {
18
		return blockState == this.blockState;
19
	}
20
21
	@Override
22
	protected RuleTestType<?> getType() {
23
		return RuleTestType.BLOCKSTATE_TEST;
24
	}
25
}
26

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