com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket Java Examples

The following examples show how to use com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaEntityVelocityTranslator.java    From Geyser with MIT License 6 votes vote down vote up
@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);
}
 
Example #2
Source File: SetEntityMotionSerializer_v354.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #3
Source File: SetEntityMotionSerializer_v354.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #4
Source File: SetEntityMotionSerializer_v388.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #5
Source File: SetEntityMotionSerializer_v388.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #6
Source File: SetEntityMotionSerializer_v340.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #7
Source File: SetEntityMotionSerializer_v340.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #8
Source File: SetEntityMotionSerializer_v313.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #9
Source File: SetEntityMotionSerializer_v313.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #10
Source File: SetEntityMotionSerializer_v361.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #11
Source File: SetEntityMotionSerializer_v361.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #12
Source File: SetEntityMotionSerializer_v332.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #13
Source File: SetEntityMotionSerializer_v332.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}
 
Example #14
Source File: SetEntityMotionSerializer_v291.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId());
    BedrockUtils.writeVector3f(buffer, packet.getMotion());
}
 
Example #15
Source File: SetEntityMotionSerializer_v291.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, SetEntityMotionPacket packet) {
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setMotion(BedrockUtils.readVector3f(buffer));
}