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 constructing a MOD that implements

MyBlock extends net.minecraft.block.Block 

and an associated

MyTileEntity extends net.minecraft.tileentity.TileEntity

that should open

MyGuiScreen extends net.minecraft.client.gui.GuiScreen

when the Minecraft Server decides to.  The client side will ask the server to open MyGuiScreen and the Server will open it, after taking security concerns into account.

 

Currently I have MyGuiScreen opening just fine when the client decides to, like this

if (worldIn.isRemote) playerIn.openGui(MyMod.INSTANCE, MyGuiHandler.GUI_ID, worldIn, x, y, z)

 

How do I allow the server to open MyGuiScreen at the client after the server receives a request from the client to do so?

 

A software engineer’s job is often to condense fact from the nuance of vapor.

If you call

EntityPlayer#openGUI

on the server and your

IGuiHandler#getServerGuiElement

method returns a

Container

, FML will send a packet to the client telling it to open the same GUI (via your

IGuiHandler

).

 

If the open request needs to be sent from the client side (e.g. in response to a key press), send a custom packet to the server. The same applies if your GUI doesn't have a

Container

and you need to send the response packet manually.

 

Forge's documentation explains networking in Minecraft here. This includes the Simple Network Implementation, which you should use to send the packet.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.