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:hellfirepvp.astralsorcery.common.network.packet.client.PktRotateTelescope.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(isClockwise);
    ByteBufUtils.writePos(buf, pos);
    buf.writeInt(dimId);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.client.PktUnlockPerk.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(serverAccept);
    buf.writeInt(perk.getSingleInstance().getId());
    if (!serverAccept) {
        ByteBufUtils.writeString(buf, owningConstellation.getUnlocalizedName());
    }// w  ww . ja v a  2  s.c o  m
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktAttunementAltarState.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(entityId);
    buf.writeBoolean(started);
    buf.writeInt(worldId);
    ByteBufUtils.writePos(buf, at);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktLightningEffect.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    from.toBytes(buf);/*from   w  ww.  j a va  2s .  c  om*/
    to.toBytes(buf);
    buf.writeBoolean(colorOverlay != null);
    if (colorOverlay != null) {
        for (float color : colorOverlay.getComponents(new float[4])) {
            buf.writeFloat(color);
        }
    }
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktOreScan.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(tumble);
    buf.writeInt(positions.size());//from   ww w. j  a v a2  s  .  c  o m
    for (BlockPos pos : positions) {
        ByteBufUtils.writePos(buf, pos);
    }
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktProgressionUpdate.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(tier);
    buf.writeBoolean(isProg);
    buf.writeBoolean(isPresent);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktShootEntity.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(this.entityId);
    buf.writeDouble(this.motionVector.getX());
    buf.writeDouble(this.motionVector.getY());
    buf.writeDouble(this.motionVector.getZ());
    buf.writeBoolean(this.hasEffect);
    if (hasEffect) {
        buf.writeDouble(this.effectLength);
    }//from w w  w .j  av a 2 s.  co m
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktSyncKnowledge.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeByte(state);/*from  ww  w. j  a v a 2s.co  m*/

    if (knownConstellations != null) {
        buf.writeInt(knownConstellations.size());
        for (String dat : knownConstellations) {
            ByteBufUtils.writeString(buf, dat);
        }
    } else {
        buf.writeInt(-1);
    }

    if (seenConstellations != null) {
        buf.writeInt(seenConstellations.size());
        for (String dat : seenConstellations) {
            ByteBufUtils.writeString(buf, dat);
        }
    } else {
        buf.writeInt(-1);
    }

    if (researchProgression != null) {
        buf.writeInt(researchProgression.size());
        for (ResearchProgression progression : researchProgression) {
            buf.writeInt(progression.getProgressId());
        }
    } else {
        buf.writeInt(-1);
    }

    if (attunedConstellation != null) {
        buf.writeByte(1);
        ByteBufUtils.writeString(buf, attunedConstellation.getUnlocalizedName());
    } else {
        buf.writeByte(-1);
    }

    if (appliedPerks != null) {
        buf.writeInt(appliedPerks.size());
        for (ConstellationPerk perk : appliedPerks.keySet()) {
            buf.writeInt(perk.getId());
            buf.writeInt(appliedPerks.get(perk));
        }
    } else {
        buf.writeInt(-1);
    }

    buf.writeBoolean(this.wasOnceAttuned);
    buf.writeInt(this.progressTier);
    buf.writeDouble(this.alignmentCharge);
}

From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktUpdateReach.java

License:Open Source License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeBoolean(apply);
    buf.writeFloat(modifier);
}

From source file:hellfirepvp.astralsorcery.common.util.ByteBufUtils.java

License:Open Source License

public static void writeItemStack(ByteBuf byteBuf, @Nonnull ItemStack stack) {
    boolean defined = !stack.isEmpty();
    byteBuf.writeBoolean(defined);
    if (defined) {
        NBTTagCompound tag = new NBTTagCompound();
        stack.writeToNBT(tag);//w w w  .  j  a  v a 2s.c  o m
        writeNBTTag(byteBuf, tag);
    }
}