Update 5
This commit is contained in:
parent
f3f2bb3e64
commit
83d958dfed
1 changed files with 84 additions and 0 deletions
84
src/main/java/com/teammoeg/steampowered/create/SPShapes.java
Normal file
84
src/main/java/com/teammoeg/steampowered/create/SPShapes.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
package com.teammoeg.steampowered.create;
|
||||||
|
|
||||||
|
import static net.minecraft.util.Direction.UP;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import com.simibubi.create.foundation.utility.VoxelShaper;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
|
||||||
|
public class SPShapes {
|
||||||
|
|
||||||
|
// From create:AllShapes
|
||||||
|
public static Builder shape(VoxelShape shape) {
|
||||||
|
return new Builder(shape);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Builder shape(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
return shape(cuboid(x1, y1, z1, x2, y2, z2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
return Block.box(x1, y1, z1, x2, y2, z2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
VoxelShape shape;
|
||||||
|
|
||||||
|
public Builder(VoxelShape shape) {
|
||||||
|
this.shape = shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder add(VoxelShape shape) {
|
||||||
|
this.shape = VoxelShapes.or(this.shape, shape);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder add(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
return add(cuboid(x1, y1, z1, x2, y2, z2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
this.shape =
|
||||||
|
VoxelShapes.join(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShape build() {
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper build(BiFunction<VoxelShape, Direction, VoxelShaper> factory, Direction direction) {
|
||||||
|
return factory.apply(shape, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper build(BiFunction<VoxelShape, Axis, VoxelShaper> factory, Axis axis) {
|
||||||
|
return factory.apply(shape, axis);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper forDirectional(Direction direction) {
|
||||||
|
return build(VoxelShaper::forDirectional, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper forAxis() {
|
||||||
|
return build(VoxelShaper::forAxis, Axis.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper forHorizontalAxis() {
|
||||||
|
return build(VoxelShaper::forHorizontalAxis, Axis.Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper forHorizontal(Direction direction) {
|
||||||
|
return build(VoxelShaper::forHorizontal, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShaper forDirectional() {
|
||||||
|
return forDirectional(UP);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue