June 25, 20223 yr 1 minute ago, Zanckor said: So, i need to call this custom packet on ServerTickEvent, but this dont will lag player? you can regenderate your Ki on server and client, if the Ki is fully regenderate on server send a Packet to the client which makes sure the values are the same but this means you have to check whenever the client whats to call a action if the Ki value does match with the server on and yeah you should avoid sending Packets each tick
June 25, 20223 yr Author Wait a second xD, so, i need to put my regen code on server side, and then sync it from server to client, arent? But, I still dont know how to put this code on server side, i mean, if i put it on ServerTickEvent i cant put (Player player = e.getPlayer), so, how server know to which player is this info
June 25, 20223 yr 30 minutes ago, Zanckor said: But, I still dont know how to put this code on server side, i mean, if i put it on ServerTickEvent i cant put (Player player = e.getPlayer), so, how server know to which player is this info check if the player of the Event is an instance of ServerPlayer
June 26, 20223 yr Author Okay, so, i should do something like, if(player instanceof ServerPlayer){ RegenCode } and, if(player instanceof Player) { RegenCode }, but when, on server side, Current Ki is full, 0, or whatever i want, send a packet to check if both values are the same, and if not change client value Edit: Okay, i realized that its better just make it server side, and whenever i need to use it, like, before attacking with ki, send a packet to sync it Edited June 26, 20223 yr by Zanckor
June 26, 20223 yr 1 hour ago, Zanckor said: Okay, so, i should do something like, if(player instanceof ServerPlayer){ RegenCode } and, if(player instanceof Player) { RegenCode }, but when, on server side, Current Ki is full, 0, or whatever i want, send a packet to check if both values are the same, and if not change client value Edit: Okay, i realized that its better just make it server side, and whenever i need to use it, like, before attacking with ki, send a packet to sync it logic like this should always be done on server and only sync it to the client if it is necessary
June 26, 20223 yr Author Look, with this code is already working without packets, at least on singleplayer, that should work on multiplayer too? Is regenerating and working with other methods https://ibb.co/B3NXYGx Edited June 26, 20223 yr by Zanckor
June 26, 20223 yr Author 30 minutes ago, Luis_ST said: should work, you can test it via running the runServer gradle task So, why should i send packets if it works now?
June 26, 20223 yr 1 hour ago, Zanckor said: So, why should i send packets if it works now? you now do it fully server side you don't need any Packets, unless you need the Ki value on the client
July 8, 20223 yr Author Yo! Here again. I'm trying to create a Packet to Server, but is actually not working. Is calling my packet correctly, but not updating my data. There's where I call my Packet: https://pastebin.com/ajFJNSK0 And my Packet: https://pastebin.com/02h43R34
July 8, 20223 yr you sending the Packet from client to sever, this means you can not do this in your handle method Player player = (Player) Minecraft.getInstance().getCameraEntity(); you should use the player from the Context (Context#getSender) why did you return a boolean from the handle method?
July 8, 20223 yr Author 9 minutes ago, Luis_ST said: why did you return a boolean from the handle method? I've seen it on another packet, so i thougth it should be a boolean method, but can it be public void handle?
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.