package net.minecraft.world.entity.vehicle;

import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.core.Direction;

public class DismountHelper {
    public static int[][] offsetsForDirection(final Direction fz) {
        final Direction fz2 = fz.getClockWise();
        final Direction fz3 = fz2.getOpposite();
        final Direction fz4 = fz.getOpposite();
        return new int[][] { { fz2.getStepX(), fz2.getStepZ() }, { fz3.getStepX(), fz3.getStepZ() }, { fz4.getStepX() + fz2.getStepX(), fz4.getStepZ() + fz2.getStepZ() }, { fz4.getStepX() + fz3.getStepX(), fz4.getStepZ() + fz3.getStepZ() }, { fz.getStepX() + fz2.getStepX(), fz.getStepZ() + fz2.getStepZ() }, { fz.getStepX() + fz3.getStepX(), fz.getStepZ() + fz3.getStepZ() }, { fz4.getStepX(), fz4.getStepZ() }, { fz.getStepX(), fz.getStepZ() } };
    }
    
    public static boolean isFloorValid(final double double1) {
        return !Double.isInfinite(double1) && double1 < 1.0;
    }
    
    public static boolean canDismountTo(final Level bqb, final LivingEntity aoy, final AABB deg) {
        return bqb.getBlockCollisions(aoy, deg).allMatch(VoxelShape::isEmpty);
    }
}
