Make shape builder public

This commit is contained in:
kotakotik22 2021-07-05 16:22:55 +02:00
parent d4a4e245bd
commit b0d4376730

View file

@ -232,57 +232,57 @@ public class AllShapes {
return Block.makeCuboidShape(x1, y1, z1, x2, y2, z2);
}
private static class Builder {
public static class Builder {
VoxelShape shape;
public Builder(VoxelShape shape) {
this.shape = shape;
}
Builder add(VoxelShape shape) {
public Builder add(VoxelShape shape) {
this.shape = VoxelShapes.or(this.shape, shape);
return this;
}
Builder add(double x1, double y1, double z1, double x2, double y2, double z2) {
public Builder add(double x1, double y1, double z1, double x2, double y2, double z2) {
return add(cuboid(x1, y1, z1, x2, y2, z2));
}
Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
this.shape =
VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
return this;
}
VoxelShape build() {
public VoxelShape build() {
return shape;
}
VoxelShaper build(BiFunction<VoxelShape, Direction, VoxelShaper> factory, Direction direction) {
public VoxelShaper build(BiFunction<VoxelShape, Direction, VoxelShaper> factory, Direction direction) {
return factory.apply(shape, direction);
}
VoxelShaper build(BiFunction<VoxelShape, Axis, VoxelShaper> factory, Axis axis) {
public VoxelShaper build(BiFunction<VoxelShape, Axis, VoxelShaper> factory, Axis axis) {
return factory.apply(shape, axis);
}
VoxelShaper forDirectional(Direction direction) {
public VoxelShaper forDirectional(Direction direction) {
return build(VoxelShaper::forDirectional, direction);
}
VoxelShaper forAxis() {
public VoxelShaper forAxis() {
return build(VoxelShaper::forAxis, Axis.Y);
}
VoxelShaper forHorizontalAxis() {
public VoxelShaper forHorizontalAxis() {
return build(VoxelShaper::forHorizontalAxis, Axis.Z);
}
VoxelShaper forHorizontal(Direction direction) {
public VoxelShaper forHorizontal(Direction direction) {
return build(VoxelShaper::forHorizontal, direction);
}
VoxelShaper forDirectional() {
public VoxelShaper forDirectional() {
return forDirectional(UP);
}