Ernio Posted February 7, 2015 Posted February 7, 2015 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. Quote 1.7.10 is no longer supported by forge, you are on your own.
Ernio Posted February 7, 2015 Author Posted February 7, 2015 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). Quote 1.7.10 is no longer supported by forge, you are on your own.
Ernio Posted February 7, 2015 Author Posted February 7, 2015 Yuuuup, It works like a charm. http://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. Quote 1.7.10 is no longer supported by forge, you are on your own.
Recommended Posts
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.