package com.dairymoose.modernlife.blocks;

import com.dairymoose.modernlife.core.CustomBlocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RoadMarkerBlock.class */
public class RoadMarkerBlock extends Block {
    public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

    public RoadMarkerBlock(Properties p_i48440_1_) {
        super(p_i48440_1_);
    }

    public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
        return Shapes.empty();
    }

    public BlockState rotate(BlockState state, Rotation rotation) {
        return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
    }

    public BlockState mirror(BlockState state, Mirror mirror) {
        return state.rotate(mirror.getRotation(state.getValue(FACING)));
    }

    protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
        builder.add(new Property[]{FACING});
    }

    public BlockState getStateForPlacement(BlockPlaceContext context) {
        return (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection());
    }

    public boolean canSurvive(BlockState blockState, LevelReader world, BlockPos pos) {
        if (world.getBlockState(pos.below()).is(CustomBlocks.BLOCK_PAVED_ROAD.get()) || world.getBlockState(pos.below()).is(CustomBlocks.BLOCK_PAVED_ROAD_RAMP.get())) {
            return true;
        }
        return false;
    }

    @Deprecated
    public BlockState updateShape(BlockState bs, Direction dir, BlockState bsUpdater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
        if (canSurvive(bs, world, pos)) {
            return bs;
        }
        return Blocks.AIR.defaultBlockState();
    }
}
