BlockReplacement .java

net.minecraft.world.level.levelgen.feature.BlockReplacement (record, 18 lines): members: target, replace, state, CODEC. strings: "state", "target".

net.minecraft.world.level.levelgen.featurerecord18 linescommon744 B

API Surface (2)

record BlockReplacement(RuleTest target, BlockState state)
BlockReplacement replace(final RuleTest rule, final BlockState state)

Fields & Constants (1)

CODEC

String literals (2)

"target"
"state"

Code Graph: Dependencies (2)

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

Full Source

BlockReplacement.java18 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.feature;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.world.level.block.state.BlockState;
6
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
7
8
public record BlockReplacement(RuleTest target, BlockState state) {
9
	public static final Codec<BlockReplacement> CODEC = RecordCodecBuilder.create(
10
		i -> i.group(RuleTest.CODEC.fieldOf("target").forGetter(c -> c.target), BlockState.CODEC.fieldOf("state").forGetter(c -> c.state))
11
			.apply(i, BlockReplacement::new)
12
	);
13
14
	public static BlockReplacement replace(final RuleTest rule, final BlockState state) {
15
		return new BlockReplacement(rule, state);
16
	}
17
}
18

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