Send velocity for all entities

This commit is contained in:
Holly Stubbs 2023-11-05 10:58:47 +00:00
parent 23a1d124c0
commit 8054f06327
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -9,6 +9,7 @@ import { PacketEntityLookRelativeMove } from "../packets/EntityLookRelativeMove"
import { PacketEntityMetadata } from "../packets/EntityMetadata"; import { PacketEntityMetadata } from "../packets/EntityMetadata";
import { PacketEntityRelativeMove } from "../packets/EntityRelativeMove"; import { PacketEntityRelativeMove } from "../packets/EntityRelativeMove";
import { PacketEntityTeleport } from "../packets/EntityTeleport"; import { PacketEntityTeleport } from "../packets/EntityTeleport";
import { PacketEntityVelocity } from "../packets/EntityVelocity";
import { IEntity } from "./IEntity"; import { IEntity } from "./IEntity";
export class Entity implements IEntity { export class Entity implements IEntity {
@ -168,6 +169,10 @@ export class Entity implements IEntity {
this.sendToNearby(new PacketEntityLook(this.entityId, this.absRotation.yaw, this.absRotation.pitch).writeData()); this.sendToNearby(new PacketEntityLook(this.entityId, this.absRotation.yaw, this.absRotation.pitch).writeData());
} }
if (!this.motion.isZero) {
this.sendToNearby(new PacketEntityVelocity(this.entityId, this.motion.x, this.motion.y, this.motion.z).writeData());
}
if (doRelativeMove) { if (doRelativeMove) {
this.lastAbsPosition.set(this.absPosition); this.lastAbsPosition.set(this.absPosition);
} }