Jump to content

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


Ernio

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.