mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-27 14:13:24 +02:00
Cleanup
This commit is contained in:
parent
fe568abe70
commit
8ae82a81a1
@ -474,7 +474,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
getVelocity().getY() / tps,
|
||||
getVelocity().getZ() / tps
|
||||
);
|
||||
onGround = CollisionUtils.handlePhysics(this, deltaPos, newPosition, newVelocityOut);
|
||||
this.onGround = CollisionUtils.handlePhysics(this, deltaPos, newPosition, newVelocityOut);
|
||||
|
||||
// Check chunk
|
||||
if (!ChunkUtils.isLoaded(instance, newPosition.getX(), newPosition.getZ())) {
|
||||
@ -505,8 +505,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
}
|
||||
}
|
||||
|
||||
velocity.copy(newVelocityOut);
|
||||
velocity.multiply(tps);
|
||||
this.velocity.copy(newVelocityOut);
|
||||
this.velocity.multiply(tps);
|
||||
|
||||
float drag;
|
||||
if (onGround) {
|
||||
@ -528,8 +528,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
drag = 0.98f; // air drag
|
||||
}
|
||||
|
||||
velocity.setX(velocity.getX() * drag);
|
||||
velocity.setZ(velocity.getZ() * drag);
|
||||
this.velocity.setX(velocity.getX() * drag);
|
||||
this.velocity.setZ(velocity.getZ() * drag);
|
||||
|
||||
sendSynchronization();
|
||||
|
||||
|
@ -2,7 +2,6 @@ package net.minestom.server.entity;
|
||||
|
||||
import com.extollit.gaming.ai.path.HydrazinePathFinder;
|
||||
import com.extollit.gaming.ai.path.model.IPath;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.attribute.Attributes;
|
||||
import net.minestom.server.collision.CollisionUtils;
|
||||
import net.minestom.server.entity.ai.GoalSelector;
|
||||
@ -432,7 +431,6 @@ public abstract class EntityCreature extends LivingEntity {
|
||||
|
||||
final float radians = (float) Math.atan2(dz, dx);
|
||||
final float speedX = (float) (Math.cos(radians) * speed);
|
||||
final float speedY = noGravity ? 0 : -gravityDragPerTick * MinecraftServer.TICK_PER_SECOND;
|
||||
final float speedZ = (float) (Math.sin(radians) * speed);
|
||||
|
||||
lookAlong(dx, direction.getY(), dz);
|
||||
@ -441,8 +439,9 @@ public abstract class EntityCreature extends LivingEntity {
|
||||
Vector newVelocityOut = new Vector();
|
||||
|
||||
// Prevent ghosting
|
||||
CollisionUtils.handlePhysics(this, new Vector(speedX, speedY, speedZ), newPosition, newVelocityOut);
|
||||
this.onGround = CollisionUtils.handlePhysics(this, new Vector(speedX, 0, speedZ), newPosition, newVelocityOut);
|
||||
|
||||
// Will move the entity during Entity#tick
|
||||
getPosition().setX(newPosition.getX());
|
||||
getPosition().setZ(newPosition.getZ());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user