Example usage for io.netty.buffer ByteBuf writeFloat

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

Introduction

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

Prototype

public abstract ByteBuf writeFloat(float value);

Source Link

Document

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

Usage

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

License:Open Source License

/**
 * @param buf - buffer to write to//from w  ww  . jav  a  2 s .  c o 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:growthcraft.milk.common.tileentity.TileEntityCheeseVat.java

License:Open Source License

@EventHandler(type = EventHandler.EventType.NETWORK_WRITE)
public boolean writeToStream_CheeseVat(ByteBuf stream) throws IOException {
    stream.writeInt(progressMax);//from   w  ww  .j  a v a2s.  c  o m
    stream.writeFloat(progress);
    heatComponent.writeToStream(stream);
    try {
        StreamUtils.writeStringASCII(stream, vatState.name);
    } catch (UnsupportedEncodingException ex) {
        ex.printStackTrace();
    }
    return false;
}

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

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.in);
    ByteBufUtils.writeItemStack(buf, this.out);
    buf.writeBoolean(this.consumeAll);
    buf.writeFloat(this.consumeChance);
    buf.writeInt(this.craftingTickTime);
}

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

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.inStack);
    ByteBufUtils.writeString(buf, this.fluidOut.getName());
    buf.writeFloat(this.productionMultiplier);
    buf.writeFloat(this.shatterMultiplier);
    buf.writeInt(this.colorHex);
}

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

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    from.toBytes(buf);//from  ww  w  .  j  a va2 s  .c o  m
    to.toBytes(buf);
    buf.writeBoolean(colorOverlay != null);
    if (colorOverlay != null) {
        for (float color : colorOverlay.getComponents(new float[4])) {
            buf.writeFloat(color);
        }
    }
}

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

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeFloat(this.charge);
}

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

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeFloat(this.stepHeight);
}

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

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(apply);
    buf.writeFloat(modifier);
}

From source file:hivemall.mix.MixMessageEncoder.java

License:Open Source License

@Override
protected void encode(ChannelHandlerContext ctx, MixMessage msg, ByteBuf out) throws Exception {
    int startIdx = out.writerIndex();
    out.writeBytes(LENGTH_PLACEHOLDER);/* w  ww.j  a v  a2s  .co  m*/

    MixEventName event = msg.getEvent();
    byte b = event.getID();
    out.writeByte(b);

    Object feature = msg.getFeature();
    encodeObject(feature, out);

    float weight = msg.getWeight();
    out.writeFloat(weight);

    float covariance = msg.getCovariance();
    out.writeFloat(covariance);

    short clock = msg.getClock();
    out.writeShort(clock);

    int deltaUpdates = msg.getDeltaUpdates();
    out.writeInt(deltaUpdates);

    boolean cancelRequest = msg.isCancelRequest();
    out.writeBoolean(cancelRequest);

    String groupId = msg.getGroupID();
    writeString(groupId, out);

    int endIdx = out.writerIndex();
    out.setInt(startIdx, endIdx - startIdx - 4);
}

From source file:io.crate.protocols.postgres.types.RealType.java

License:Apache License

@Override
public int writeAsBinary(ByteBuf buffer, @Nonnull Object value) {
    buffer.writeInt(TYPE_LEN);/*from  w w w  . j a v  a  2s  . com*/
    buffer.writeFloat(((float) value));
    return INT32_BYTE_SIZE + TYPE_LEN;
}