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.packets.play.out.PacketPlayOutJoinGame.java

License:Open Source License

@Override
public void encode(ByteBuf buf) {
    buf.writeInt(this.entityId);

    buf.writeByte((int) this.gamemode.toByte());
    buf.writeByte((int) this.dimension.toByte());
    buf.writeByte((int) this.difficulty.toByte());
    buf.writeByte((int) this.maxPlayers);

    Codec.writeString(buf, this.levelType.toString());
    buf.writeBoolean(true);
}

From source file:net.tridentsdk.packets.play.out.PacketPlayOutMapChunkBulk.java

License:Open Source License

@Override
public void encode(ByteBuf buf) {
    buf.writeBoolean(this.lightSent);

    Codec.writeVarInt32(buf, this.columnCount);
    this.meta.write(buf);

    buf.writeBytes(this.data);
}

From source file:net.tridentsdk.packets.play.out.PacketPlayOutParticle.java

License:Open Source License

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

    buf.writeFloat((float) this.loc.getX());
    buf.writeFloat((float) this.loc.getY());
    buf.writeFloat((float) this.loc.getZ());

    buf.writeFloat((float) this.offset.getX());
    buf.writeFloat((float) this.offset.getY());
    buf.writeFloat((float) this.offset.getZ());

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

    for (int i : this.data) {
        Codec.writeVarInt32(buf, i);
    }/*from w w w  .  j  ava  2s. co m*/
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutChunkData.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    buf.writeInt(this.chunkLocation.x());
    buf.writeInt(this.chunkLocation.z());

    buf.writeBoolean(this.continuous);
    buf.writeShort(this.bitmask);

    Codec.writeVarInt32(buf, data.length);
    buf.writeBytes(data);/*from   w w  w  .j  a  v  a 2 s. co  m*/
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEffect.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    buf.writeInt(this.effectId);

    new PositionWritable(this.loc).write(buf);

    buf.writeInt(this.data);
    buf.writeBoolean(this.playSound);
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEntityLook.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    Codec.writeVarInt32(buf, this.entityId);

    buf.writeByte((int) this.location.yaw());
    buf.writeByte((int) this.location.pitch());

    buf.writeBoolean(this.onGround);
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEntityRelativeMove.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    Codec.writeVarInt32(buf, this.entityId);

    buf.writeInt((int) this.difference.x() * 32);
    buf.writeInt((int) this.difference.y() * 32);
    buf.writeInt((int) this.difference.z() * 32);

    buf.writeBoolean(this.onGround);
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEntityTeleport.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    Codec.writeVarInt32(buf, this.entityId);

    buf.writeInt((int) this.location.x() * 32);
    buf.writeInt((int) this.location.y() * 32);
    buf.writeInt((int) this.location.z() * 32);

    buf.writeByte((int) this.location.yaw() * 256 / 360);
    buf.writeByte((int) this.location.pitch() * 256 / 360);

    buf.writeBoolean(this.onGround);
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutJoinGame.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    buf.writeInt(this.entityId);

    buf.writeByte((int) this.gamemode.asByte());
    buf.writeByte((int) this.dimension.asByte());
    buf.writeByte((int) this.difficulty.asByte());
    buf.writeByte((int) this.maxPlayers);

    Codec.writeString(buf, this.levelType.toString());
    buf.writeBoolean(false);
}

From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutMapChunkBulk.java

License:Apache License

@Override
public void encode(ByteBuf buf) {
    buf.writeBoolean(this.lightSent);

    Codec.writeVarInt32(buf, entries.size());

    for (PacketPlayOutChunkData packet : entries) {
        ChunkLocation location = packet.chunkLocation();

        buf.writeInt(location.x());//ww  w .ja  v  a2 s. co  m
        buf.writeInt(location.z());
        buf.writeShort(packet.bitmask());
    }

    for (PacketPlayOutChunkData packet : entries) {
        buf.writeBytes(packet.data());
    }
}