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

Hi, 

 

I have a block that has a Custom Gui, but every time I right-click the block it won't appear. I know that the TileEntities are working because I wrote a debug line that "checks" if it's working. This is the error that's shown in the console when I right-click:

[06:37:34] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException



This is the onBlockActivated boolean in my Block:

    //BLOCK RIGHT-CLICKED (Opens GUI and Debug)
    @Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
        if (!world.isRemote) {
            //Sends a message in chat stating "Grinder Clicked"
            player.sendMessage(new TextComponentString("Grinder Clicked"));
            //Opens GUI
            player.openGui(Main.instance, ModGuiHandler.GRINDER, world, pos.getX(), pos.getY(), pos.getZ());
        }
        return true;
    }

I've also tried putting player.openGui outside of the if function, but that results in a crash. The ModGuiHandler is registered correctly as well, for NetworkRegistry.INSTANCE.


Additional Info:
I followed ShadowFacts tutorial for onBlockActivated


Any help is appreciated, thank you. 

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.