use of org.dragonet.protocol.packets.SetEntityMotionPacket in project DragonProxy by DragonetMC.
the class PCEntityVelocityPacketTranslator method translate.
public PEPacket[] translate(UpstreamSession session, ServerEntityVelocityPacket packet) {
CachedEntity entity = session.getEntityCache().getByRemoteEID(packet.getEntityId());
if (entity == null) {
if (packet.getEntityId() == (int) session.getDataCache().get(CacheKey.PLAYER_EID)) {
entity = session.getEntityCache().getClientEntity();
} else {
return null;
}
}
entity.motionX = packet.getMotionX();
entity.motionY = packet.getMotionY();
entity.motionZ = packet.getMotionZ();
SetEntityMotionPacket pk = new SetEntityMotionPacket();
pk.rtid = entity.proxyEid;
pk.motion = new Vector3F((float) packet.getMotionX(), (float) packet.getMotionY(), (float) packet.getMotionZ());
return new PEPacket[] { pk };
}
Aggregations