Jump to content

DanielP1

Members
  • Posts

    6
  • Joined

  • Last visited

DanielP1's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. So after 3 seconds of standing still, everything like occasional healing, some particle effects, and drinking sounds are all done continuously on the server. Previously I was doing this in the client, sending packets every time there is a sound, every time there are particles, and every time the player should heal (since particles, healing, sounds, are all handled on the server). But I modified this after by just sending one packet, notifying the server that the player has stood still for 3 seconds, which will change a new boolean value in the player capability. Everything else is done from the server from there. This way, it's just one packet when the player stood for 3 seconds, and one packet to send if the player moved after these 3 seconds (to stop the particles, healing, sounds, among other server-side actions on the player). Hard to explain, but I hope it makes sense. Actually I like the approach I just described, minimal packets to send instead of sending 1 position packet every tick (which can be bad according to @warjort)
  2. Yeah that limits me to do much less particle effects and stuff like that Thanks for all the help!
  3. So, if I send a packet to all clients around a player every tick to spawn particles for instance, would this be just as bad or not so bad (since you're not sending to the server)? I do this in my mod when a player has some custom effect going for example, so I was a little curious. (thanks so much for the help btw!) 😁
  4. The thing is that the player will regenerate half a heart every 10 ticks and drinking sounds should be played (from the server) every about 25 ticks until he moves again. So I'm trying to continuously doing stuff on the server side after those 3 seconds, and I felt that it would make life easier if I could just get the proper position values on the server. I have code for both approaches and the code works exactly the same, but if you're telling me that sending a packet every tick may cause networking issues rather than sending 2 packets every 10 and 25 ticks, then I will stick with the second approach. Unless you have a different suggestion? Or do you think this is the best that can be done in this case?
  5. Thank you for the reply. How would I get the correct values for the previous position and the current position on the server? I'm making this item that needs you to catch your breath (i.e., stand in place) for 3 seconds before it does something. When I store in a capability, it periodically shows that I am not moving (the prev pos is equal to the current pos) for some ticks every second, even though I'm actively running. And when I stand in place, it tells me that I am standing in place, but at tick 20 it tells me I am moving for 1 tick and then standing (until I move again, making this a 4 second wait as it resets the 3 seconds). I hope you understand what I mean and can help me understand why this is happening.
  6. Hey, I've been trying to get the position of a player on the server, but I found out that it's mostly wrong and doesn't update every tick. I tried doing this in the capability, but as I said, the position on the server doesn't update every tick (for example, for a few ticks per second, the previous posX would be equal to posX) and a lot of the time it's not accurate. Right now, I'm sending a packet to the server that sends the client player position to the server in PlayerTickEvent every tick. This approach works, but I was wondering if there is a more efficient way to accomplish this. Any help is appreciated. Thank you!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.