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.

[1.7.10 -> 1.8][Solved] Player logged-in packet sending. (I mean, cmon)

Featured Replies

Posted

God... this is literally 3rd thread with same problem.

 

Have look at this:

http://www.minecraftforge.net/forum/index.php/topic,27329.msg139843.html#msg139843

 

I just updated from 1.7.10 to 1.8 and this shit is messing with my brain again.

 

In 1.7.10 solution was to use combination of:

PlayerLoggedInEvent

PlayerRespawnEvent

PlayerChangedDimensionEvent

...and there was no problem since at the time any of those was executed client alredy had his entity.

 

But now, someone decided to make me hang myself on a mouse cable by making PlayerLoggedInEvent launch just before client has constructed my player, so I (again) cannot send any "initial" packet.

EntityConstructing and EntityJoinWorldEvent on CLIENT happen WAY too late and until that time I cannot do shit.

 

Anyone knows anything here?

 

Goal stays the same: Send synchro packet to player after he reconstructs (no matter why - login/respawn). Ofc do it without using ticks and client-side requests.

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

  • Author

Oh my, new things ;p

 

Okay, I implemented IThreadListener and (inside onMessage)

this.addScheduledTask(new ScheludedTask((byte) 0, player, message));

ScheludedTask is my implementation of Runnable

 

How do I actually make my Runnable run()?

 

I am totally green here. Idk if I should even pass message into Runnable.

 

Thanks for help :)

 

EDIT: W8, don't tell me, i think I got it working! (testing critical situations).

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

  • Author

Yuuuup, It works like a charm.

width=400 height=212http://img-9gag-lol.9cache.com/photo/aKg3ZY3_460sa_v1.gif[/img]

 

Thanks as always diesieben (da real MVP).

 

Handler#onMessage(...)

System.out.println("RECEIVED OPEN CLOSE GUI PACKET");
		Minecraft.getMinecraft().addScheduledTask(new ScheludedClientTask(message));

Task:

private IMessage message;

public ScheludedClientTask(IMessage message)
{
	this.message = message;
}

@Override
public void run()
{
	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	if (message instanceof PacketOpenCloseGui)
	{
		PacketOpenCloseGui msg = (PacketOpenCloseGui) this.message;
		switch(msg.b)
		{
		case 1: player.openGui(Main.instance, 100, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); break;
		}
	}
}

Task will run after thePlayer is constructed.

 

Thread solved.

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.