Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] [Solved] NPE while Opening GUI


Recommended Posts

I'm trying to create a GUI for a TileEntity on Minecraft 1.8. Basically I want to be able to put in a single book that has been written in, otherwise open the book inside. I am stuck with the GUI allowing you to enter the book.


However, I keep getting an Null Pointer Exception from the Slot class:



My code:

Container: http://pastebin.com/9R5MrmG5

Gui: http://pastebin.com/YdCg8wtN

Gui Handler: http://pastebin.com/tDwbBj41

Block: http://pastebin.com/UKtR0WtT


Any ideas and help would be greatly appreciated!  :D

Link to comment
Share on other sites

If you could show me your tile entity class, i could help.


Few things to notice:

-You open gui, in onBlockActivated() without checking if its a client. The code will crash the server.

-Why you open your gui inside your tile entity?


I suggest you to route your gui opening throught your ClientProxy, it can slove your poblem.

You can use: Minecraft.getMinecraft().displayGuiScreen(new Gui(player));

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.

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.