Jump to content

Recommended Posts

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

Posted

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

Posted

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.

Posted

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]

Posted

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

Posted

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

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

Announcements



×
×
  • Create New...

Important Information

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