Example usage for io.netty.buffer ByteBuf writeDouble

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

Introduction

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

Prototype

public abstract ByteBuf writeDouble(double value);

Source Link

Document

Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer.

Usage

From source file:com.mrcrayfish.furniture.network.message.MessageFart.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeDouble(x);
    buf.writeDouble(y);
    buf.writeDouble(z);
}

From source file:com.noahkurrack.onenine.network.MessageSingleParticleEvent.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {

    buf.writeInt(particleName.length());
    buf.writeBytes(particleName.getBytes());
    buf.writeDouble(xCoord);
    buf.writeDouble(yCoord);/*from   w w w  . ja v a2  s. c  o m*/
    buf.writeDouble(zCoord);
    buf.writeDouble(xVelocity);
    buf.writeDouble(yVelocity);
    buf.writeDouble(zVelocity);

}

From source file:com.ogarproject.ogar.server.net.packet.outbound.PacketOutWorldBorder.java

License:Open Source License

@Override
public void writeData(ByteBuf buf) {
    buf.writeDouble(left);
    buf.writeDouble(top);
    buf.writeDouble(right);
    buf.writeDouble(bottom);
}

From source file:com.srotya.sidewinder.core.ingress.binary.SeriesDataPointEncoder.java

License:Apache License

public static void encodeDPointToBuf(ByteBuf buf, DataPoint dataPoint) {
    byte[] dbNameBytes = dataPoint.getDbName().getBytes();
    buf.writeInt(dbNameBytes.length);/*ww  w .j a v a  2s.c  o m*/
    buf.writeBytes(dbNameBytes);
    byte[] measurementNameBytes = dataPoint.getMeasurementName().getBytes();
    buf.writeInt(measurementNameBytes.length);
    buf.writeBytes(measurementNameBytes);
    byte[] valueNameBytes = dataPoint.getValueFieldName().getBytes();
    buf.writeInt(valueNameBytes.length);
    buf.writeBytes(valueNameBytes);

    buf.writeLong(dataPoint.getTimestamp());
    if (dataPoint.isFp()) {
        buf.writeByte('0');
        buf.writeDouble(dataPoint.getValue());
    } else {
        buf.writeByte('1');
        buf.writeLong(dataPoint.getLongValue());
    }
}

From source file:com.teambr.bookshelf.network.SyncableFieldPacket.java

License:Creative Commons License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(returnValue);//w  w  w .j  a  v  a 2s .  com
    buf.writeInt(id);
    buf.writeDouble(value);
    buf.writeLong(blockPosition.toLong());
}

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

License:Apache License

@Override
public void toBytes(ByteBuf buf) {
    // Write any string data
    if (stringData != null) {
        buf.writeInt(stringData.length);
        for (String str : stringData) {
            ByteBufUtils.writeUTF8String(buf, str);
        }/*  w  w  w  . j  a  v  a 2 s . c  o m*/
    } else {
        buf.writeInt(0);
    }

    // Write any integer data
    if (intData != null) {
        buf.writeInt(intData.length);
        for (int i : intData) {
            buf.writeInt(i);
        }
    } else {
        buf.writeInt(0);
    }

    // Write any byte data
    if (byteData != null) {
        buf.writeInt(byteData.length);
        buf.writeBytes(byteData);
    } else {
        buf.writeInt(0);
    }

    // Write any char data
    if (charData != null) {
        buf.writeInt(charData.length);
        for (char c : charData) {
            buf.writeChar(c);
        }
    } else {
        buf.writeInt(0);
    }

    // Write any float data
    if (floatData != null) {
        buf.writeInt(floatData.length);
        for (float f : floatData) {
            buf.writeFloat(f);
        }
    } else {
        buf.writeInt(0);
    }

    // Write any double data
    if (doubleData != null) {
        buf.writeInt(doubleData.length);
        for (double d : doubleData) {
            buf.writeDouble(d);
        }
    } else {
        buf.writeInt(0);
    }

    // Write any NBT data
    if (nbtData != null) {
        buf.writeBoolean(true);
        ByteBufUtils.writeTag(buf, nbtData);
    } else {
        buf.writeBoolean(false);
    }
}

From source file:com.yyon.grapplinghook.network.GrappleAttachMessage.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.id);
    buf.writeDouble(this.x);
    buf.writeDouble(this.y);
    buf.writeDouble(this.z);
    buf.writeInt(this.controlid);
    buf.writeInt(this.entityid);
    buf.writeInt(this.maxlen);
    buf.writeInt(this.blockpos.getX());
    buf.writeInt(this.blockpos.getY());
    buf.writeInt(this.blockpos.getZ());
}

From source file:com.yyon.grapplinghook.network.GrappleAttachPosMessage.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.id);
    buf.writeDouble(this.x);
    buf.writeDouble(this.y);
    buf.writeDouble(this.z);
}

From source file:com.yyon.grapplinghook.network.PlayerMovementMessage.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(entityId);//  w w w .  j a v a 2s . com
    buf.writeDouble(x);
    buf.writeDouble(y);
    buf.writeDouble(z);
    buf.writeDouble(mx);
    buf.writeDouble(my);
    buf.writeDouble(mz);

}

From source file:daxum.temporalconvergence.network.PacketDodgeSuccess.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeLong(mainPlayerUUID.getMostSignificantBits());
    buf.writeLong(mainPlayerUUID.getLeastSignificantBits());

    buf.writeDouble(ox);
    buf.writeDouble(oy);/*from   w  ww.j  a v a  2  s  .com*/
    buf.writeDouble(oz);
}