Java源码示例:com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket

示例1
@Override
public void translate(ServerEntityVelocityPacket packet, GeyserSession session) {
    Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
    if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
        entity = session.getPlayerEntity();
    }
    if (entity == null) return;

    entity.setMotion(Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()));

    SetEntityMotionPacket entityMotionPacket = new SetEntityMotionPacket();
    entityMotionPacket.setRuntimeEntityId(entity.getGeyserId());
    entityMotionPacket.setMotion(entity.getMotion());

    session.sendUpstreamPacket(entityMotionPacket);
}
 
示例2
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例3
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例4
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例5
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例6
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例7
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例8
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例9
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例10
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例11
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例12
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例13
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
示例14
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
示例15
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}