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:de.ellpeck.actuallyadditions.mod.network.PacketParticle.java

@Override
public void toBytes(ByteBuf buf) {
    buf.writeDouble(this.startX);
    buf.writeDouble(this.startY);
    buf.writeDouble(this.startZ);
    buf.writeDouble(this.endX);
    buf.writeDouble(this.endY);
    buf.writeDouble(this.endZ);
    buf.writeInt(this.particleAmount);
    buf.writeFloat(this.particleSize);

    for (float aColor : this.color) {
        buf.writeFloat(aColor);// w  w w.j av  a2 s  .com
    }
}

From source file:de.sanandrew.mods.betterboat.network.PacketSendBoatPos.java

License:Creative Commons License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.boatId);
    buf.writeDouble(this.posX);
    buf.writeDouble(this.posY);
    buf.writeDouble(this.posZ);
    buf.writeFloat(this.rotationYaw);
    buf.writeFloat(this.rotationPitch);
}

From source file:gedi.remote.codec.NumberEncoder.java

License:Apache License

@Override
protected void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out) throws Exception {
    if (msg instanceof Byte) {
        out.writeInt(Integer.BYTES + 1 + Byte.BYTES);
        out.writeInt(1);/* ww w .  j a va  2 s . c o m*/
        out.writeByte('B');
        out.writeByte(msg.byteValue());
    } else if (msg instanceof Short) {
        out.writeInt(Integer.BYTES + 1 + Short.BYTES);
        out.writeInt(1);
        out.writeByte('S');
        out.writeShort(msg.shortValue());
    } else if (msg instanceof Integer) {
        out.writeInt(Integer.BYTES + 1 + Integer.BYTES);
        out.writeInt(1);
        out.writeByte('I');
        out.writeInt(msg.intValue());
    } else if (msg instanceof Long) {
        out.writeInt(Integer.BYTES + 1 + Long.BYTES);
        out.writeInt(1);
        out.writeByte('L');
        out.writeLong(msg.longValue());
    } else if (msg instanceof Float) {
        out.writeInt(Integer.BYTES + 1 + Float.BYTES);
        out.writeInt(1);
        out.writeByte('F');
        out.writeFloat(msg.floatValue());
    } else if (msg instanceof Double) {
        out.writeInt(Integer.BYTES + 1 + Double.BYTES);
        out.writeInt(1);
        out.writeByte('D');
        out.writeDouble(msg.doubleValue());
    } else
        throw new RuntimeException("Could not encode number " + msg.getClass().getName());

}

From source file:growthcraft.cellar.common.tileentity.device.BrewKettle.java

License:Open Source License

/**
 * @param buf - buffer to write to//w w w  .  j a va 2s. co  m
 */
@Override
public boolean writeToStream(ByteBuf buf) {
    super.writeToStream(buf);
    buf.writeDouble(time);
    buf.writeDouble(timeMax);
    buf.writeFloat(grain);
    heatComponent.writeToStream(buf);
    return false;
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.LightTransmutationAdd.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.in);
    ByteBufUtils.writeItemStack(buf, this.out);
    buf.writeDouble(this.cost);
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.OreTypeAdd.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeString(buf, this.oreTypeToAdd);
    buf.writeDouble(this.weight);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktDualParticleEvent.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(typeOrdinal);/*from   ww w.  j  a  v  a2  s.c  o m*/
    buf.writeDouble(originX);
    buf.writeDouble(originY);
    buf.writeDouble(originZ);
    buf.writeDouble(targetX);
    buf.writeDouble(targetY);
    buf.writeDouble(targetZ);
    buf.writeDouble(additionalData);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktParticleDataEvent.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.data.length);
    for (double d : this.data) {
        buf.writeDouble(d);
    }/* ww  w .j ava 2  s.c om*/
    buf.writeDouble(this.xCoord);
    buf.writeDouble(this.yCoord);
    buf.writeDouble(this.zCoord);
    buf.writeDouble(this.effectType.ordinal());
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktParticleEvent.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.typeOrdinal);
    buf.writeDouble(this.xCoord);
    buf.writeDouble(this.yCoord);
    buf.writeDouble(this.zCoord);
    buf.writeDouble(this.additionalData);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktShootEntity.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.entityId);
    buf.writeDouble(this.motionVector.getX());
    buf.writeDouble(this.motionVector.getY());
    buf.writeDouble(this.motionVector.getZ());
    buf.writeBoolean(this.hasEffect);
    if (hasEffect) {
        buf.writeDouble(this.effectLength);
    }/*from  w  ww. j a  v a2 s  . c  o m*/
}