Posted August 28, 20214 yr I'm trying to make a client respawn when certain conditions are met which I currently accomplish by just setting the player health to 20 however this does not cause the death screen to disapear. Is there a way to eighter make the deathscreen disapear or send a message to the client to emulate a respawn button press? If anyone knows of a better way to handle this that would work aswell.
August 28, 20214 yr look into the deathscreen, and copy the logic when the player press the respawn button note the screen is client side, but the Player respawn is handlet on the server
August 28, 20214 yr Author Thanks for the quick response luis, I could indeed find the logic I needed in Deathscreen, if I run into any trouble causing it to activate I may post an update unless I decide that It is more fit for a diffrent topic
August 28, 20214 yr Author I think I have everything mostly down however this little bit of the packet sending is causing me grief: private static void respawnPlayer(ServerPlayerEntity player) { ImmortalityRespawnToClient msg = new ImmortalityRespawnToClient(true); PondWeaponMod.simpleChannel.send(PacketDistributor.PLAYER.with(player), msg); } I cannot figure out how the PacketDistributor#PLAYER.with function wants me to pass the ServerPlayerEntity. It seems to ask for a Supplier<ServerPlayerEntity> but I cannot cast or figure out how to insert a ServerPlayerEntity into that. If you could help me out here (or at least point me in the right direction) that would be greatly appreciated.
August 29, 20214 yr Author I see, thank you for taking the time to answer such a stupid question then, I haven't had to use lambda expressions much in java so far so this didn't occur to me. Packets seem to be working just fine now
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.