BlockPredicate .java

net.minecraft.world.level.block.state.predicate.BlockPredicate (class, 23 lines): implements Predicate. members: forBlock, block, test. imports: Block.

net.minecraft.world.level.block.state.predicateclass23 linescommon613 B

Implements

API Surface (2)

BlockPredicate forBlock(final Block block)
boolean test(final @Nullable BlockState input)

Fields & Constants (1)

block

Code Graph: Dependencies (2)

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

Full Source

BlockPredicate.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block.state.predicate;
2
3
import java.util.function.Predicate;
4
import net.minecraft.world.level.block.Block;
5
import net.minecraft.world.level.block.state.BlockState;
6
import org.jspecify.annotations.Nullable;
7
8
public class BlockPredicate implements Predicate<BlockState> {
9
	private final Block block;
10
11
	public BlockPredicate(final Block block) {
12
		this.block = block;
13
	}
14
15
	public static BlockPredicate forBlock(final Block block) {
16
		return new BlockPredicate(block);
17
	}
18
19
	public boolean test(final @Nullable BlockState input) {
20
		return input != null && input.is(this.block);
21
	}
22
}
23

Decompiled Minecraft 26.3 source of BlockPredicate (net/minecraft/world/level/block/state/predicate/BlockPredicate.java) with Mojang official mappings, stored verbatim on the site.