CarrotBlock .java

net.minecraft.world.level.block.CarrotBlock (class, 29 lines): members: getBaseSeedId, SHAPES, getShape. imports: ItemLike, CollisionContext, VoxelShape.

net.minecraft.world.level.blockclass29 linescommonextends CropBlock934 B

API Surface (2)

ItemLike getBaseSeedId()
VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context)

Fields & Constants (1)

SHAPES

Full Source

CarrotBlock.java29 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.world.item.Items;
5
import net.minecraft.world.level.BlockGetter;
6
import net.minecraft.world.level.ItemLike;
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 CarrotBlock extends CropBlock {
13
	private static final VoxelShape[] SHAPES = Block.boxes(7, age -> Block.column(16.0, 0.0, 2 + age));
14
15
	public CarrotBlock(final BlockBehaviour.Properties properties) {
16
		super(properties);
17
	}
18
19
	@Override
20
	protected ItemLike getBaseSeedId() {
21
		return Items.CARROT;
22
	}
23
24
	@Override
25
	protected VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context) {
26
		return SHAPES[this.getAge(state)];
27
	}
28
}
29

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