RodBlock .java

net.minecraft.world.level.block.RodBlock (class): members: SHAPES, isPathfindable, mirror, rotate, getShape. imports: PathComputationType, Shapes.

net.minecraft.world.level.blockclass41 linescommonextends DirectionalBlock1.4 KB

API Surface (4)

VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context)
BlockState rotate(final BlockState state, final Rotation rotation)
BlockState mirror(final BlockState state, final Mirror mirror)
boolean isPathfindable(final BlockState state, final PathComputationType type)

Fields & Constants (1)

SHAPES

Full Source

RodBlock.java41 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import java.util.Map;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.Direction;
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.level.pathfinder.PathComputationType;
10
import net.minecraft.world.phys.shapes.CollisionContext;
11
import net.minecraft.world.phys.shapes.Shapes;
12
import net.minecraft.world.phys.shapes.VoxelShape;
13
14
public abstract class RodBlock extends DirectionalBlock {
15
	private static final Map<Direction.Axis, VoxelShape> SHAPES = Shapes.rotateAllAxis(Block.cube(4.0, 4.0, 16.0));
16
17
	protected RodBlock(final BlockBehaviour.Properties properties) {
18
		super(properties);
19
	}
20
21
	@Override
22
	protected VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context) {
23
		return SHAPES.get(state.getValue(FACING).getAxis());
24
	}
25
26
	@Override
27
	protected BlockState rotate(final BlockState state, final Rotation rotation) {
28
		return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
29
	}
30
31
	@Override
32
	protected BlockState mirror(final BlockState state, final Mirror mirror) {
33
		return state.setValue(FACING, mirror.mirror(state.getValue(FACING)));
34
	}
35
36
	@Override
37
	protected boolean isPathfindable(final BlockState state, final PathComputationType type) {
38
		return false;
39
	}
40
}
41

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