package com.dairymoose.modernlife.util;

import java.util.ArrayList;
import java.util.List;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

/* loaded from: outputsrg.jar:com/dairymoose/modernlife/util/ModernLifeUtil.class */
public class ModernLifeUtil {
    /* JADX WARN: Multi-variable type inference failed */
    public static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> inputType, BlockEntityType<E> expectedType, BlockEntityTicker<? super E> blockEntityTicker) {
        if (inputType == expectedType) {
            return blockEntityTicker;
        }
        return null;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.dairymoose.modernlife.util.ModernLifeUtil$1 */
    /* loaded from: outputsrg.jar:com/dairymoose/modernlife/util/ModernLifeUtil$1.class */
    public class C01651 implements Shapes.DoubleLineConsumer {
        final /* synthetic */ List val$generatedShapes;

        C01651(List list) {
            generatedShapes = list;
        }

        public void consume(double arg0, double arg1, double arg2, double arg3, double arg4, double arg5) {
            VoxelShape shape = Shapes.box(1.0d - arg5, arg1, arg0, 1.0d - arg2, arg4, arg3);
            generatedShapes.add(shape);
        }
    }

    public static VoxelShape RotateVoxelShapeClockwise(VoxelShape in) {
        List<VoxelShape> generatedShapes = new ArrayList<>();
        in.forAllBoxes(new Shapes.DoubleLineConsumer() { // from class: com.dairymoose.modernlife.util.ModernLifeUtil.1
            final /* synthetic */ List val$generatedShapes;

            C01651(List generatedShapes2) {
                generatedShapes = generatedShapes2;
            }

            public void consume(double arg0, double arg1, double arg2, double arg3, double arg4, double arg5) {
                VoxelShape shape = Shapes.box(1.0d - arg5, arg1, arg0, 1.0d - arg2, arg4, arg3);
                generatedShapes.add(shape);
            }
        });
        if (generatedShapes2.size() == 0) {
            return Shapes.block();
        }
        VoxelShape out = generatedShapes2.get(0);
        for (int i = 1; i < generatedShapes2.size(); i++) {
            VoxelShape shape = generatedShapes2.get(i);
            out = Shapes.or(out, shape);
        }
        out.optimize();
        return out;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.dairymoose.modernlife.util.ModernLifeUtil$2 */
    /* loaded from: outputsrg.jar:com/dairymoose/modernlife/util/ModernLifeUtil$2.class */
    public class C01662 implements Shapes.DoubleLineConsumer {
        final /* synthetic */ List val$generatedShapes;

        C01662(List list) {
            generatedShapes = list;
        }

        public void consume(double arg0, double arg1, double arg2, double arg3, double arg4, double arg5) {
            VoxelShape shape = Shapes.box(arg0, 1.0d - arg5, arg1, arg3, 1.0d - arg2, arg4);
            generatedShapes.add(shape);
        }
    }

    public static VoxelShape RotateVoxelShapeXAxis(VoxelShape in) {
        List<VoxelShape> generatedShapes = new ArrayList<>();
        in.forAllBoxes(new Shapes.DoubleLineConsumer() { // from class: com.dairymoose.modernlife.util.ModernLifeUtil.2
            final /* synthetic */ List val$generatedShapes;

            C01662(List generatedShapes2) {
                generatedShapes = generatedShapes2;
            }

            public void consume(double arg0, double arg1, double arg2, double arg3, double arg4, double arg5) {
                VoxelShape shape = Shapes.box(arg0, 1.0d - arg5, arg1, arg3, 1.0d - arg2, arg4);
                generatedShapes.add(shape);
            }
        });
        if (generatedShapes2.size() == 0) {
            return Shapes.block();
        }
        VoxelShape out = generatedShapes2.get(0);
        for (int i = 1; i < generatedShapes2.size(); i++) {
            VoxelShape shape = generatedShapes2.get(i);
            out = Shapes.or(out, shape);
        }
        out.optimize();
        return out;
    }
}
