Jump to content

[1.12.2] [Unsolved] Custom GUI Won't Open


Recommended Posts



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)
    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. 

Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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