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

So I kinda touched piece of code I wrote long ago.

 

Anyway:

player.openGui, when called on: (logical side)

* Client = will ONLY call #getClientGuiElement

* Server = will call #getServerGuiElement and send packet to client that will call #getClientGuiElement.

 

Yeah, all cool, so what's the problem?

 

Try calling player.openGui in PlayerEvent.PlayerLoggedInEvent.

 

Logically - it SHOULD open gui on client (given client has gui assigned to proper id).

It doesn't.

At first i though that maybe someone forgot about thread safety, but nope (OpenGuiHandler) - it is there.

 

So question arises:

Why does this work:

@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
{
Network.sendTo(new PacketSendGui((byte) 1), (EntityPlayerMP) event.player);
}

@Override
public IMessage handleClientMessage(final EntityPlayer player, final PacketSendGui message, MessageContext ctx)
{
Minecraft.getMinecraft().addScheduledTask(new Runnable()
{
	public void run()
	{
		player.openGui(RoAMain.instance, message.id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
	}
});
return null;
}

And this doesn't:

public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
{
event.player.openGui(Main.instance, 1, event.player.worldObj, (int) event.player.posX, (int) event.player.posY, (int) event.player.posZ);
}

 

I mean - it's literally same routine.

 

<Looks at Guru diesieben>

1.7.10 is no longer supported by forge, you are on your own.

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.