ChorusPlantFeature .java

net.minecraft.world.level.levelgen.feature.ChorusPlantFeature (record, 29 lines): members: place, codec, CODEC. imports: ChorusFlowerBlock, ChunkGenerator.

net.minecraft.world.level.levelgen.featurerecord29 linescommon978 B

Implements

API Surface (2)

MapCodec<ChorusPlantFeature> codec()
boolean place(final WorldGenLevel level, final ChunkGenerator chunkGenerator, final RandomSource random, final BlockPos origin)

Fields & Constants (1)

CODEC

Code Graph: Dependencies (7)

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

Full Source

ChorusPlantFeature.java29 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.feature;
2
3
import com.mojang.serialization.MapCodec;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.tags.BlockTags;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.level.WorldGenLevel;
8
import net.minecraft.world.level.block.ChorusFlowerBlock;
9
import net.minecraft.world.level.chunk.ChunkGenerator;
10
11
public record ChorusPlantFeature() implements Feature {
12
	public static final MapCodec<ChorusPlantFeature> CODEC = MapCodec.unit(ChorusPlantFeature::new);
13
14
	@Override
15
	public MapCodec<ChorusPlantFeature> codec() {
16
		return CODEC;
17
	}
18
19
	@Override
20
	public boolean place(final WorldGenLevel level, final ChunkGenerator chunkGenerator, final RandomSource random, final BlockPos origin) {
21
		if (level.isEmptyBlock(origin) && level.getBlockState(origin.below()).is(BlockTags.SUPPORTS_CHORUS_PLANT)) {
22
			ChorusFlowerBlock.generatePlant(level, origin, random, 8);
23
			return true;
24
		} else {
25
			return false;
26
		}
27
	}
28
}
29

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