package top.r3944realms.eroticdungeongame.content.device;

import net.minecraft.world.entity.EntityType;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.eroticdungeongame.content.animation.type.SeatAnimationType;
import top.r3944realms.eroticdungeongame.content.block.FurnitureType;
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
import top.r3944realms.eroticdungeongame.content.register.EDGEntities;

@SuppressWarnings("unused")
public enum SeatType {
    CUFF_BED(SeatAnimationType.CUFF_BED, FurnitureType.HORIZONTAL_DOUBLE, "cuff_bed", 0.5d, 0.35d, 0.5d, 0.3d, true),
    ;
    private final SeatAnimationType animation;
    private final String blockName;
    private final double offsetX;
    private final double offsetY;
    private final double offsetZ;
    private final double generalOffset;

    private static final SeatTypeRegistry REGISTRY = new SeatTypeRegistry();

    static {
        REGISTRY.register(CUFF_BED, EDGEntities.CUFF_BED_SEAT);
    }
    public FurnitureType getFurnitureType() {
        return furnitureType;
    }

    public boolean isOppositeDirection() {
        return isOppositeDirection;
    }

    public double getGeneralOffset() {
        return generalOffset;
    }

    public double getOffsetZ(double partialTick) {
        return offsetZ + partialTick;
    }

    public double getOffsetY(double partialTick) {
        return offsetY + partialTick;
    }

    public double getOffsetX(double partialTick) {
        return offsetX + partialTick;
    }

    @Contract(pure = true)
    public @NotNull String getBlockName() {
        return blockName + "_seat";
    }

    public SeatAnimationType getAnimation() {
        return animation;
    }
    /**
     * 获取座位对应的实体类型
     */
    public @NotNull EntityType<SeatEntity> getEntityType() {
        return REGISTRY.getEntityType(this);
    }


    private final boolean isOppositeDirection;
    private final FurnitureType furnitureType;

    SeatType(SeatAnimationType animation, FurnitureType furnitureType, String blockName, double offsetX, double offsetY, double offsetZ, double generalOffset, boolean isOppositeDirection) {

        this.animation = animation;
        this.blockName = blockName;
        this.offsetX = offsetX;
        this.offsetY = offsetY;
        this.offsetZ = offsetZ;
        this.generalOffset = generalOffset;
        this.isOppositeDirection = isOppositeDirection;
        this.furnitureType = furnitureType;
    }
}
