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

Hello everyone, I'm trying to make 2 GUIs and both of them have problems:

 

1) In this GUI I should be able to insert an item in the only slot of my item (headPhones). The problems are:

    1) I can't interact with the player inventory, in any way

    2) In the container slot there's the item that's in the 2nd slot of the player's hotbar, I don't know why.

 

Here are the classes I used:

 

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/handler/GuiHandler.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/client/gui/HeadPhonesGui.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/items/HeadPhones.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/items/HeadPhonesContainer.java

 

2) This GUI should allow the player to manage Links (I'm making a radio mod), I have 2 textFields and some buttons. The problem is that I can't interact with the textFields, in any way, neither clicking them nor using "textfield.setText("Test Text");". I even tried using a variable to get the String that is inserted.

 

Here are the classed used:

 

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/handler/GuiHandler.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/items/RadioCrystal.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/items/RadioCrystalContainer.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/client/gui/RadioCrystalGui.java

 

Any help, clarifications, suggestions would be really appreciated, thanks.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

  • Author

Anyone has any ideas?

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

The reason nobody helps much on these inventory issues is that it is very involved to look through all the code.

 

2nd, people tend to use their own convention instead of following the tutorials which normally causes the error.

 

In your case, you didn't follow the tutorials at all.  Read them again and start over.  There will never be a way to interact with the players inventory if you have client only functionality defined.

Long time Bukkit & Forge Programmer

Happy to try and help

I think I see your problem, in your gui handler class you are returning null, rather than your container, in getServerGuiElement and returning the container rather than the gui in the getClientGuiElement.  You may have other issues but that is the only issues I see at first glance.

I had the 2nd problem as well. You assigned the slot the players internal inventory. You need to assign it to the tile entity, which should be implementing IInventory. I didnt look through your code, but thats most likely the error.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

Thanks to kenoba10, I have fixed my 1st issue, now I crash trying to open the 2nd GUI, I have the problem at textField.drawtextBox(); and insertField.drawtextBox();

 

Here's the crash:

 

http://pastebin.com/svQq8jDD

 

Thanks for the help.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

  • Author

Even doing that it won't write anything on the textfield. It fixes the crash, but it won't work.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

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.