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:net.tridentsdk.server.packets.play.out.PacketPlayOutParticle.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    buf.writeInt(this.particleId);
    buf.writeBoolean(this.distance);

    buf.writeFloat((float) this.loc.x());
    buf.writeFloat((float) this.loc.y());
    buf.writeFloat((float) this.loc.z());

    buf.writeFloat((float) this.offset.x());
    buf.writeFloat((float) this.offset.y());
    buf.writeFloat((float) this.offset.z());

    buf.writeFloat(this.particleData);
    buf.writeInt(this.data.length);

    for (int i : this.data) {
        Codec.writeVarInt32(buf, i);
    }//from ww w .  j  a v  a  2  s .  c om
}

From source file:nightkosh.gravestone_extended.packets.ChiselMessageToServer.java

License:LGPL

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(playerID);/*  w w w .j  a  v a  2  s  .  c o m*/
    buf.writeInt(dimensionID);
    buf.writeBoolean(isGravestone);
    buf.writeInt(graveType);
    buf.writeInt(material);
    buf.writeBoolean(isEnchanted);
    buf.writeBoolean(isMossy);
}

From source file:nightkosh.gravestone_extended.packets.ChokeMessageToClient.java

License:LGPL

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(air);
    buf.writeBoolean(isActive);
}

From source file:nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.chunks.Chunk1_10Type.java

License:Open Source License

@Override
public void write(ByteBuf output, ClientWorld world, Chunk input) throws Exception {
    if (!(input instanceof Chunk1_10))
        throw new IllegalClassException(
                "Tried to send the wrong chunk type from 1.9.3-4 chunk: " + input.getClass());
    Chunk1_10 chunk = (Chunk1_10) input;

    output.writeInt(chunk.getX());//from w  ww  . j a v  a  2s  . c om
    output.writeInt(chunk.getZ());

    output.writeBoolean(chunk.isGroundUp());
    Type.VAR_INT.write(output, chunk.getBitmask());

    ByteBuf buf = Unpooled.buffer();
    for (int i = 0; i < 16; i++) {
        ChunkSection section = chunk.getSections()[i];
        if (section == null)
            continue; // Section not set
        section.writeBlocks(buf);
        section.writeBlockLight(buf);

        if (!section.hasSkyLight())
            continue; // No sky light, we're done here.
        section.writeSkyLight(buf);

    }
    buf.readerIndex(0);
    Type.VAR_INT.write(output, buf.readableBytes() + (chunk.isBiomeData() ? 256 : 0));
    output.writeBytes(buf);
    buf.release(); // release buffer

    // Write biome data
    if (chunk.isBiomeData()) {
        output.writeBytes(chunk.getBiomeData());
    }

    Type.NBT_ARRAY.write(output, chunk.getBlockEntities().toArray(new CompoundTag[0]));
}

From source file:org.apache.activemq.artemis.core.message.impl.CoreMessage.java

License:Apache License

public void encodeHeadersAndProperties(final ByteBuf buffer) {
    checkProperties();//from   ww  w  . ja  va  2  s .  com
    messageIDPosition = buffer.writerIndex();
    buffer.writeLong(messageID);
    SimpleString.writeNullableSimpleString(buffer, address);
    if (userID == null) {
        buffer.writeByte(DataConstants.NULL);
    } else {
        buffer.writeByte(DataConstants.NOT_NULL);
        buffer.writeBytes(userID.asBytes());
    }
    buffer.writeByte(type);
    buffer.writeBoolean(durable);
    buffer.writeLong(expiration);
    buffer.writeLong(timestamp);
    buffer.writeByte(priority);
    properties.encode(buffer);
}

From source file:org.blockartistry.DynSurround.network.PacketDisplayFootprint.java

License:MIT License

@Override
public void toBytes(@Nonnull final ByteBuf buf) {
    this.locus.toBytes(buf);
    buf.writeFloat(this.rotation);
    buf.writeBoolean(this.isRightFoot);
}

From source file:org.blockartistry.DynSurround.network.PacketEnvironment.java

License:MIT License

@Override
public void toBytes(@Nonnull final ByteBuf buf) {
    buf.writeBoolean(this.inVillage);
}

From source file:org.blockartistry.DynSurround.network.PacketHealthChange.java

License:MIT License

@Override
public void toBytes(@Nonnull final ByteBuf buf) {
    buf.writeInt(this.entityId);
    buf.writeFloat(this.posX);
    buf.writeFloat(this.posY);
    buf.writeFloat(this.posZ);
    buf.writeBoolean(this.isCritical);
    buf.writeInt(this.amount);
}

From source file:org.blockartistry.DynSurround.network.PacketSpeechBubble.java

License:MIT License

@Override
public void toBytes(@Nonnull final ByteBuf buf) {
    buf.writeInt(this.entityId);
    ByteBufUtils.writeUTF8String(buf, this.message);
    buf.writeBoolean(this.translate);
}

From source file:org.blockartistry.DynSurround.network.PacketThunder.java

License:MIT License

@Override
public void toBytes(@Nonnull final ByteBuf buf) {
    buf.writeShort(this.dimension);
    buf.writeBoolean(this.doFlash);
    buf.writeInt(this.pos.getX());
    buf.writeInt(this.pos.getY());
    buf.writeInt(this.pos.getZ());
}