package net.minecraft.world.phys.shapes;

import it.unimi.dsi.fastutil.doubles.DoubleList;
import net.minecraft.core.Direction;

public class SliceShape extends VoxelShape {
    private final VoxelShape delegate;
    private final Direction.Axis axis;
    private static final DoubleList SLICE_COORDS;
    
    public SliceShape(final VoxelShape cwf, final Direction.Axis a, final int integer) {
        super(makeSlice(cwf.shape, a, integer));
        this.delegate = cwf;
        this.axis = a;
    }
    
    private static DiscreteVoxelShape makeSlice(final DiscreteVoxelShape cvu, final Direction.Axis a, final int integer) {
        return new SubShape(cvu, a.choose(integer, 0, 0), a.choose(0, integer, 0), a.choose(0, 0, integer), a.choose(integer + 1, cvu.xSize, cvu.xSize), a.choose(cvu.ySize, integer + 1, cvu.ySize), a.choose(cvu.zSize, cvu.zSize, integer + 1));
    }
    
    @Override
    protected DoubleList getCoords(final Direction.Axis a) {
        if (a == this.axis) {
            return SliceShape.SLICE_COORDS;
        }
        return this.delegate.getCoords(a);
    }
    
    static {
        SLICE_COORDS = (DoubleList)new CubePointRange(1);
    }
}
