CaveVinesPlantBlock .java

net.minecraft.world.level.block.CaveVinesPlantBlock (class): members: updateHeadAfterConvertedFromBody, getHeadBlock, getCloneItemStack, isBonemealSuccess.

net.minecraft.world.level.blockclass64 linescommonextends GrowingPlantBodyBlock2.4 KB

Implements

API Surface (8)

GrowingPlantHeadBlock getHeadBlock()
BlockState updateHeadAfterConvertedFromBody(final BlockState bodyState, final BlockState headState)
ItemStack getCloneItemStack(final LevelReader level, final BlockPos pos, final BlockState state, final boolean includeData)
InteractionResult useWithoutItem(final BlockState state, final Level level, final BlockPos pos, final Player player, final BlockHitResult hitResult)
void createBlockStateDefinition(final StateDefinition.Builder<Block, BlockState> builder)
boolean isValidBonemealTarget(final LevelReader level, final BlockPos pos, final BlockState state, final BonemealSource source)
boolean isBonemealSuccess(final Level level, final RandomSource random, final BlockPos pos, final BlockState state, final BonemealSource source)
void performBonemeal(final ServerLevel level, final RandomSource random, final BlockPos pos, final BlockState state, final BonemealSource source)

Full Source

CaveVinesPlantBlock.java64 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.core.Direction;
5
import net.minecraft.server.level.ServerLevel;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.InteractionResult;
8
import net.minecraft.world.entity.player.Player;
9
import net.minecraft.world.item.ItemStack;
10
import net.minecraft.world.item.Items;
11
import net.minecraft.world.level.Level;
12
import net.minecraft.world.level.LevelReader;
13
import net.minecraft.world.level.block.state.BlockBehaviour;
14
import net.minecraft.world.level.block.state.BlockState;
15
import net.minecraft.world.level.block.state.StateDefinition;
16
import net.minecraft.world.phys.BlockHitResult;
17
18
public class CaveVinesPlantBlock extends GrowingPlantBodyBlock implements CaveVines {
19
	public CaveVinesPlantBlock(final BlockBehaviour.Properties properties) {
20
		super(properties, Direction.DOWN, SHAPE, false);
21
		this.registerDefaultState(this.stateDefinition.any().setValue(BERRIES, false));
22
	}
23
24
	@Override
25
	protected GrowingPlantHeadBlock getHeadBlock() {
26
		return (GrowingPlantHeadBlock)Blocks.CAVE_VINES;
27
	}
28
29
	@Override
30
	protected BlockState updateHeadAfterConvertedFromBody(final BlockState bodyState, final BlockState headState) {
31
		return headState.setValue(BERRIES, bodyState.getValue(BERRIES));
32
	}
33
34
	@Override
35
	protected ItemStack getCloneItemStack(final LevelReader level, final BlockPos pos, final BlockState state, final boolean includeData) {
36
		return new ItemStack(Items.GLOW_BERRIES);
37
	}
38
39
	@Override
40
	protected InteractionResult useWithoutItem(final BlockState state, final Level level, final BlockPos pos, final Player player, final BlockHitResult hitResult) {
41
		return CaveVines.use(player, state, level, pos);
42
	}
43
44
	@Override
45
	protected void createBlockStateDefinition(final StateDefinition.Builder<Block, BlockState> builder) {
46
		builder.add(BERRIES);
47
	}
48
49
	@Override
50
	public boolean isValidBonemealTarget(final LevelReader level, final BlockPos pos, final BlockState state, final BonemealSource source) {
51
		return !state.getValue(BERRIES);
52
	}
53
54
	@Override
55
	public boolean isBonemealSuccess(final Level level, final RandomSource random, final BlockPos pos, final BlockState state, final BonemealSource source) {
56
		return true;
57
	}
58
59
	@Override
60
	public void performBonemeal(final ServerLevel level, final RandomSource random, final BlockPos pos, final BlockState state, final BonemealSource source) {
61
		level.setBlock(pos, state.setValue(BERRIES, true), 2);
62
	}
63
}
64

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