package net.minecraft.world.level.block;

import net.minecraft.world.level.block.state.StateHolder;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.item.BlockPlaceContext;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.properties.EnumProperty;

public class RotatedPillarBlock extends Block {
    public static final EnumProperty<Direction.Axis> AXIS;
    
    public RotatedPillarBlock(final Properties c) {
        super(c);
        this.registerDefaultState(((StateHolder<O, BlockState>)this.defaultBlockState()).<Direction.Axis, Direction.Axis>setValue(RotatedPillarBlock.AXIS, Direction.Axis.Y));
    }
    
    @Override
    public BlockState rotate(final BlockState cfj, final Rotation cap) {
        switch (cap) {
            case COUNTERCLOCKWISE_90:
            case CLOCKWISE_90: {
                switch (cfj.<Direction.Axis>getValue(RotatedPillarBlock.AXIS)) {
                    case X: {
                        return ((StateHolder<O, BlockState>)cfj).<Direction.Axis, Direction.Axis>setValue(RotatedPillarBlock.AXIS, Direction.Axis.Z);
                    }
                    case Z: {
                        return ((StateHolder<O, BlockState>)cfj).<Direction.Axis, Direction.Axis>setValue(RotatedPillarBlock.AXIS, Direction.Axis.X);
                    }
                    default: {
                        return cfj;
                    }
                }
                break;
            }
            default: {
                return cfj;
            }
        }
    }
    
    @Override
    protected void createBlockStateDefinition(final StateDefinition.Builder<Block, BlockState> a) {
        a.add(RotatedPillarBlock.AXIS);
    }
    
    @Override
    public BlockState getStateForPlacement(final BlockPlaceContext bin) {
        return ((StateHolder<O, BlockState>)this.defaultBlockState()).<Direction.Axis, Direction.Axis>setValue(RotatedPillarBlock.AXIS, bin.getClickedFace().getAxis());
    }
    
    static {
        AXIS = BlockStateProperties.AXIS;
    }
}
