Jump to content

Recommended Posts

Posted

Hello everyone,

 

In my mod I have a block, with a GUI that shows a List of things. Now I want to create additional GUIS to create, delete and search List Elements. These Functions will have buttons in that GUI. I started to implement a way of changing the GUI by giving a GUIid and running some methods when I press the buttons.

But I feel like there should be a better way to do it, because the class will be extremely big and not well splitted up in the different functions. Is it possible to have new GuiContainers and Containers for the Slots that will start properly on a button press? I will probably need Messages or new Tile Entities for that, but I have no idea how to continue from these ideas.

 

 

 

Secondly, I implemented a quite simple way to scroll through my list in the GUI, because the list has a very dynamic length I only created the Slots in the Container that are visible at the time for the client. It's just to show the items, without any interaction possibilities. But I don't know if this is the right way to do it.

I find it difficult to remain the dynamic of the list, while the Slots need an id of an inventory and the position in the GUI. The position can change whenever the Client scrolls and I thought the slot ID is dependant on the Client as well, to reduce communication between Server and Client. The items are saved in WorldSavedData and the Client only gets it when the player wants to see it. And that should be no big problem, since the CLient isn't able to do anything with these Item Slots.

At the moment the Client looks at his local List and puts it himself in the Slots. But whenever you click on any of these slots, all the slots get empty, which isn't the worst thing that can happen. It's just a bit ugly. I tried to forbid any interaction through a Custom Slot class, but that didn't really work.

 

I would be thankful for any advice

See ya tomorrow

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.