minecraft-src/net/minecraft/world/level/levelgen/structure/templatesystem/BlockStateMatchTest.java
2025-07-04 01:41:11 +03:00

26 lines
788 B
Java

package net.minecraft.world.level.levelgen.structure.templatesystem;
import com.mojang.serialization.MapCodec;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
public class BlockStateMatchTest extends RuleTest {
public static final MapCodec<BlockStateMatchTest> CODEC = BlockState.CODEC
.fieldOf("block_state")
.xmap(BlockStateMatchTest::new, blockStateMatchTest -> blockStateMatchTest.blockState);
private final BlockState blockState;
public BlockStateMatchTest(BlockState blockState) {
this.blockState = blockState;
}
@Override
public boolean test(BlockState state, RandomSource random) {
return state == this.blockState;
}
@Override
protected RuleTestType<?> getType() {
return RuleTestType.BLOCKSTATE_TEST;
}
}