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:buildcraft.robots.EntityRobot.java

License:Minecraft Mod Public

@Override
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
    if (side.isClient()) {
        if ("clientSetItemInUse".equals(command)) {
            itemInUse = Utils.readStack(stream);
        } else if ("clientSetInventory".equals(command)) {
            int slot = stream.readUnsignedShort();
            inv[slot] = Utils.readStack(stream);
        } else if ("initialize".equals(command)) {
            itemInUse = Utils.readStack(stream);
            itemActive = stream.readBoolean();
        } else if ("setItemActive".equals(command)) {
            itemActive = stream.readBoolean();
            itemActiveStage = 0;/*from ww w  .j  a  va2 s. c  om*/
            lastUpdateTime = new Date().getTime();

            if (!itemActive) {
                setSteamDirection(0, -1, 0);
            }
        } else if ("setSteamDirection".equals(command)) {
            setSteamDirection(stream.readInt(), stream.readShort(), stream.readInt());
        }
    } else if (side.isServer()) {
        EntityPlayer p = (EntityPlayer) sender;
        if ("requestInitialization".equals(command)) {
            BuildCraftCore.instance.sendToPlayer(p, new PacketCommand(this, "initialize", new CommandWriter() {
                public void write(ByteBuf data) {
                    Utils.writeStack(data, itemInUse);
                    data.writeBoolean(itemActive);
                }
            }));

            for (int i = 0; i < inv.length; ++i) {
                final int j = i;
                BuildCraftCore.instance.sendToPlayer(p,
                        new PacketCommand(this, "clientSetInventory", new CommandWriter() {
                            public void write(ByteBuf data) {
                                data.writeShort(j);
                                Utils.writeStack(data, inv[j]);
                            }
                        }));
            }

            if (currentDockingStation != null) {
                setSteamDirection(currentDockingStation.side.offsetX, currentDockingStation.side.offsetY,
                        currentDockingStation.side.offsetZ);
            } else {
                setSteamDirection(0, -1, 0);
            }
        }
    }
}

From source file:buildcraft.robots.EntityRobot.java

License:Minecraft Mod Public

@Override
public void setItemActive(final boolean isActive) {
    if (isActive != itemActive) {
        itemActive = isActive;/*from ww  w. j  ava 2 s.  c o m*/
        BuildCraftCore.instance.sendToWorld(new PacketCommand(this, "setItemActive", new CommandWriter() {
            public void write(ByteBuf data) {
                data.writeBoolean(isActive);
            }
        }), worldObj);
    }
}

From source file:buildcraft.silicon.TileAssemblyTable.java

License:Minecraft Mod Public

public void rpcSelectRecipe(final String id, final boolean select) {
    BuildCraftCore.instance.sendToServer(new PacketCommand(this, "select", new CommandWriter() {
        public void write(ByteBuf data) {
            Utils.writeUTF(data, id);// w  ww  .  j  ava2 s.com
            data.writeBoolean(select);
        }
    }));
}

From source file:buildcraft.transport.network.PacketPipeTransportTraveler.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf data) {
    data.writeFloat((float) item.xCoord);
    data.writeFloat((float) item.yCoord);
    data.writeFloat((float) item.zCoord);

    data.writeShort(item.id);//from w ww  . j  av  a2  s .c o  m

    data.writeByte((byte) item.input.ordinal());
    data.writeByte((byte) item.output.ordinal());

    data.writeByte(item.color != null ? item.color.ordinal() : -1);

    data.writeFloat(item.getSpeed());

    data.writeBoolean(forceStackRefresh);
}

From source file:buildcraft.transport.network.PacketPowerUpdate.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf data) {
    super.writeData(data);
    data.writeBoolean(overload);
    for (short element : displayPower) {
        data.writeByte(element);//from   w ww  .  j ava 2  s.  c  o  m
    }
}

From source file:buildcraft.transport.PipeRenderState.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf data) {
    data.writeBoolean(isGateLit);
    data.writeBoolean(isGatePulsing);// www .j av a 2 s .  c  o  m
    data.writeInt(gateIconIndex);
    pipeConnectionMatrix.writeData(data);
    textureMatrix.writeData(data);
    wireMatrix.writeData(data);
    facadeMatrix.writeData(data);
    plugMatrix.writeData(data);
    robotStationMatrix.writeData(data);
}

From source file:buildcraft.transport.utils.GateMatrix.java

License:Minecraft Mod Public

public void writeData(ByteBuf data) {
    for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
        data.writeBoolean(isGateLit[i]);
        data.writeBoolean(isGatePulsing[i]);
        data.writeBoolean(isGateExists[i]);
        data.writeInt(gateIconIndex[i]);
    }// w  ww. ja  va  2  s.  co m
}

From source file:buildcraftAdditions.networking.MessageCoilStatus.java

License:GNU General Public License

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

From source file:buildcraftAdditions.networking.MessageFlightSync.java

License:GNU General Public License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(wantsToFly);
    buf.writeBoolean(wantsToMove);
}

From source file:buildcraftAdditions.networking.MessageFluidicCompressorA.java

License:GNU General Public License

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