package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import java.util.Map; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; public abstract class RodBlock extends DirectionalBlock { private static final Map SHAPES = Shapes.rotateAllAxis(Block.cube(4.0, 4.0, 16.0)); protected RodBlock(final BlockBehaviour.Properties properties) { super(properties); } @Override protected abstract MapCodec codec(); @Override protected VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context) { return (VoxelShape)SHAPES.get(((Direction)state.getValue(FACING)).getAxis()); } @Override protected BlockState rotate(final BlockState state, final Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override protected BlockState mirror(final BlockState state, final Mirror mirror) { return state.setValue(FACING, mirror.mirror(state.getValue(FACING))); } @Override protected boolean isPathfindable(final BlockState state, final PathComputationType type) { return false; } }