Posted July 16, 20223 yr I would like to know if there is a faster method of generating VoxelShapes in different directions in a less boring way, currently I go to the blockbench, rotate my block to a certain direction, and export the model's VoxelShape in that direction. I have to do this for all six directions (north, east, south, west, up, down) every time I create a new rotating block. Code: private static final VoxelShape NORTH = Shapes.box(0.25, 0.25, 0, 0.75, 0.75, 0.25); private static final VoxelShape EAST = Shapes.box(0.75, 0.25, 0.25, 1, 0.75, 0.75); private static final VoxelShape SOUTH = Shapes.box(0.25, 0.25, 0.75, 0.75, 0.75, 1); private static final VoxelShape WEST = Shapes.box(0, 0.25, 0.25, 0.25, 0.75, 0.75); private static final VoxelShape UP = Shapes.box(0.25, 0.75, 0.25, 0.75, 1, 0.75); private static final VoxelShape DOWN = Shapes.box(0.25, 0, 0.25, 0.75, 0.25, 0.75); @Override public @NotNull VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) { switch (state.getValue(FACING)) { case DOWN -> { return DOWN; } case UP -> { return UP; } case SOUTH -> { return SOUTH; } case WEST -> { return WEST; } case EAST -> { return EAST; } default -> { return NORTH; } } } File generated by Blockbench (using extension) in north direction: public VoxelShape makeShape(){ VoxelShape shape = VoxelShapes.empty(); shape = VoxelShapes.join(shape, VoxelShapes.box(0.25, 0.25, 0, 0.75, 0.75, 0.25), IBooleanFunction.OR); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the values used in the static field "NORTH" return shape; } Remembering that the model from all directions is the same, but rotated.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.