package com.r3944realms.modernlifepatch.client.render.outline;

import com.dairymoose.modernlife.blocks.RampBlock;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.r3944realms.modernlifepatch.client.render.OutlineRender;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.EnumProperty;

public class RampOutlineRenderer implements OutlineRender {

        @Override
        public void draw(BlockState state, PoseStack poseStack, VertexConsumer builder) {
            RampBlock.PartType partType = state.getValue(RampBlock.PART);
            if (partType == RampBlock.PartType.straight) {
                //Back edges
                OutlineRender.drawLine(builder, poseStack, 0, 0, 1, 0, 1, 1);
                OutlineRender.drawLine(builder, poseStack, 1, 0, 1, 1, 1, 1);

                //Bottom face
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 0, 0, 1);
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 1, 0, 0);
                OutlineRender.drawLine(builder, poseStack, 1, 0, 0, 1, 0, 1);
                OutlineRender.drawLine(builder, poseStack, 0, 0, 1, 1, 0, 1);

                //Top edge
                OutlineRender.drawLine(builder, poseStack, 0, 1, 1, 1, 1, 1);

                //Slope
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 0, 1, 1);
                OutlineRender.drawLine(builder, poseStack, 1, 0, 0, 1, 1, 1);
            } else {
                OutlineRender.drawLine(builder, poseStack, 1, 0, 1, 1, 1, 1);

                //Bottom face
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 0, 0, 1);
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 1, 0, 0);
                OutlineRender.drawLine(builder, poseStack, 1, 0, 0, 1, 0, 1);
                OutlineRender.drawLine(builder, poseStack, 0, 0, 1, 1, 0, 1);

                //Slope
                OutlineRender.drawLine(builder, poseStack, 0, 0, 0, 1, 1, 1);
                OutlineRender.drawLine(builder, poseStack, 1, 0, 0, 1, 1, 1);
                OutlineRender.drawLine(builder, poseStack, 0, 0, 1, 1, 1, 1);
            }
        }

        @Override
        public void rotateMatrix(PoseStack poseStack, BlockState state, EnumProperty<Direction> axis) {
            OutlineRender.super.rotateMatrix(poseStack, state, axis);
        }

}
