package net.minecraft.world.level.block.piston;

import net.minecraft.core.Direction;
import net.minecraft.world.phys.AABB;

public class PistonMath {
    public static AABB getMovementArea(final AABB cvf, final Direction fp, final double double3) {
        final double double4 = double3 * fp.getAxisDirection().getStep();
        final double double5 = Math.min(double4, 0.0);
        final double double6 = Math.max(double4, 0.0);
        switch (fp) {
            case WEST: {
                return new AABB(cvf.minX + double5, cvf.minY, cvf.minZ, cvf.minX + double6, cvf.maxY, cvf.maxZ);
            }
            case EAST: {
                return new AABB(cvf.maxX + double5, cvf.minY, cvf.minZ, cvf.maxX + double6, cvf.maxY, cvf.maxZ);
            }
            case DOWN: {
                return new AABB(cvf.minX, cvf.minY + double5, cvf.minZ, cvf.maxX, cvf.minY + double6, cvf.maxZ);
            }
            default: {
                return new AABB(cvf.minX, cvf.maxY + double5, cvf.minZ, cvf.maxX, cvf.maxY + double6, cvf.maxZ);
            }
            case NORTH: {
                return new AABB(cvf.minX, cvf.minY, cvf.minZ + double5, cvf.maxX, cvf.maxY, cvf.minZ + double6);
            }
            case SOUTH: {
                return new AABB(cvf.minX, cvf.minY, cvf.maxZ + double5, cvf.maxX, cvf.maxY, cvf.maxZ + double6);
            }
        }
    }
}
