Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.