BlockRule .java

net.minecraft.world.level.levelgen.material.rule.BlockRule (record, 28 lines): members: resultState, tryApply, compile, codec, CODEC. imports: MapCodec.

net.minecraft.world.level.levelgen.material.rulerecord28 linescommon871 B

Implements

API Surface (3)

MapCodec<BlockRule> codec()
RuleEvaluator compile(final MaterialRuleContext context)
BlockState tryApply(final int blockX, final int blockY, final int blockZ)

Fields & Constants (1)

CODEC

String literals (1)

"result_state"

Code Graph: Dependencies (4)

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

Full Source

BlockRule.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.material.rule;
2
3
import com.mojang.serialization.MapCodec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.world.level.block.state.BlockState;
6
import net.minecraft.world.level.levelgen.material.MaterialRuleContext;
7
8
public record BlockRule(BlockState resultState) implements MaterialRule, RuleEvaluator {
9
	public static final MapCodec<BlockRule> CODEC = RecordCodecBuilder.mapCodec(
10
		i -> i.group(BlockState.CODEC.fieldOf("result_state").forGetter(BlockRule::resultState)).apply(i, BlockRule::new)
11
	);
12
13
	@Override
14
	public MapCodec<BlockRule> codec() {
15
		return CODEC;
16
	}
17
18
	@Override
19
	public RuleEvaluator compile(final MaterialRuleContext context) {
20
		return this;
21
	}
22
23
	@Override
24
	public BlockState tryApply(final int blockX, final int blockY, final int blockZ) {
25
		return this.resultState;
26
	}
27
}
28

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