2019-12-10 02:23:34 +01:00
|
|
|
package com.simibubi.create.foundation.utility;
|
|
|
|
|
2019-12-12 11:58:29 +01:00
|
|
|
import static net.minecraft.block.Block.makeCuboidShape;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
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;
|
2019-12-10 23:40:12 +01:00
|
|
|
import net.minecraft.util.math.Vec3d;
|
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 {
|
|
|
|
|
|
|
|
public static final VoxelShaper
|
2019-12-10 17:45:42 +01:00
|
|
|
SHORT_CASING_14_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 14, 16), Direction.UP),
|
|
|
|
SHORT_CASING_12_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 12, 16), Direction.UP),
|
|
|
|
SHORT_CASING_11_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 11, 16), Direction.UP),
|
2019-12-10 02:23:34 +01:00
|
|
|
HARVESTER_BASE = VoxelShaper.forHorizontal(makeCuboidShape(0, 2, 0, 16, 14, 3), Direction.SOUTH),
|
|
|
|
MOTOR_BLOCK = VoxelShaper.forHorizontal(makeCuboidShape(0, 3, 3, 16, 13, 13), Direction.EAST),
|
|
|
|
FOUR_VOXEL_POLE = VoxelShaper.forDirectionalAxis(makeCuboidShape(6, 0, 6, 10, 16, 10), Direction.Axis.Y),
|
|
|
|
SIX_VOXEL_POLE = VoxelShaper.forDirectionalAxis(makeCuboidShape(5, 0, 5, 11, 16, 11), Direction.Axis.Y),
|
2020-01-05 19:41:38 +01:00
|
|
|
BELT_FUNNEL = VoxelShaper.forHorizontal(makeCuboidShape(3, -4, 11, 13, 8, 17), Direction.SOUTH),
|
|
|
|
FUNNEL = VoxelShaper.forDirectional(makeCuboidShape(1, 1, 13, 15, 15, 17), Direction.SOUTH),
|
2019-12-22 01:31:40 +01:00
|
|
|
EXTRACTOR = VoxelShaper.forDirectional(makeCuboidShape(4, 2, 11, 12, 10, 17), Direction.SOUTH)
|
2020-01-05 19:41:38 +01:00
|
|
|
.withVerticalShapes(makeCuboidShape(4, 11, 4, 12, 17, 12)),
|
|
|
|
TRANSPOSER = VoxelShaper.forDirectional(VoxelShapes.or(
|
|
|
|
makeCuboidShape(4, 4, -1, 12, 12, 1),
|
|
|
|
makeCuboidShape(5, 5, 0, 11, 11, 16),
|
2020-02-05 12:36:22 +01:00
|
|
|
makeCuboidShape(4, 4, 11, 12, 12, 17)), Direction.SOUTH),
|
|
|
|
FURNACE_ENGINE = VoxelShaper.forHorizontal(VoxelShapes.or(
|
|
|
|
makeCuboidShape(1, 1, 0, 15, 15, 16),
|
2020-02-12 01:36:18 +01:00
|
|
|
makeCuboidShape(0, 0, 9, 16, 16, 14)), Direction.SOUTH),
|
|
|
|
PORTABLE_STORAGE_INTERFACE = VoxelShaper.forDirectional(VoxelShapes.or(
|
|
|
|
makeCuboidShape(0, 0, 0, 16, 12, 16),
|
2020-02-15 18:54:23 +01:00
|
|
|
makeCuboidShape(3, 12, 3, 13, 16, 13)), Direction.UP),
|
|
|
|
PULLEY = VoxelShaper.forHorizontalAxis(VoxelShapes.or(
|
|
|
|
makeCuboidShape(0, 0, 0, 16, 16, 2),
|
|
|
|
makeCuboidShape(1, 1, 2, 15, 15, 14),
|
|
|
|
makeCuboidShape(0, 0, 14, 16, 16, 16)), Direction.SOUTH)
|
2019-12-10 02:23:34 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
2019-12-15 01:13:36 +01:00
|
|
|
|
2019-12-10 02:23:34 +01:00
|
|
|
private static final VoxelShape
|
|
|
|
LOGISTICAL_CASING_MIDDLE_SHAPE = VoxelShapes.or(
|
|
|
|
makeCuboidShape(1,0,1,15,16,15),
|
|
|
|
makeCuboidShape(0,0,0,2,16,2),
|
|
|
|
makeCuboidShape(14,0,0,16,16,2),
|
|
|
|
makeCuboidShape(0,0,14,2,16,16),
|
|
|
|
makeCuboidShape(14,0,14,16,16,16)),
|
|
|
|
LOGISTICAL_CASING_CAP_SHAPE = VoxelShapes.or(
|
|
|
|
LOGISTICAL_CASING_MIDDLE_SHAPE,
|
|
|
|
makeCuboidShape(0,0,0,16,2,16)),
|
|
|
|
CART_ASSEMBLER_SHAPE = VoxelShapes.or(
|
|
|
|
VoxelShapes.fullCube(),
|
|
|
|
makeCuboidShape(-2, 0, 1, 18, 13, 15)),
|
2019-12-15 01:13:36 +01:00
|
|
|
MECHANICAL_PISTON_HEAD_SHAPE_UP = Blocks.PISTON_HEAD.getStateContainer().getBaseState().with(DirectionalBlock.FACING, Direction.UP).with(PistonHeadBlock.SHORT, true).getShape(null, null),
|
2019-12-10 02:23:34 +01:00
|
|
|
MECHANICAL_PISTON_EXTENDED_SHAPE_UP = VoxelShapes.or(
|
2019-12-10 17:45:42 +01:00
|
|
|
SHORT_CASING_12_VOXEL.get(Direction.UP),
|
2019-12-10 02:23:34 +01:00
|
|
|
FOUR_VOXEL_POLE.get(Direction.Axis.Y)),
|
|
|
|
SMALL_GEAR_SHAPE = makeCuboidShape(2, 6, 2, 14, 10, 14),
|
|
|
|
LARGE_GEAR_SHAPE = makeCuboidShape(0, 6, 0, 16, 10, 16),
|
|
|
|
VERTICAL_TABLET_SHAPE_SOUTH = makeCuboidShape(3, 1, -1, 13, 15, 3),
|
|
|
|
SQUARE_TABLET_SHAPE_SOUTH = makeCuboidShape(2, 2, -1, 14, 14, 3),
|
|
|
|
PACKAGE_FUNNEL_SHAPE_UP = makeCuboidShape(1, -1, 1, 15, 3, 15),
|
|
|
|
TABLE_POLE_SHAPE = VoxelShapes.or(
|
|
|
|
makeCuboidShape(4, 0, 4, 12, 2, 12),
|
|
|
|
makeCuboidShape(5, 2, 5, 11, 14, 11)),
|
|
|
|
LOGISTICS_TABLE_SLOPE_SOUTH = VoxelShapes.or(
|
|
|
|
makeCuboidShape(0, 10D, 15, 16, 14, 10.667),
|
|
|
|
makeCuboidShape(0, 12, 10.667, 16, 16, 6.333),
|
2019-12-10 17:45:42 +01:00
|
|
|
makeCuboidShape(0, 14, 6.333, 16, 18, 2)),
|
|
|
|
SCHEMATICS_TABLE_SLOPE_SOUTH = VoxelShapes.or(
|
|
|
|
makeCuboidShape(0, 10, 16, 16, 14, 11),
|
|
|
|
makeCuboidShape(0, 12, 11, 16, 16, 6),
|
2019-12-10 23:40:12 +01:00
|
|
|
makeCuboidShape(0, 14, 6, 16, 18, 1)),
|
|
|
|
GAUGE_SHAPE_UP = VoxelShapes.or(
|
|
|
|
makeCuboidShape(1, 0, 0, 15, 2, 16),//plate
|
2020-01-28 20:35:46 +01:00
|
|
|
makeCuboidShape(2, 2, 1, 14, 14, 15)),//log
|
|
|
|
NOZZLE_SHAPE_UP = VoxelShapes.or(
|
|
|
|
makeCuboidShape(2, 0, 2, 14, 14, 14),
|
|
|
|
VoxelShapes.combine(
|
|
|
|
makeCuboidShape(1, 13, 1, 15, 15, 15),
|
|
|
|
makeCuboidShape(3, 13, 3, 13, 15, 13),
|
|
|
|
IBooleanFunction.ONLY_FIRST)),
|
|
|
|
CRANK_SHAPE_UP = VoxelShapes.or(
|
|
|
|
makeCuboidShape(5, 0, 5, 11, 6, 11),
|
|
|
|
makeCuboidShape(1, 3, 1, 15, 8, 15)
|
|
|
|
)
|
2019-12-10 02:23:34 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
public static final VoxelShape
|
|
|
|
LOGISTICAL_CASING_SINGLE_SHAPE = VoxelShapes.or(
|
|
|
|
makeCuboidShape(0, 0, 0, 16, 2, 16),
|
|
|
|
makeCuboidShape(1, 1, 1, 15, 15, 15),
|
|
|
|
makeCuboidShape(0, 14, 0, 16, 16, 16)),
|
2019-12-16 12:03:42 +01:00
|
|
|
BASIN_BLOCK_SHAPE = VoxelShapes.or(
|
|
|
|
makeCuboidShape(2, 0, 2, 14, 2, 14),
|
2020-02-04 14:48:21 +01:00
|
|
|
VoxelShapes.combine(
|
|
|
|
makeCuboidShape(0, 2, 0, 16, 13, 16),
|
|
|
|
makeCuboidShape(2, 5, 2, 14, 14, 14),
|
|
|
|
IBooleanFunction.ONLY_FIRST)),
|
2019-12-10 02:23:34 +01:00
|
|
|
CRUSHING_WHEEL_COLLISION_SHAPE = makeCuboidShape(0, 0, 0, 16, 22, 16),
|
2019-12-10 17:45:42 +01:00
|
|
|
MECHANICAL_PROCESSOR_SHAPE = VoxelShapes.combineAndSimplify(
|
|
|
|
VoxelShapes.fullCube(),
|
|
|
|
makeCuboidShape(4, 0, 4, 12, 16, 12),
|
|
|
|
IBooleanFunction.ONLY_FIRST),
|
2019-12-10 02:23:34 +01:00
|
|
|
TURNTABLE_SHAPE = VoxelShapes.or(
|
2020-01-24 14:21:50 +01:00
|
|
|
makeCuboidShape(1, 4, 1, 15, 8, 15),
|
|
|
|
makeCuboidShape(5, 0, 5, 11, 4, 11)),
|
2019-12-10 02:23:34 +01:00
|
|
|
CRATE_BLOCK_SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15),
|
2019-12-10 17:45:42 +01:00
|
|
|
LOGISTICS_TABLE_BASE = TABLE_POLE_SHAPE,
|
|
|
|
BELT_COLLISION_MASK = makeCuboidShape(0, 0, 0, 16, 19, 16),
|
|
|
|
SCHEMATICANNON_SHAPE = VoxelShapes.or(
|
|
|
|
makeCuboidShape(1, 0, 1, 15, 8, 15),
|
2020-02-15 18:54:23 +01:00
|
|
|
makeCuboidShape(0.5, 8, 0.5, 15.5, 11, 15.5)),
|
|
|
|
PULLEY_MAGNET = VoxelShapes.or(
|
|
|
|
makeCuboidShape(3, 0, 3, 13, 2, 13),
|
|
|
|
FOUR_VOXEL_POLE.get(Direction.UP))
|
|
|
|
|
2019-12-10 02:23:34 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final VoxelShaper
|
|
|
|
LOGISTICAL_CASING_MIDDLE = VoxelShaper.forDirectional(LOGISTICAL_CASING_MIDDLE_SHAPE, Direction.UP),
|
|
|
|
LOGISTICAL_CASING_CAP = VoxelShaper.forDirectional(LOGISTICAL_CASING_CAP_SHAPE, Direction.UP),
|
2020-01-28 20:35:46 +01:00
|
|
|
NOZZLE = VoxelShaper.forDirectional(NOZZLE_SHAPE_UP, Direction.UP),
|
|
|
|
CRANK = VoxelShaper.forDirectional(CRANK_SHAPE_UP, Direction.UP),
|
2019-12-10 02:23:34 +01:00
|
|
|
CART_ASSEMBLER = VoxelShaper.forHorizontalAxis(CART_ASSEMBLER_SHAPE, Direction.SOUTH),
|
|
|
|
MECHANICAL_PISTON_HEAD = VoxelShaper.forDirectional(MECHANICAL_PISTON_HEAD_SHAPE_UP, Direction.UP),
|
2019-12-10 17:45:42 +01:00
|
|
|
MECHANICAL_PISTON = SHORT_CASING_12_VOXEL,
|
2019-12-10 02:23:34 +01:00
|
|
|
MECHANICAL_PISTON_EXTENDED = VoxelShaper.forDirectional(MECHANICAL_PISTON_EXTENDED_SHAPE_UP, Direction.UP),
|
|
|
|
SMALL_GEAR = VoxelShaper.forDirectionalAxis(VoxelShapes.or(SMALL_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)), Direction.Axis.Y),
|
|
|
|
LARGE_GEAR = VoxelShaper.forDirectionalAxis(VoxelShapes.or(LARGE_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)), Direction.Axis.Y),
|
|
|
|
LOGISTICAL_CONTROLLER = VoxelShaper.forDirectional(SQUARE_TABLET_SHAPE_SOUTH, Direction.SOUTH),
|
|
|
|
REDSTONE_BRIDGE = VoxelShaper.forHorizontal(VERTICAL_TABLET_SHAPE_SOUTH, Direction.SOUTH).withVerticalShapes(LOGISTICAL_CONTROLLER.get(Direction.UP)),
|
|
|
|
LOGISTICAL_INDEX = REDSTONE_BRIDGE,
|
|
|
|
PACKAGE_FUNNEL = VoxelShaper.forDirectional(PACKAGE_FUNNEL_SHAPE_UP, Direction.UP),
|
2019-12-10 17:45:42 +01:00
|
|
|
LOGISTICS_TABLE = VoxelShaper.forHorizontal(VoxelShapes.or(TABLE_POLE_SHAPE, LOGISTICS_TABLE_SLOPE_SOUTH), Direction.SOUTH),
|
|
|
|
SCHEMATICS_TABLE = VoxelShaper.forDirectional(VoxelShapes.or(TABLE_POLE_SHAPE, SCHEMATICS_TABLE_SLOPE_SOUTH), Direction.SOUTH)
|
2019-12-10 02:23:34 +01:00
|
|
|
|
|
|
|
;
|
|
|
|
|
2019-12-10 23:40:12 +01:00
|
|
|
public static final GaugeShaper GAUGE = GaugeShaper.make();
|
|
|
|
|
|
|
|
|
|
|
|
public static class GaugeShaper extends VoxelShaper {
|
|
|
|
|
|
|
|
private VoxelShaper axisFalse, axisTrue;
|
|
|
|
|
|
|
|
private static GaugeShaper make(){
|
|
|
|
GaugeShaper shaper = new GaugeShaper();
|
|
|
|
shaper.axisFalse = forDirectional(AllShapes.GAUGE_SHAPE_UP, Direction.UP);
|
|
|
|
shaper.axisTrue = forDirectional(rotatedCopy(AllShapes.GAUGE_SHAPE_UP, new Vec3d(0, 90, 0)), Direction.UP);
|
|
|
|
//shapes for X axis need to be swapped
|
|
|
|
Arrays.asList(Direction.EAST, Direction.WEST).forEach(direction -> {
|
|
|
|
VoxelShape mem = shaper.axisFalse.get(direction);
|
|
|
|
shaper.axisFalse.withShape(shaper.axisTrue.get(direction), direction);
|
|
|
|
shaper.axisTrue.withShape(mem, direction);
|
|
|
|
});
|
|
|
|
return shaper;
|
|
|
|
}
|
2019-12-10 02:23:34 +01:00
|
|
|
|
2019-12-10 23:40:12 +01:00
|
|
|
public VoxelShape get(Direction direction, boolean axisAlong) {
|
|
|
|
return (axisAlong ? axisTrue : axisFalse).get(direction);
|
|
|
|
}
|
|
|
|
}
|
2019-12-10 02:23:34 +01:00
|
|
|
}
|