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:buildcraft.factory.TileQuarry.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf stream) {
    super.writeData(stream);
    box.writeData(stream);//www. j a  va 2 s . c  o  m
    stream.writeInt(targetX);
    stream.writeShort(targetY);
    stream.writeInt(targetZ);
    stream.writeDouble(headPosX);
    stream.writeDouble(headPosY);
    stream.writeDouble(headPosZ);
    stream.writeFloat((float) speed);
    stream.writeFloat((float) headTrajectory);
    int flags = stage.ordinal();
    flags |= movingHorizontally ? 0x10 : 0;
    flags |= movingVertically ? 0x20 : 0;
    stream.writeByte(flags);
}

From source file:cn.liutils.api.player.state.StateLockPosition.java

License:Open Source License

@Override
protected void writeBytes(ByteBuf buf) {
    buf.writeDouble(posX);
    buf.writeDouble(posY);
    buf.writeDouble(posZ);
}

From source file:com.bluepowermod.network.message.LocationDoublePacket.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {

    buf.writeDouble(x);
    buf.writeDouble(y);
    buf.writeDouble(z);
}

From source file:com.bluepowermod.part.tube.TubeStack.java

License:Open Source License

public void writeToPacket(ByteBuf buf) {

    ByteBufUtils.writeItemStack(buf, stack);
    buf.writeByte(heading.ordinal());//from   ww w.j  a v a2  s . c om
    buf.writeByte((byte) color.ordinal());
    buf.writeDouble(speed);
    buf.writeDouble(progress);
}

From source file:com.builtbroken.atomic.lib.transform.rotation.EulerAngle.java

/**
 * @param data/*ww w .  j a  va 2 s.co  m*/
 * @Deprecated {@link #writeBytes(ByteBuf)}
 */
@Deprecated
public void writeByteBuf(ByteBuf data) {
    data.writeDouble(yaw);
    data.writeDouble(pitch);
    data.writeDouble(roll);
}

From source file:com.builtbroken.atomic.lib.transform.rotation.EulerAngle.java

@Override
public ByteBuf writeBytes(ByteBuf data) {
    data.writeDouble(yaw);
    data.writeDouble(pitch);
    data.writeDouble(roll);
    return data;
}

From source file:com.builtbroken.atomic.network.packet.client.PacketSpawnParticle.java

@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
    buffer.writeInt(dim);//from   w w w.  j  a  v  a2s .  c om
    buffer.writeDouble(x);
    buffer.writeDouble(y);
    buffer.writeDouble(z);
    ByteBufUtils.writeUTF8String(buffer, particle);
}

From source file:com.builtbroken.atomic.network.packet.PacketBase.java

/**
 * Called to write data without manually defining the write
 *
 * @param object - object to write//w w w.ja v  a2 s  .  co  m
 * @param buffer - location to write to
 */
protected void writeData(Object object, ByteBuf buffer) {
    if (object.getClass().isArray()) {
        for (int i = 0; i < Array.getLength(object); i++) {
            writeData(Array.get(object, i), buffer);
        }
    } else if (object instanceof Collection) {
        for (Object o : (Collection) object) {
            writeData(o, buffer);
        }
    } else if (object instanceof Byte) {
        buffer.writeByte((Byte) object);
    } else if (object instanceof Integer) {
        buffer.writeInt((Integer) object);
    } else if (object instanceof Short) {
        buffer.writeShort((Short) object);
    } else if (object instanceof Long) {
        buffer.writeLong((Long) object);
    } else if (object instanceof Float) {
        buffer.writeFloat((Float) object);
    } else if (object instanceof Double) {
        buffer.writeDouble((Double) object);
    } else if (object instanceof Boolean) {
        buffer.writeBoolean((Boolean) object);
    } else if (object instanceof String) {
        ByteBufUtils.writeUTF8String(buffer, (String) object);
    } else if (object instanceof NBTTagCompound) {
        ByteBufUtils.writeTag(buffer, (NBTTagCompound) object);
    } else if (object instanceof ItemStack) {
        ByteBufUtils.writeItemStack(buffer, (ItemStack) object);
    } else if (object instanceof FluidTank) {
        ByteBufUtils.writeTag(buffer, ((FluidTank) object).writeToNBT(new NBTTagCompound()));
    } else if (object instanceof Pos) {
        ((Pos) object).writeByteBuf(buffer);
    } else if (object instanceof IByteBufWriter) {
        ((IByteBufWriter) object).writeBytes(buffer);
    } else if (object instanceof Enum) {
        buffer.writeInt(((Enum) object).ordinal());
    } else {
        throw new IllegalArgumentException("PacketBase: Unsupported write data type " + object);
    }
}

From source file:com.builtbroken.grappling.network.packets.PacketUpdateLocation.java

@Override
public void write(ByteBuf buffer) {
    buffer.writeDouble(x);
    buffer.writeDouble(y);
    buffer.writeDouble(z);
}

From source file:com.crowsofwar.avatar.common.network.packets.PacketCParticles.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(particle.id());//w w w.jav a  2s. com
    buf.writeInt(minimum);
    buf.writeInt(maximum);
    buf.writeDouble(x);
    buf.writeDouble(y);
    buf.writeDouble(z);
    buf.writeDouble(maxVelocityX);
    buf.writeDouble(maxVelocityY);
    buf.writeDouble(maxVelocityZ);
}