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:appeng.parts.reporting.PartStorageMonitor.java

License:Open Source License

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

    data.writeByte(this.spin);
    data.writeBoolean(this.isLocked);
    data.writeBoolean(this.configuredItem != null);
    if (this.configuredItem != null) {
        this.configuredItem.writeToPacket(data);
    }/*www  . j  a va  2s . c  om*/
}

From source file:appeng.tile.crafting.TileCraftingMonitorTile.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileCraftingMonitorTile(final ByteBuf data) throws IOException {
    data.writeByte(this.paintedColor.ordinal());

    if (this.dspPlay == null) {
        data.writeBoolean(false);
    } else {/*from   w w  w .  j  ava 2s .c  o m*/
        data.writeBoolean(true);
        this.dspPlay.writeToPacket(data);
    }
}

From source file:appeng.tile.crafting.TileMolecularAssembler.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileMolecularAssembler(final ByteBuf data) {
    data.writeBoolean(this.isPowered);
}

From source file:appeng.tile.misc.TileInterface.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileInterface(final ByteBuf data) {
    data.writeBoolean(omniDirectional);
}

From source file:appeng.tile.misc.TileQuartzGrowthAccelerator.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileQuartzGrowthAccelerator(final ByteBuf data) {
    try {/*from   w w w  .  j  ava  2  s  .co m*/
        data.writeBoolean(this.getProxy().getEnergy().isNetworkPowered());
    } catch (final GridAccessException e) {
        data.writeBoolean(false);
    }
}

From source file:appeng.tile.misc.TileSecurity.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileSecurity(final ByteBuf data) {
    data.writeBoolean(this.getProxy().isActive());
    data.writeByte(this.paintedColor.ordinal());
}

From source file:appeng.tile.misc.TileVibrationChamber.java

License:Open Source License

@Reflected
@TileEvent(TileEventType.NETWORK_WRITE)//from  w w w .ja  v a2s.  c  o  m
public void writeToNetwork(final ByteBuf data) {
    data.writeBoolean(this.getBurnTime() > 0);
}

From source file:appeng.tile.storage.TileSkyChest.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileSkyChest(final ByteBuf data) {
    data.writeBoolean(this.getPlayerOpen() > 0);
}

From source file:at.yawk.accordion.codec.unsafe.NullableCodec.java

License:Mozilla Public License

@Override
public void encode(ByteBuf target, T message) {
    target.writeBoolean(message != null);
    if (message != null) {
        delegate.encode(target, message);
    }//from  w  w  w .  j a va  2 s  .c o m
}

From source file:at.yawk.accordion.codec.unsafe.OptionalCodec.java

License:Mozilla Public License

@Override
@SuppressWarnings("unchecked")
protected ByteCodec<Optional> createCodec(CodecSupplier registry, FieldWrapper field) {
    FieldWrapper componentType = field.genericType(0).get();
    ByteCodec componentCodec = registry.getCodecOrThrow(componentType).toByteCodec();
    return new ByteCodec<Optional>() {
        @Override//from  ww w. j ava 2  s .  co  m
        public void encode(ByteBuf target, Optional message) {
            boolean present = message.isPresent();
            target.writeBoolean(present);
            if (present) {
                componentCodec.encode(target, message.get());
            }
        }

        @Override
        public Optional decode(ByteBuf encoded) {
            boolean present = encoded.readBoolean();
            if (present) {
                Object v = componentCodec.decode(encoded);
                return Optional.of(v);
            } else {
                return Optional.empty();
            }
        }
    };
}