AMOnDuck Posted August 28, 2021 Posted August 28, 2021 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. Quote
Luis_ST Posted August 28, 2021 Posted August 28, 2021 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 Quote
AMOnDuck Posted August 28, 2021 Author Posted August 28, 2021 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 Quote
Luis_ST Posted August 28, 2021 Posted August 28, 2021 update in this thread, do not create a new one Quote
AMOnDuck Posted August 28, 2021 Author Posted August 28, 2021 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. Quote
Luis_ST Posted August 29, 2021 Posted August 29, 2021 this is basic java but can simply add befor the ServerPlayer instance: () -> Quote
AMOnDuck Posted August 29, 2021 Author Posted August 29, 2021 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 Quote
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.