mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 03:27:56 +01:00
Remove unnecessary shouldUpdate method in Entity
This commit is contained in:
parent
30a7843018
commit
62ab0a2007
@ -105,7 +105,6 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
|||||||
private long scheduledRemoveTime;
|
private long scheduledRemoveTime;
|
||||||
|
|
||||||
private final Set<Entity> passengers = new CopyOnWriteArraySet<>();
|
private final Set<Entity> passengers = new CopyOnWriteArraySet<>();
|
||||||
private long lastUpdate;
|
|
||||||
protected EntityType entityType; // UNSAFE to change, modify at your own risk
|
protected EntityType entityType; // UNSAFE to change, modify at your own risk
|
||||||
|
|
||||||
// Network synchronization, send the absolute position of the entity each X milliseconds
|
// Network synchronization, send the absolute position of the entity each X milliseconds
|
||||||
@ -461,8 +460,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Entity tick
|
// Entity tick
|
||||||
if (shouldUpdate(time)) {
|
{
|
||||||
this.lastUpdate = time;
|
|
||||||
|
|
||||||
// Velocity
|
// Velocity
|
||||||
boolean applyVelocity = false;
|
boolean applyVelocity = false;
|
||||||
@ -1417,10 +1415,6 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
|||||||
this.lastAbsoluteSynchronizationTime = 0;
|
this.lastAbsoluteSynchronizationTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldUpdate(long time) {
|
|
||||||
return (float) (time - lastUpdate) >= MinecraftServer.TICK_MS * 0.9f; // Margin of error
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum Pose {
|
private enum Pose {
|
||||||
STANDING,
|
STANDING,
|
||||||
FALL_FLYING,
|
FALL_FLYING,
|
||||||
|
Loading…
Reference in New Issue
Block a user