package top.r3944realms.eroticdungeongame.content.block;

import net.minecraft.core.Direction;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.phys.shapes.VoxelShape;
import top.r3944realms.eroticdungeongame.content.block.part.SeatPart;
import top.r3944realms.lib39.util.shape.ShapeUtil;

import java.util.EnumMap;
import java.util.Map;

public class HorizontalDoubleSeatBlock extends AbstractTwoPartSeatBlock {
    private static final BlockBehaviour.Properties PROPERTIES = BlockBehaviour.Properties.of()
            .strength(2.0f)
            .explosionResistance(3.0f)
            .sound(SoundType.WOOD)
            .noOcclusion();
    public HorizontalDoubleSeatBlock() {
        super(PROPERTIES);
        setupShape();
    }

    @Override
    public void setupShape() {
        // 第一部分：主体平台 + 前侧两个支柱
        VoxelShape group1 = ShapeUtil.builder()
                .addPixelBox(0.0, 3.0, 0.0, 16.0, 9.0, 16.0)  // 主体平台
                .addPixelBox(13.0, 0.0, 0.0, 16.0, 3.0, 3.0)  // 前右支柱
                .addPixelBox(0.0, 0.0, 0.0, 3.0, 3.0, 3.0)    // 前左支柱
                .build();

        // 第二部分：主体平台 + 后侧两个支柱
        VoxelShape group2 = ShapeUtil.builder()
                .addPixelBox(0.0, 3.0, 0.0, 16.0, 9.0, 16.0)  // 主体平台
                .addPixelBox(0.0, 0.0, 13.0, 3.0, 3.0, 16.0)  // 后左支柱
                .addPixelBox(13.0, 0.0, 13.0, 16.0, 3.0, 16.0)// 后右支柱
                .build();

        // 创建双部分方块的形状映射
        EnumMap<SeatPart, Map<Direction, VoxelShape>> shapeMap = new EnumMap<>(SeatPart.class);
        shapeMap.put(SeatPart.HEAD, ShapeUtil.createUniformDirectionMap(group1));
        shapeMap.put(SeatPart.FOOT, ShapeUtil.createUniformDirectionMap(group2));
        this.shapeMap = shapeMap;
    }
}
