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.

[1.12.2] Different Rotation methods in one Class

Featured Replies

Posted

Currently i have 2 Block classes, BlockBase and BlockAdv, BlockBase handles name, material and tab. Adv is meant to handle Fullcube(for models), collision and rotation method.
Full cube and Collision currently work, however setting rotation method is being a pain. there are 3 states meant for rotation
0=No rotation
1=NSEW Playerbased
2=UDNSEW Block Face Based

However with the way forge loads things, createBlockState Loads before the blocks, meaning i cant assign the block to a rotation method... Here's the chunk of code that's causing me issues

public static int rotation = 0;

    public static final PropertyDirection HFACING = BlockHorizontal.FACING; //NSEW Player based
    public static final PropertyDirection DFACING = BlockDirectional.FACING; //UDNSEW Block face Based
    
    //Everything defaults to NSEW to avoid issues.
    @Override
    protected BlockStateContainer createBlockState() {
        if (rotation == 2) return new BlockStateContainer(this, new IProperty[]{DFACING});
        if (rotation == 1) return new BlockStateContainer(this, new IProperty[]{HFACING});
        return super.createBlockState();
    }


Since this loads before the Blocks it causes issues, is there a way to delay this or put this after blocks load. If not possible i can write in separate classes, not that big of an issue, just seeing if its possible.
Thanks ?

Guest
This topic is now closed to further replies.

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.