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'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:

http://pastebin.com/tDE1wAwP

 

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

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

Yeah okay, still watch out for side checking when you open your gui, because it can cause a crash when you fire up a server.

 

Glad you figured it out!

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.