CactusFlowerBlock .java

net.minecraft.world.level.block.CactusFlowerBlock (class, 30 lines): members: mayPlaceOn, SHAPE, getShape. imports: CollisionContext.

net.minecraft.world.level.blockclass30 linescommonextends VegetationBlock1.1 KB

API Surface (2)

VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context)
boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos)

Fields & Constants (1)

SHAPE

Full Source

CactusFlowerBlock.java30 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.tags.BlockTags;
6
import net.minecraft.world.level.BlockGetter;
7
import net.minecraft.world.level.block.state.BlockBehaviour;
8
import net.minecraft.world.level.block.state.BlockState;
9
import net.minecraft.world.phys.shapes.CollisionContext;
10
import net.minecraft.world.phys.shapes.VoxelShape;
11
12
public class CactusFlowerBlock extends VegetationBlock {
13
	private static final VoxelShape SHAPE = Block.column(14.0, 0.0, 12.0);
14
15
	public CactusFlowerBlock(final BlockBehaviour.Properties properties) {
16
		super(properties);
17
	}
18
19
	@Override
20
	protected VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context) {
21
		return SHAPE;
22
	}
23
24
	@Override
25
	protected boolean mayPlaceOn(final BlockState state, final BlockGetter level, final BlockPos pos) {
26
		BlockState blockBelow = level.getBlockState(pos);
27
		return blockBelow.is(BlockTags.SUPPORT_OVERRIDE_CACTUS_FLOWER) || blockBelow.isFaceSturdy(level, pos, Direction.UP, SupportType.CENTER);
28
	}
29
}
30

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