mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 22:47:49 +01:00
Fast exit if the player didn't move
This commit is contained in:
parent
18b0e21f21
commit
898252dad0
@ -465,6 +465,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
|
||||
private void velocityTick() {
|
||||
final boolean isSocketClient = PlayerUtils.isSocketClient(this);
|
||||
if (isSocketClient) {
|
||||
if (position.samePoint(previousPosition))
|
||||
return; // Didn't move since last tick
|
||||
// Calculate velocity from client
|
||||
velocity = position.sub(previousPosition).asVec().mul(MinecraftServer.TICK_PER_SECOND);
|
||||
previousPosition = position;
|
||||
|
@ -4,7 +4,7 @@ import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.event.trait.CancellableEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EventDispatcher {
|
||||
public final class EventDispatcher {
|
||||
|
||||
public static void call(@NotNull Event event) {
|
||||
MinecraftServer.getGlobalEventHandler().call(event);
|
||||
|
Loading…
Reference in New Issue
Block a user