Example usage for io.netty.buffer ByteBuf readBoolean

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

Introduction

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

Prototype

public abstract boolean readBoolean();

Source Link

Document

Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.

Usage

From source file:org.spoutcraft.client.network.codec.play.ChunkDataCodec.java

License:MIT License

@Override
public ChunkDataMessage decode(ByteBuf buf) throws IOException {
    final int x = buf.readInt();
    final int z = buf.readInt();
    final boolean groundUpContinuous = buf.readBoolean();
    final short primaryBitMap = (short) buf.readUnsignedShort();
    final short additionalDataBitMap = (short) buf.readUnsignedShort();
    final int compressedSize = buf.readInt();
    final byte[] compressedData = new byte[compressedSize];
    buf.readBytes(compressedData);/*w w w  . j  av  a 2s.c  o m*/
    return new ChunkDataMessage(x, z, groundUpContinuous, primaryBitMap, additionalDataBitMap, compressedSize,
            compressedData);
}

From source file:org.spoutcraft.client.network.codec.play.PositionLookCodec.java

License:MIT License

@Override
public PositionLookMessage decode(ByteBuf buf) throws IOException {
    final double x = buf.readInt();
    final double y = buf.readInt();
    final double z = buf.readInt();
    final float yaw = buf.readFloat();
    final float pitch = buf.readFloat();
    final boolean onGround = buf.readBoolean();
    return new PositionLookMessage(x, y, z, yaw, pitch, onGround);
}

From source file:org.starmod.net.object.field.type.NetworkBoolean.java

License:MIT License

@Override
public void decode(ByteBuf buf) {
    setValue(buf.readBoolean());
}

From source file:org.starnub.starbounddata.packets.connection.ClientConnectPacket.java

License:Open Source License

/**
 * Recommended: For internal use with StarNub Player Sessions
 * <p>/*from  w  w  w  .ja  v a  2 s . com*/
 * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields
 * <p>
 *
 * @param in ByteBuf representing the reason to be read into the packet
 */
@Override
public void read(ByteBuf in) {
    this.assetDigest = readVLQArray(in);
    boolean hasUUID = in.readBoolean();
    if (hasUUID) {
        this.playerUuid = readUUID(in);
    }
    this.playerName = readVLQString(in);
    this.playerSpecies = readVLQString(in);
    this.shipData = readVLQArray(in);
    this.shipUpgrades.read(in);
    this.account = readVLQString(in);
}

From source file:org.starnub.starbounddata.packets.connection.ConnectResponsePacket.java

License:Open Source License

/**
 * Recommended: For internal use with StarNub Player Sessions
 * <p>/*from   w w w. j a v  a  2s  . c o m*/
 * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields
 * <p>
 *
 * @param in ByteBuf representing the reason to be read into the packet
 */
@Override
public void read(ByteBuf in) {
    this.success = in.readBoolean();
    this.clientId = VLQ.readUnsignedFromBufferNoObject(in);
    this.rejectionReason = readVLQString(in);
    boolean hasCelestialBaseInformation = in.readBoolean();
    if (hasCelestialBaseInformation) {
        this.celestialBaseInformation.read(in);
    }
}

From source file:org.starnub.starbounddata.packets.connection.ServerDisconnectPacket.java

License:Open Source License

/**
 * Recommended: For internal use with StarNub Player Sessions
 * <p>//from  w  w w .j a  v a  2s .  c o m
 * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields
 * <p>
 *
 * @param in ByteBuf representing the reason to be read into the packet
 */
@Override
public void read(ByteBuf in) {
    boolean hasReason = in.readBoolean();
    if (hasReason) {
        this.reason = readVLQString(in);
    }
}

From source file:org.starnub.starbounddata.packets.entity.EntityDestroyPacket.java

License:Open Source License

/**
 * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields
 * <p>//www .  j a  va 2s.  c o  m
 *
 * @param in ByteBuf representing the reason to be read into the packet
 */
@Override
public void read(ByteBuf in) {
    this.entityId.read(in);
    this.death = in.readBoolean();
}

From source file:org.starnub.starbounddata.packets.world.WorldStartPacket.java

License:Open Source License

/**
 * Recommended: For internal use with StarNub Player Sessions
 * <p>//from   ww w.  j  a va2  s.c  om
 * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields
 * <p>
 *
 * @param in ByteBuf representing the reason to be read into the packet
 */
@Override
public void read(ByteBuf in) {
    ByteBufferUtilities.print(in, true);
    this.templateData.read(in);
    this.skyData = readVLQArray(in);
    this.weatherData = readVLQArray(in);
    this.playerStart.read(in);
    //        this.protectedDungeonIds.read(in); // DEBUG
    this.worldProperties.read(in);
    this.clientId = in.readInt();
    this.localInterpolationMode = in.readBoolean();
}

From source file:org.starnub.starbounddata.types.damage.DamageNotification.java

License:Open Source License

@Override
public void read(ByteBuf in) {
    this.sourceEntityId.read(in);
    this.targetEntityId.read(in);
    this.position.read(in);
    this.damage = in.readFloat();
    this.damageSourceKind = readVLQString(in);
    this.targetMaterialKind = readVLQString(in);
    this.killed = in.readBoolean();
}

From source file:org.starnub.starbounddata.types.damage.EphemeralStatusEffect.java

License:Open Source License

@Override
public void read(ByteBuf in) {
    this.uniqueStatusEffect = readVLQString(in);
    boolean hasDuration = in.readBoolean();
    if (hasDuration) {
        this.duration = in.readFloat();
    }//ww w .j  a  v  a 2  s  .  co m
}