Example usage for io.netty.buffer ByteBuf writeByte

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

Introduction

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

Prototype

public abstract ByteBuf writeByte(int value);

Source Link

Document

Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.

Usage

From source file:buildcraft.api.core.Position.java

License:Open Source License

@Override
public void writeData(ByteBuf stream) {
    stream.writeDouble(x);//from ww w  .  j  a va 2s . co  m
    stream.writeDouble(y);
    stream.writeDouble(z);
    stream.writeByte(orientation.ordinal());
}

From source file:buildcraft.builders.blueprints.BlueprintId.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf stream) {
    Utils.writeByteArray(stream, uniqueId);
    Utils.writeUTF(stream, name);
    stream.writeByte(kind.ordinal());
}

From source file:buildcraft.builders.TileConstructionMarker.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf stream) {
    box.writeData(stream);/*from  ww w.  j a v  a2s. com*/
    stream.writeByte((laser != null ? 1 : 0) | (itemBlueprint != null ? 2 : 0));
    if (laser != null) {
        laser.writeData(stream);
    }
    if (itemBlueprint != null) {
        Utils.writeStack(stream, itemBlueprint);
    }
}

From source file:buildcraft.builders.TilePathMarker.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf data) {
    int flags = (lasers[0] != null ? 1 : 0) | (lasers[1] != null ? 2 : 0) | (tryingToConnect ? 4 : 0);
    data.writeByte(flags);
    if (lasers[0] != null) {
        lasers[0].writeData(data);/* w ww  . ja v a  2 s  .  c  o m*/
    }
    if (lasers[1] != null) {
        lasers[1].writeData(data);
    }
}

From source file:buildcraft.builders.TileQuarry.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf stream) {
    super.writeData(stream);
    box.writeData(stream);//  w w  w  . ja  va  2  s  .  co m
    stream.writeInt(targetX);
    stream.writeShort(targetY);
    stream.writeInt(targetZ);
    stream.writeDouble(headPosX);
    stream.writeDouble(headPosY);
    stream.writeDouble(headPosZ);
    stream.writeFloat((float) speed);
    stream.writeFloat(headTrajectory);
    int flags = stage.ordinal();
    flags |= movingHorizontally ? 0x10 : 0;
    flags |= movingVertically ? 0x20 : 0;
    stream.writeByte(flags);

    ledState = (hasWork() && mode != Mode.Off && getTicksSinceEnergyReceived() < 12 ? 16 : 0)
            | (getBattery().getEnergyStored() * 15 / getBattery().getMaxEnergyStored());
    stream.writeByte(ledState);
}

From source file:buildcraft.commander.ContainerZonePlan.java

License:Minecraft Mod Public

public void loadArea(final int index) {
    BuildCraftCore.instance.sendToServer(new PacketCommand(this, "loadArea", new CommandWriter() {
        public void write(ByteBuf data) {
            data.writeByte(index);
        }//  w  ww  .  java  2 s.  c o m
    }));
}

From source file:buildcraft.commander.ContainerZonePlan.java

License:Minecraft Mod Public

public void saveArea(final int index) {
    BuildCraftCore.instance.sendToServer(new PacketCommand(this, "saveArea", new CommandWriter() {
        public void write(ByteBuf data) {
            data.writeByte(index);
            currentAreaSelection.writeData(data);
        }//from  ww w  .  j  a  va  2s.c  om
    }));
}

From source file:buildcraft.commander.GuiZonePlan.java

License:Minecraft Mod Public

private void uploadMap() {
    BuildCraftCore.instance.sendToServer(new PacketCommand(getContainer(), "computeMap", new CommandWriter() {
        public void write(ByteBuf data) {
            data.writeInt(cx);/*from  w w  w  . ja  va2s.co  m*/
            data.writeInt(cz);
            data.writeShort(getContainer().mapTexture.width);
            data.writeShort(getContainer().mapTexture.height);
            data.writeByte(zoomLevel);
        }
    }));
}

From source file:buildcraft.commander.TileRequester.java

License:Minecraft Mod Public

public void setRequest(final int index, final ItemStack stack) {
    if (worldObj.isRemote) {
        BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setRequest", new CommandWriter() {
            public void write(ByteBuf data) {
                data.writeByte(index);
                Utils.writeStack(data, stack);
            }/*from  w ww .  j a va  2s  . c  o m*/
        }));
    } else {
        requests.setInventorySlotContents(index, stack);
    }
}

From source file:buildcraft.core.blueprints.BlueprintReadConfiguration.java

License:Minecraft Mod Public

@Override
public void writeData(ByteBuf stream) {
    stream.writeByte((rotate ? 1 : 0) | (excavate ? 2 : 0) | (allowCreative ? 4 : 0));
}