Example usage for io.netty.buffer ByteBuf writeBoolean

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

Introduction

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

Prototype

public abstract ByteBuf writeBoolean(boolean value);

Source Link

Document

Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.

Usage

From source file:alluxio.network.protocol.RPCUnderFileSystemBlockReadRequest.java

License:Apache License

@Override
public void encode(ByteBuf out) {
    out.writeLong(mBlockId);/*from   ww w .ja  v  a2  s .  c  o  m*/
    out.writeLong(mOffset);
    out.writeLong(mLength);
    out.writeLong(mSessionId);
    out.writeBoolean(mNoCache);
}

From source file:appeng.core.sync.packets.PacketCompassResponse.java

License:Open Source License

public PacketCompassResponse(final PacketCompassRequest req, final boolean hasResult, final boolean spin,
        final double radians) {

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeLong(this.attunement = req.attunement);
    data.writeInt(this.cx = req.cx);
    data.writeInt(this.cz = req.cz);
    data.writeInt(this.cdy = req.cdy);

    data.writeBoolean(hasResult);
    data.writeBoolean(spin);/*from ww  w .jav  a2 s.c o m*/
    data.writeDouble(radians);

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketConfigButton.java

License:Open Source License

public PacketConfigButton(final Settings option, final boolean rotationDirection) {
    this.option = option;
    this.rotationDirection = rotationDirection;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeInt(option.ordinal());//from w  ww .ja va 2 s.  com
    data.writeBoolean(rotationDirection);

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketCraftRequest.java

License:Open Source License

public PacketCraftRequest(final int craftAmt, final boolean shift) {
    this.amount = craftAmt;
    this.heldShift = shift;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeBoolean(shift);
    data.writeLong(this.amount);

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketInventoryAction.java

License:Open Source License

public PacketInventoryAction(final InventoryAction action, final int slot, final IAEItemStack slotItem)
        throws IOException {

    if (Platform.isClient()) {
        throw new IllegalStateException("invalid packet, client cannot post inv actions with stacks.");
    }/*from w  w  w. j  ava 2 s  .c  om*/

    this.action = action;
    this.slot = slot;
    this.id = 0;
    this.slotItem = slotItem;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeInt(action.ordinal());
    data.writeInt(slot);
    data.writeLong(this.id);

    if (slotItem == null) {
        data.writeBoolean(false);
    } else {
        data.writeBoolean(true);
        slotItem.writeToPacket(data);
    }

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketInventoryAction.java

License:Open Source License

public PacketInventoryAction(final InventoryAction action, final int slot, final long id) {
    this.action = action;
    this.slot = slot;
    this.id = id;
    this.slotItem = null;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeInt(action.ordinal());//from w ww . j a  va  2s .  c  o  m
    data.writeInt(slot);
    data.writeLong(id);
    data.writeBoolean(false);

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketPatternSlot.java

License:Open Source License

public PacketPatternSlot(final IInventory pat, final IAEItemStack slotItem, final boolean shift)
        throws IOException {

    this.slotItem = slotItem;
    this.shift = shift;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());

    data.writeBoolean(shift);

    this.writeItem(slotItem, data);
    for (int x = 0; x < 9; x++) {
        this.pattern[x] = AEApi.instance().storage().createItemStack(pat.getStackInSlot(x));
        this.writeItem(this.pattern[x], data);
    }//from w  w w  .j av  a  2  s  . com

    this.configureWrite(data);
}

From source file:appeng.core.sync.packets.PacketPatternSlot.java

License:Open Source License

private void writeItem(final IAEItemStack slotItem, final ByteBuf data) throws IOException {
    if (slotItem == null) {
        data.writeBoolean(false);
    } else {/*w w  w . j  av  a 2s.  c  o  m*/
        data.writeBoolean(true);
        slotItem.writeToPacket(data);
    }
}

From source file:appeng.core.sync.packets.PacketTransitionEffect.java

License:Open Source License

public PacketTransitionEffect(final double x, final double y, final double z, final AEPartLocation dir,
        final boolean wasBlock) {
    this.x = x;//from ww  w.jav a2 s  . co m
    this.y = y;
    this.z = z;
    this.d = dir;
    this.mode = wasBlock;

    final ByteBuf data = Unpooled.buffer();

    data.writeInt(this.getPacketID());
    data.writeFloat((float) x);
    data.writeFloat((float) y);
    data.writeFloat((float) z);
    data.writeByte(this.d.ordinal());
    data.writeBoolean(wasBlock);

    this.configureWrite(data);
}

From source file:appeng.parts.reporting.AbstractPartMonitor.java

License:Open Source License

@Override
public void writeToStream(final ByteBuf data) throws IOException {
    super.writeToStream(data);

    data.writeBoolean(this.isLocked);
    data.writeBoolean(this.configuredItem != null);
    if (this.configuredItem != null) {
        this.configuredItem.writeToPacket(data);
    }/* w ww.ja v  a  2s  .  co m*/
}