Example usage for io.netty.buffer ByteBuf writeInt

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

Introduction

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

Prototype

public abstract ByteBuf writeInt(int value);

Source Link

Document

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

Usage

From source file:buildcraftAdditions.utils.PlayerUtils.java

License:GNU General Public License

public static void writeToByteBuff(ByteBuf buf, UUID uuid) {
    String s = getUUIDString(uuid);
    buf.writeInt(s.length());
    for (int i = 0; i < s.length(); i++)
        buf.writeChar(s.charAt(i));//from   w  w  w  .  j a va  2 s. c o  m
}

From source file:buildcraftAdditions.utils.Tank.java

License:GNU General Public License

@Override
public ByteBuf writeToByteBuff(ByteBuf buf) {
    buf.writeInt(fluid != null ? fluid.fluidID : -1);
    buf.writeInt(getFluidAmount());/*from ww w .ja  v a 2  s  .c  om*/
    ByteBufUtils.writeTag(buf, fluid != null ? fluid.tag : null);
    return buf;
}

From source file:cn.academy.ability.teleport.data.ClientModifyMsg.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeByte(opcode);// w  w w . j  av a2s. c  o m
    if (opcode == ADD) {
        ((Location) arg).toBuf(buf);
    } else if (opcode == REMOVE) {
        buf.writeInt((Integer) arg);
    }
}

From source file:cn.academy.api.data.MsgResetAbilityData.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(entityID);
    ByteBufUtils.writeTag(buf, data);

}

From source file:cn.academy.api.data.MsgSimpleChange.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(entityID);
    buf.writeFloat(cp);//w ww . ja v a 2  s.  c  o  m
    buf.writeFloat(maxCP);

    buf.writeInt(skillCount);
    for (int i = 0; i < skillCount; ++i) {
        buf.writeFloat(skillExp[i]);
    }
}

From source file:cn.academy.core.block.dev.MsgActionStart.java

License:Open Source License

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

From source file:cn.academy.core.block.dev.MsgDeveloper.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(x).writeShort(y).writeInt(z).writeInt(energy);
    buf.writeBoolean(isStimulating).writeByte(stimSuccess).writeByte(stimFailure);
    buf.writeByte(nMagIncr);//w  w  w . j  a  v  a  2  s . c o m
    buf.writeInt(userID);
}

From source file:cn.academy.core.block.dev.MsgDismount.java

License:Open Source License

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

From source file:cn.academy.core.ctrl.ControlMessage.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(skillId);
    buf.writeInt(eventType.ordinal());
    buf.writeInt(time);
}

From source file:cn.academy.core.ctrl.DimensionSkillStateMessage.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(dimension);
    buf.writeInt(states.size());/*from w ww.  j a va 2 s .c  om*/

    for (SkillStateMessage msg : states) {
        msg.toBytes(buf);
    }
}