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:com.yyon.grapplinghook.network.MultiHookMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.id = buf.readInt();
    this.sneaking = buf.readBoolean();
}

From source file:dan200.qcraft.shared.QCraftPacket.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buffer) {
    packetType = buffer.readByte();//from  w ww.  ja v  a 2  s  . c  o m
    byte nString = buffer.readByte();
    byte nInt = buffer.readByte();
    int nByte = buffer.readInt();
    if (nString == 0) {
        dataString = null;
    } else {
        dataString = new String[nString];
        for (int k = 0; k < nString; k++) {
            if (buffer.readBoolean()) {
                int len = buffer.readInt();
                byte[] b = new byte[len];
                buffer.readBytes(b);
                try {
                    dataString[k] = new String(b, "UTF-8");
                } catch (UnsupportedEncodingException e) {
                    dataString[k] = null;
                }
            }
        }
    }
    if (nInt == 0) {
        dataInt = null;
    } else {
        dataInt = new int[nInt];
        for (int k = 0; k < nInt; k++) {
            dataInt[k] = buffer.readInt();
        }
    }
    if (nByte == 0) {
        dataByte = null;
    } else {
        dataByte = new byte[nByte][];
        for (int k = 0; k < nByte; k++) {
            int length = buffer.readInt();
            if (length > 0) {
                dataByte[k] = new byte[length];
                buffer.getBytes(buffer.readerIndex(), dataByte[k]);
            }
        }
    }
}

From source file:de.canitzp.rarmor.packet.PacketOpenModule.java

@Override
public void fromBytes(ByteBuf buf) {
    this.moduleId = buf.readInt();
    this.alsoSetData = buf.readBoolean();
    this.sendRarmorDataToClient = buf.readBoolean();
}

From source file:de.canitzp.rarmor.packet.PacketSyncRarmorData.java

@Override
public void fromBytes(ByteBuf buf) {
    this.shouldReloadTabs = buf.readBoolean();
    this.moduleIdForConfirmation = buf.readInt();

    try {//from  w w  w  . ja  v a2s .  c  o  m
        PacketBuffer buffer = new PacketBuffer(buf);

        this.stackId = buffer.readUniqueId();
        this.receivedDataCompound = buffer.readCompoundTag();
    } catch (IOException e) {
        Rarmor.LOGGER.info("Something went wrong trying to receive a " + Rarmor.MOD_NAME + " Update Packet!",
                e);
    }
}

From source file:de.jackwhite20.hftp.shared.packet.ListDirectoryPacket.java

License:Open Source License

@Override
public void read(ByteBuf byteBuf) throws Exception {

    int size = byteBuf.readInt();
    for (int i = 0; i < size; i++) {
        listFileData.add(new ListFileData(readString(byteBuf), byteBuf.readFloat(), readString(byteBuf),
                byteBuf.readBoolean()));
    }//from ww w . jav  a  2  s. c o  m
}

From source file:de.sanandrew.mods.turretmod.entity.projectile.EntityProjectileFlame.java

License:Creative Commons License

@Override
public void readSpawnData(ByteBuf buffer) {
    super.readSpawnData(buffer);

    this.purifying = buffer.readBoolean();
}

From source file:de.sanandrew.mods.turretmod.entity.projectile.EntityTurretProjectile.java

License:Creative Commons License

@Override
public void readSpawnData(ByteBuf buffer) {
    this.rotationYaw = buffer.readFloat();
    this.rotationPitch = buffer.readFloat();

    if (buffer.readBoolean()) {
        this.shooterCache = this.world.getEntityByID(buffer.readInt());
    }/*from w w  w  . j a  va  2s  . com*/
    if (buffer.readBoolean()) {
        this.targetCache = this.world.getEntityByID(buffer.readInt());
    }
}

From source file:de.sanandrew.mods.turretmod.entity.turret.EntityTurret.java

License:Creative Commons License

@Override
public void readSpawnData(ByteBuf buffer) {
    this.delegate = TurretRegistry.INSTANCE.getTurret(new UUID(buffer.readLong(), buffer.readLong()));

    this.targetProc.readFromNbt(ByteBufUtils.readTag(buffer));
    this.upgProc.readFromNbt(ByteBufUtils.readTag(buffer));

    this.isUpsideDown = buffer.readBoolean();

    if (buffer.readBoolean()) {
        this.ownerUUID = new UUID(buffer.readLong(), buffer.readLong());
        this.ownerName = ByteBufUtils.readUTF8String(buffer);
    }//from  w ww .  j  a  v  a  2s.  c  o  m

    this.delegate.readSpawnData(this, buffer);
}

From source file:de.sanandrew.mods.turretmod.network.PacketUpdateTargets.java

License:Creative Commons License

@Override
@SuppressWarnings("unchecked")
public void fromBytes(ByteBuf buf) {
    this.turretID = buf.readInt();
    this.entityTargets = new ArrayList<>();
    for (int i = 0, max = buf.readInt(); i < max; i++) {
        try {/*from   ww  w . j  a v  a 2s  . com*/
            this.entityTargets.add((Class<? extends Entity>) Class.forName(ByteBufUtils.readUTF8String(buf)));
        } catch (ClassNotFoundException ignored) {
        }
    }
    this.playerTargets = new UUID[buf.readInt()];
    for (int i = 0; i < this.playerTargets.length; i++) {
        try {
            this.playerTargets[i] = UUID.fromString(ByteBufUtils.readUTF8String(buf));
        } catch (IllegalArgumentException ex) {
            this.playerTargets[i] = null;
        }
    }
    this.isBlacklistEntity = buf.readBoolean();
    this.isBlacklistPlayer = buf.readBoolean();
}

From source file:de.sanandrew.mods.turretmod.network.PacketUpdateTurretState.java

License:Creative Commons License

@Override
public void fromBytes(ByteBuf buf) {
    this.turretId = buf.readInt();
    this.entityToAttackId = buf.readInt();
    this.currAmmoCap = buf.readInt();
    this.isShooting = buf.readBoolean();
    this.ammoStack = ByteBufUtils.readItemStack(buf);
    int lng = buf.readInt();
    this.delegateData = new byte[lng];
    if (lng > 0) {
        buf.readBytes(this.delegateData);
    }//from   w  ww. ja  va 2s .  c  om
}