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. In my mod, I need my item to open the gui when the left mouse button is pressed and change the properties of the same item. I figured out how to open my gui with -> NetworkHooks :: openGui. However, I have 2 questions.
1) How to transfer the subject on which I opened?
2) How the client and server parts work. That is, I do not understand how to change the nbt tag of an item from Sceen(such as pressing a button), which works on the client, and so that this is on the server?

Also, I essentially need to register my Container with Forge, but this registration is done through the IFactory method, which forces it to adhere to one pattern.
In general, please help me to understand this all in advance thanks.

 

I also wanted to ask for a bonus, is it possible to open Gui by their registration id?

 

MC version ->1.15.2

Edited by Sleepwalkerx

1. Transfer what subject? The focus of the screen? It's always on the currently open screen.

2. Changing anything on the client does not work, you would need to send a packet back to the server with the change or have the logic execute on the server (preferably the latter).

On 5/22/2021 at 1:57 PM, Sleepwalkerx said:

Also, I essentially need to register my Container with Forge, but this registration is done through the IFactory method, which forces it to adhere to one pattern.

It's a factory to create a container for a specific circumstance. It's not supposed to be reusable for every single thing you do. If you wanted that, do some inheritance to make it to the point where the amount of code needed to modify is minimal.

On 5/22/2021 at 1:57 PM, Sleepwalkerx said:

I also wanted to ask for a bonus, is it possible to open Gui by their registration id?

Screens don't have a registry object, they are only present on the logical client. They can be attached to containers to give a server a client form or they can just be standalone. If you're going to open a screen, you can simply just call the display screen method either in Minecraft or ClientPlayerEntity similar to how the sign does it.

  • Author
57 minutes ago, ChampionAsh5357 said:

1. Transfer what subject? The focus of the screen? It's always on the currently open screen.

2. Changing anything on the client does not work, you would need to send a packet back to the server with the change or have the logic execute on the server (preferably the latter).

It's a factory to create a container for a specific circumstance. It's not supposed to be reusable for every single thing you do. If you wanted that, do some inheritance to make it to the point where the amount of code needed to modify is minimal.

Screens don't have a registry object, they are only present on the logical client. They can be attached to containers to give a server a client form or they can just be standalone. If you're going to open a screen, you can simply just call the display screen method either in Minecraft or ClientPlayerEntity similar to how the sign does it.

Thank you very much for your answer, but while I was waiting for the answer I figured it out myself. Thanks to the developer Botania, I took an example from there. However, I have another question about the GUI, I have already posted it on the forum.
Thank you very much for your help!

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.