Example usage for io.netty.buffer ByteBuf readFloat

List of usage examples for io.netty.buffer ByteBuf readFloat

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf readFloat.

Prototype

public abstract float readFloat();

Source Link

Document

Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer.

Usage

From source file:com.Da_Technomancer.crossroads.API.packets.Message.java

License:Creative Commons License

private static float readFloat(ByteBuf buf) {
    return buf.readFloat();
}

From source file:com.flowpowered.engine.network.codec.InputSnapshotCodec.java

License:MIT License

@Override
public InputSnapshotMessage decode(ByteBuf buf) throws IOException {
    List<KeyboardEvent> keyEvents = new LinkedList<>();
    int amount = buf.readInt();
    for (int i = 0; i < amount; i++) {
        keyEvents.add(new KeyboardEvent(buf.readByte(), buf.readBoolean()));
    }//from  ww w.j a  v  a  2 s .c o  m
    amount = buf.readInt();
    List<MouseEvent> mouseEvents = new LinkedList<>();
    for (int i = 0; i < amount; i++) {
        mouseEvents.add(new MouseEvent(buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt(),
                buf.readInt(), buf.readInt(), buf.readBoolean()));
    }

    return new InputSnapshotMessage(buf.readFloat(), buf.readBoolean(), keyEvents, mouseEvents);
}

From source file:com.flowpowered.engine.util.FlowByteBufUtils.java

License:MIT License

public static Vector3f readVector3(ByteBuf buffer) {
    final float x = buffer.readFloat();
    final float y = buffer.readFloat();
    final float z = buffer.readFloat();
    return new Vector3f(x, y, z);
}

From source file:com.flowpowered.engine.util.FlowByteBufUtils.java

License:MIT License

public static Point readPoint(ByteBuf buffer) {
    WorldReference world;// ww  w  .ja  v a 2  s .  c  om
    try {
        world = new WorldReference(ByteBufUtils.readUTF8(buffer));
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    final float x = buffer.readFloat();
    final float y = buffer.readFloat();
    final float z = buffer.readFloat();
    return new Point(world, x, y, z);
}

From source file:com.flowpowered.engine.util.FlowByteBufUtils.java

License:MIT License

public static Quaternionf readQuaternion(ByteBuf buffer) {
    final float x = buffer.readFloat();
    final float y = buffer.readFloat();
    final float z = buffer.readFloat();
    final float w = buffer.readFloat();
    return new Quaternionf(x, y, z, w);
}

From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java

License:Apache License

/**
 * {@inheritDoc}//from w  w w  .  ja va 2s. com
 * @see com.heliosapm.ohcrs.core.DriverCodec#readFloat(io.netty.buffer.ByteBuf)
 */
@Override
public Float readFloat(final ByteBuf b) throws SQLException {
    if (checkNull(b))
        return null;
    return b.readFloat();
}

From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java

License:Apache License

/**
 * {@inheritDoc}/*from  w w  w  .j  a v  a  2s  . c  o  m*/
 * @see com.heliosapm.ohcrs.core.DriverCodec#readfloat(io.netty.buffer.ByteBuf)
 */
@Override
public float readfloat(final ByteBuf b) throws SQLException {
    if (checkNull(b))
        return 0F;
    return b.readFloat();
}

From source file:com.specialeffect.messages.MovePlayerMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    moveAmount = buf.readFloat();
    moveAngle = buf.readFloat();
}

From source file:com.teambr.modularsystems.storage.network.ScrollStorageCore.java

License:Creative Commons License

@Override
public void fromBytes(ByteBuf buf) {
    scrollValue = buf.readFloat();
}

From source file:com.theoriginalbit.moarperipherals.common.network.message.MessageGeneric.java

License:Apache License

@Override
public void fromBytes(ByteBuf buf) {
    int nStr = buf.readInt();
    stringData = new String[nStr];
    if (nStr > 0) {
        for (int i = 0; i < nStr; ++i) {
            stringData[i] = ByteBufUtils.readUTF8String(buf);
        }/*w w w .  j  a va  2  s  . c o m*/
    }

    int nInt = buf.readInt();
    intData = new int[nInt];
    if (nInt > 0) {
        for (int i = 0; i < nInt; ++i) {
            intData[i] = buf.readInt();
        }
    }

    int nByte = buf.readInt();
    byteData = new byte[nByte];
    if (nByte > 0) {
        buf.readBytes(byteData);
    }

    int nChar = buf.readInt();
    charData = new char[nChar];
    if (nChar > 0) {
        for (int i = 0; i < nChar; ++i) {
            charData[i] = buf.readChar();
        }
    }

    int nFloat = buf.readInt();
    floatData = new float[nFloat];
    if (nFloat > 0) {
        for (int i = 0; i < nFloat; ++i) {
            floatData[i] = buf.readFloat();
        }
    }

    int nDouble = buf.readInt();
    doubleData = new double[nDouble];
    if (nDouble > 0) {
        for (int i = 0; i < nDouble; ++i) {
            doubleData[i] = buf.readDouble();
        }
    }

    boolean wasNBT = buf.readBoolean();
    if (wasNBT) {
        nbtData = ByteBufUtils.readTag(buf);
    }
}