2020-05-23 14:02:38 +02:00
|
|
|
package com.simibubi.create;
|
2019-12-10 02:23:34 +01:00
|
|
|
|
2020-05-22 20:02:07 +02:00
|
|
|
import static net.minecraft.util.Direction.NORTH;
|
2020-02-28 22:17:40 +01:00
|
|
|
import static net.minecraft.util.Direction.SOUTH;
|
|
|
|
import static net.minecraft.util.Direction.UP;
|
2019-12-12 11:58:29 +01:00
|
|
|
|
2020-02-28 22:17:40 +01:00
|
|
|
import java.util.function.BiFunction;
|
2019-12-12 11:58:29 +01:00
|
|
|
|
2020-05-23 14:02:38 +02:00
|
|
|
import com.simibubi.create.foundation.utility.VoxelShaper;
|
|
|
|
|
2020-02-28 22:17:40 +01:00
|
|
|
import net.minecraft.block.Block;
|
2019-12-10 02:23:34 +01:00
|
|
|
import net.minecraft.block.Blocks;
|
|
|
|
import net.minecraft.block.DirectionalBlock;
|
|
|
|
import net.minecraft.block.PistonHeadBlock;
|
|
|
|
import net.minecraft.util.Direction;
|
2020-02-28 22:17:40 +01:00
|
|
|
import net.minecraft.util.Direction.Axis;
|
2019-12-10 17:45:42 +01:00
|
|
|
import net.minecraft.util.math.shapes.IBooleanFunction;
|
2019-12-10 02:23:34 +01:00
|
|
|
import net.minecraft.util.math.shapes.VoxelShape;
|
|
|
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
|
|
|
|
|
|
|
public class AllShapes {
|
|
|
|
|
2020-02-28 22:17:40 +01:00
|
|
|
// Independent Shapers
|
2019-12-10 02:23:34 +01:00
|
|
|
public static final VoxelShaper
|
2019-12-15 01:13:36 +01:00
|
|
|
|
2020-03-04 14:06:34 +01:00
|
|
|
CASING_14PX = shape(0, 0, 0, 16, 14, 16).forDirectional(),
|
2020-05-22 20:02:07 +02:00
|
|
|
CASING_12PX = shape(0, 0, 0, 16, 12, 16).forDirectional(),
|
|
|
|
CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(),
|
|
|
|
MOTOR_BLOCK = shape(3, 0, 3, 13, 14, 13).forDirectional(),
|
|
|
|
FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(), SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
|
|
|
|
EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH)
|
|
|
|
.withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
|
|
|
|
TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16)
|
|
|
|
.add(4, 4, 11, 12, 12, 17)
|
|
|
|
.forDirectional(SOUTH),
|
|
|
|
FURNACE_ENGINE = shape(1, 1, 0, 15, 15, 16).add(0, 0, 9, 16, 16, 14)
|
|
|
|
.forHorizontal(Direction.SOUTH),
|
|
|
|
PORTABLE_STORAGE_INTERFACE = shape(0, 0, 0, 16, 12, 16).add(3, 12, 3, 13, 16, 13)
|
|
|
|
.forDirectional(),
|
|
|
|
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14)
|
|
|
|
.add(0, 0, 14, 16, 16, 16)
|
|
|
|
.forHorizontalAxis(),
|
|
|
|
SPEED_CONTROLLER = shape(0, 0, 0, 16, 2, 16).add(1, 1, 1, 15, 15, 15)
|
|
|
|
.erase(0, 8, 5, 16, 16, 11)
|
|
|
|
.add(2, 9, 2, 14, 14, 14)
|
|
|
|
.erase(6, 11, 0, 10, 16, 16)
|
|
|
|
.forHorizontalAxis(),
|
|
|
|
HARVESTER_BASE = shape(0, 2, 0, 16, 14, 3).forDirectional(SOUTH),
|
|
|
|
NOZZLE = shape(2, 0, 2, 14, 14, 14).add(1, 13, 1, 15, 15, 15)
|
|
|
|
.erase(3, 13, 3, 13, 15, 13)
|
|
|
|
.forDirectional(),
|
|
|
|
CRANK = shape(5, 0, 5, 11, 6, 11).add(1, 3, 1, 15, 8, 15)
|
|
|
|
.forDirectional(),
|
2020-06-05 13:02:11 +02:00
|
|
|
CART_ASSEMBLER = shape(0, 12, 0, 16, 16, 16).add(-2, 0, 1, 18, 14, 15)
|
2020-05-22 20:02:07 +02:00
|
|
|
.forHorizontalAxis(),
|
|
|
|
STOCKPILE_SWITCH = shape(0, 0, 0, 16, 2, 16).add(1, 0, 1, 15, 16, 15)
|
|
|
|
.add(0, 14, 0, 16, 16, 16)
|
|
|
|
.add(3, 3, -1, 13, 13, 2)
|
2020-06-05 23:26:22 +02:00
|
|
|
.forHorizontal(NORTH),
|
|
|
|
NIXIE_TUBE = shape(0, 0, 0, 16, 4, 16).add(9, 0, 5, 15, 15, 11)
|
|
|
|
.add(1, 0, 5, 7, 15, 11)
|
|
|
|
.forHorizontalAxis(),
|
|
|
|
NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11)
|
|
|
|
.add(1, 1, 5, 7, 16, 11)
|
2020-06-15 02:25:33 +02:00
|
|
|
.forHorizontalAxis(),
|
2020-07-08 13:41:55 +02:00
|
|
|
FUNNEL = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14)
|
2020-06-25 18:17:37 +02:00
|
|
|
.add(1, 6, 1, 15, 10, 15)
|
|
|
|
.add(0, 10, 0, 16, 16, 16)
|
|
|
|
.forDirectional(UP),
|
2020-07-08 13:41:55 +02:00
|
|
|
FUNNEL_COLLISION = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14)
|
2020-06-28 13:31:11 +02:00
|
|
|
.add(1, 6, 1, 15, 10, 15)
|
|
|
|
.add(0, 10, 0, 16, 13, 16)
|
|
|
|
.forDirectional(UP),
|
2020-06-25 21:38:23 +02:00
|
|
|
CHUTE_FUNNEL = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14)
|
|
|
|
.add(0, 8, 0, 16, 14, 16)
|
2020-07-02 17:23:42 +02:00
|
|
|
.add(1, 5, 1, 15, 18, 15)
|
2020-06-25 21:38:23 +02:00
|
|
|
.forDirectional(UP),
|
2020-06-20 16:10:07 +02:00
|
|
|
BELT_FUNNEL_RETRACTED = shape(3, -5, 14, 13, 13, 19).add(0, -5, 8, 16, 16, 14)
|
|
|
|
.forHorizontal(NORTH),
|
2020-06-26 12:35:24 +02:00
|
|
|
BELT_FUNNEL_EXTENDED = shape(3, -4, 6, 13, 13, 17).add(2, -4, 10, 14, 14, 14)
|
|
|
|
.add(1, -4, 6, 15, 15, 10)
|
|
|
|
.add(0, -5, 0, 16, 16, 6)
|
2020-06-20 16:10:07 +02:00
|
|
|
.forHorizontal(NORTH),
|
2020-06-15 02:25:33 +02:00
|
|
|
PUMP = shape(2, 0, 2, 14, 5, 14).add(4, 0, 4, 12, 16, 12)
|
|
|
|
.add(3, 12, 3, 13, 16, 13)
|
|
|
|
.forDirectional(Direction.UP)
|
2020-02-28 22:17:40 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
2020-06-15 19:14:03 +02:00
|
|
|
// Internally Shared Shapes
|
|
|
|
private static final VoxelShape
|
|
|
|
|
|
|
|
PISTON_HEAD = Blocks.PISTON_HEAD.getDefaultState()
|
|
|
|
.with(DirectionalBlock.FACING, UP)
|
|
|
|
.with(PistonHeadBlock.SHORT, true)
|
|
|
|
.getShape(null, null), PISTON_EXTENDED =
|
|
|
|
shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y))
|
|
|
|
.build(),
|
|
|
|
SMALL_GEAR_SHAPE = cuboid(2, 6, 2, 14, 10, 14), LARGE_GEAR_SHAPE = cuboid(0, 6, 0, 16, 10, 16),
|
|
|
|
VERTICAL_TABLET_SHAPE = cuboid(3, 1, -1, 13, 15, 3), SQUARE_TABLET_SHAPE = cuboid(2, 2, -1, 14, 14, 3),
|
|
|
|
LOGISTICS_TABLE_SLOPE = shape(0, 10, 15, 16, 14, 10.667).add(0, 12, 10.667, 16, 16, 6.333)
|
|
|
|
.add(0, 14, 6.333, 16, 18, 2)
|
|
|
|
.build(),
|
|
|
|
SCHEMATICS_TABLE_SLOPE = shape(0, 10, 16, 16, 14, 11).add(0, 12, 11, 16, 16, 6)
|
|
|
|
.add(0, 14, 6, 16, 18, 1)
|
|
|
|
.build(),
|
|
|
|
TANK_BOTTOM_LID = shape(0, 0, 0, 16, 4, 16).build(), TANK_TOP_LID = shape(0, 12, 0, 16, 16, 16).build()
|
|
|
|
|
|
|
|
;
|
|
|
|
|
2020-02-28 22:17:40 +01:00
|
|
|
// Static Block Shapes
|
2019-12-10 02:23:34 +01:00
|
|
|
public static final VoxelShape
|
|
|
|
|
2020-05-22 20:02:07 +02:00
|
|
|
BASIN_BLOCK_SHAPE = shape(0, 2, 0, 16, 13, 16).erase(2, 5, 2, 14, 14, 14)
|
|
|
|
.add(2, 0, 2, 14, 2, 14)
|
|
|
|
.build(),
|
|
|
|
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 22, 16),
|
|
|
|
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.fullCube()).erase(4, 0, 4, 12, 16, 12)
|
|
|
|
.build(),
|
|
|
|
TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11)
|
|
|
|
.build(),
|
|
|
|
CRATE_BLOCK_SHAPE = cuboid(1, 0, 1, 15, 14, 15),
|
|
|
|
TABLE_POLE_SHAPE = shape(4, 0, 4, 12, 2, 12).add(5, 2, 5, 11, 14, 11)
|
|
|
|
.build(),
|
|
|
|
BELT_COLLISION_MASK = cuboid(0, 0, 0, 16, 19, 16),
|
|
|
|
SCHEMATICANNON_SHAPE = shape(1, 0, 1, 15, 8, 15).add(0.5, 8, 0.5, 15.5, 11, 15.5)
|
|
|
|
.build(),
|
|
|
|
PULLEY_MAGNET = shape(3, 0, 3, 13, 2, 13).add(FOUR_VOXEL_POLE.get(UP))
|
|
|
|
.build(),
|
|
|
|
MILLSTONE = shape(0, 0, 0, 16, 6, 16).add(2, 6, 2, 14, 13, 14)
|
|
|
|
.add(3, 13, 3, 13, 16, 13)
|
|
|
|
.build(),
|
|
|
|
CUCKOO_CLOCK = shape(1, 0, 1, 15, 19, 15).build(),
|
|
|
|
GAUGE_SHAPE_UP = shape(1, 0, 0, 15, 2, 16).add(2, 2, 1, 14, 14, 15)
|
|
|
|
.build(),
|
2020-06-16 12:54:24 +02:00
|
|
|
MECHANICAL_ARM = shape(2, 0, 2, 14, 10, 14).add(3, 0, 3, 13, 14, 13)
|
|
|
|
.build(),
|
2020-07-10 19:48:04 +02:00
|
|
|
MECHANICAL_ARM_CEILING = shape(2, 6, 2, 14, 16, 14).add(3, 2, 3, 13, 16, 13)
|
|
|
|
.build(),
|
2020-06-20 16:10:07 +02:00
|
|
|
CHUTE = shape(1, 8, 1, 15, 16, 15).add(2, 0, 2, 14, 8, 14)
|
|
|
|
.build(),
|
2020-06-15 19:14:03 +02:00
|
|
|
TANK = shape(1, 0, 1, 15, 16, 15).build(), TANK_TOP = shape(TANK_TOP_LID).add(TANK)
|
|
|
|
.build(),
|
|
|
|
TANK_BOTTOM = shape(TANK_BOTTOM_LID).add(TANK)
|
|
|
|
.build(),
|
|
|
|
TANK_TOP_BOTTOM = shape(TANK_BOTTOM_LID).add(TANK_TOP_LID)
|
|
|
|
.add(TANK)
|
2020-06-20 20:02:27 +02:00
|
|
|
.build(),
|
|
|
|
DEPOT = shape(CASING_11PX.get(Direction.UP)).add(1, 11, 1, 15, 13, 15)
|
2020-05-22 20:02:07 +02:00
|
|
|
.build()
|
2020-03-04 14:06:34 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
// More Shapers
|
2019-12-10 02:23:34 +01:00
|
|
|
public static final VoxelShaper
|
2020-02-28 22:17:40 +01:00
|
|
|
|
2020-03-04 14:06:34 +01:00
|
|
|
MECHANICAL_PISTON_HEAD = shape(PISTON_HEAD).forDirectional(), MECHANICAL_PISTON = CASING_12PX,
|
2020-05-22 20:02:07 +02:00
|
|
|
MECHANICAL_PISTON_EXTENDED = shape(PISTON_EXTENDED).forDirectional(),
|
|
|
|
SMALL_GEAR = shape(SMALL_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y))
|
|
|
|
.forAxis(),
|
|
|
|
LARGE_GEAR = shape(LARGE_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y))
|
|
|
|
.forAxis(),
|
|
|
|
LOGISTICAL_CONTROLLER = shape(SQUARE_TABLET_SHAPE).forDirectional(SOUTH),
|
|
|
|
REDSTONE_BRIDGE = shape(VERTICAL_TABLET_SHAPE).forDirectional(SOUTH)
|
|
|
|
.withVerticalShapes(LOGISTICAL_CONTROLLER.get(UP)),
|
|
|
|
LOGISTICS_TABLE = shape(TABLE_POLE_SHAPE).add(LOGISTICS_TABLE_SLOPE)
|
|
|
|
.forHorizontal(SOUTH),
|
|
|
|
SCHEMATICS_TABLE = shape(TABLE_POLE_SHAPE).add(SCHEMATICS_TABLE_SLOPE)
|
|
|
|
.forDirectional(SOUTH)
|
2020-02-28 22:17:40 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
private static Builder shape(VoxelShape shape) {
|
|
|
|
return new Builder(shape);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Builder shape(double x1, double y1, double z1, double x2, double y2, double z2) {
|
|
|
|
return shape(cuboid(x1, y1, z1, x2, y2, z2));
|
|
|
|
}
|
|
|
|
|
|
|
|
private static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) {
|
|
|
|
return Block.makeCuboidShape(x1, y1, z1, x2, y2, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static class Builder {
|
|
|
|
VoxelShape shape;
|
|
|
|
|
|
|
|
public Builder(VoxelShape shape) {
|
|
|
|
this.shape = shape;
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
return add(cuboid(x1, y1, z1, x2, y2, z2));
|
|
|
|
}
|
|
|
|
|
|
|
|
Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
|
2020-03-26 23:03:56 +01:00
|
|
|
this.shape =
|
|
|
|
VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
|
2020-02-28 22:17:40 +01:00
|
|
|
return this;
|
2019-12-10 23:40:12 +01:00
|
|
|
}
|
2019-12-10 02:23:34 +01:00
|
|
|
|
2020-02-28 22:17:40 +01:00
|
|
|
VoxelShape build() {
|
|
|
|
return shape;
|
2019-12-10 23:40:12 +01:00
|
|
|
}
|
2020-02-28 22:17:40 +01:00
|
|
|
|
|
|
|
VoxelShaper build(BiFunction<VoxelShape, Direction, VoxelShaper> factory, Direction direction) {
|
|
|
|
return factory.apply(shape, direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper build(BiFunction<VoxelShape, Axis, VoxelShaper> factory, Axis axis) {
|
|
|
|
return factory.apply(shape, axis);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper forDirectional(Direction direction) {
|
|
|
|
return build(VoxelShaper::forDirectional, direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper forAxis() {
|
|
|
|
return build(VoxelShaper::forAxis, Axis.Y);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper forHorizontalAxis() {
|
|
|
|
return build(VoxelShaper::forHorizontalAxis, Axis.Z);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper forHorizontal(Direction direction) {
|
|
|
|
return build(VoxelShaper::forHorizontal, direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelShaper forDirectional() {
|
|
|
|
return forDirectional(UP);
|
|
|
|
}
|
|
|
|
|
2019-12-10 23:40:12 +01:00
|
|
|
}
|
2020-02-28 22:17:40 +01:00
|
|
|
|
2019-12-10 02:23:34 +01:00
|
|
|
}
|