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 deg, final Direction fz, final double double3) {
        final double double4 = double3 * fz.getAxisDirection().getStep();
        final double double5 = Math.min(double4, 0.0);
        final double double6 = Math.max(double4, 0.0);
        switch (fz) {
            case WEST: {
                return new AABB(deg.minX + double5, deg.minY, deg.minZ, deg.minX + double6, deg.maxY, deg.maxZ);
            }
            case EAST: {
                return new AABB(deg.maxX + double5, deg.minY, deg.minZ, deg.maxX + double6, deg.maxY, deg.maxZ);
            }
            case DOWN: {
                return new AABB(deg.minX, deg.minY + double5, deg.minZ, deg.maxX, deg.minY + double6, deg.maxZ);
            }
            default: {
                return new AABB(deg.minX, deg.maxY + double5, deg.minZ, deg.maxX, deg.maxY + double6, deg.maxZ);
            }
            case NORTH: {
                return new AABB(deg.minX, deg.minY, deg.minZ + double5, deg.maxX, deg.maxY, deg.minZ + double6);
            }
            case SOUTH: {
                return new AABB(deg.minX, deg.minY, deg.maxZ + double5, deg.maxX, deg.maxY, deg.maxZ + double6);
            }
        }
    }
}
