Example usage for io.netty.buffer ByteBuf readFloat

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

Introduction

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

Prototype

public abstract float readFloat();

Source Link

Document

Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer.

Usage

From source file:buildcraft.factory.TilePump.java

License:Minecraft Mod Public

@Override
public void handleUpdatePacket(PacketUpdate packet) throws IOException {
    PacketPayload payload = packet.payload;
    ByteBuf data = payload.stream;
    aimY = data.readInt();//w  ww  .  j  a  va  2s. c  om
    tubeY = data.readFloat();
    powered = data.readBoolean();

    setTubePosition();
}

From source file:buildcraft.factory.TileQuarry.java

License:Minecraft Mod Public

@Override
public void readData(ByteBuf stream) {
    super.readData(stream);
    box.readData(stream);//from   w  ww.j a v  a  2s. co m
    targetX = stream.readInt();
    targetY = stream.readUnsignedShort();
    targetZ = stream.readInt();
    headPosX = stream.readDouble();
    headPosY = stream.readDouble();
    headPosZ = stream.readDouble();
    speed = stream.readFloat();
    headTrajectory = stream.readFloat();
    int flags = stream.readUnsignedByte();
    stage = Stage.values()[flags & 0x07];
    movingHorizontally = (flags & 0x10) != 0;
    movingVertically = (flags & 0x20) != 0;

    createUtilsIfNeeded();

    if (arm != null) {
        arm.setHead(headPosX, headPosY, headPosZ);
        arm.updatePosition();
    }
}

From source file:buildcraft.factory.TileRefinery.java

License:Minecraft Mod Public

@Override
public void handleUpdatePacket(PacketUpdate packet) throws IOException {
    ByteBuf stream = packet.payload.stream;
    animationSpeed = stream.readFloat();
    tankManager.readData(stream);/* w  ww  .  j  ava 2  s.c o  m*/
}

From source file:buildcraft.robotics.gui.ContainerZonePlan.java

License:Minecraft Mod Public

@Override
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
    if (side.isClient()) {
        if ("areaLoaded".equals(command)) {
            currentAreaSelection = new ZonePlan();
            currentAreaSelection.readData(stream);
            gui.refreshSelectedArea();//from ww w.ja va  2  s  .  c om
        } else if ("receiveImage".equals(command)) {
            int size = stream.readUnsignedMedium();
            int pos = stream.readUnsignedMedium();

            for (int i = 0; i < Math.min(size - pos, MAX_PACKET_LENGTH); ++i) {
                mapTexture.colorMap[pos + i] = 0xFF000000
                        | MapColor.mapColorArray[stream.readUnsignedByte()].colorValue;
            }
        }
    } else if (side.isServer()) {
        if ("loadArea".equals(command)) {
            final int index = stream.readUnsignedByte();
            BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender,
                    new PacketCommand(this, "areaLoaded", new CommandWriter() {
                        public void write(ByteBuf data) {
                            map.selectArea(index).writeData(data);
                        }
                    }));
        } else if ("saveArea".equals(command)) {
            final int index = stream.readUnsignedByte();
            ZonePlan plan = new ZonePlan();
            plan.readData(stream);
            map.setArea(index, plan);
        } else if ("computeMap".equals(command)) {
            computeMap(stream.readInt(), stream.readInt(), stream.readUnsignedShort(),
                    stream.readUnsignedShort(), stream.readFloat(), (EntityPlayer) sender);
        } else if ("setName".equals(command)) {
            map.mapName = NetworkUtils.readUTF(stream);
        }
    }
}

From source file:buildcraft.transport.network.PacketPipeTransportTraveler.java

License:Minecraft Mod Public

@Override
public void readData(ByteBuf data) {
    this.itemX = data.readFloat();
    this.itemY = data.readFloat();
    this.itemZ = data.readFloat();

    posX = MathHelper.floor_float(itemX);
    posY = MathHelper.floor_float(itemY);
    posZ = MathHelper.floor_float(itemZ);

    this.entityId = data.readShort();

    this.input = ForgeDirection.getOrientation(data.readByte());
    this.output = ForgeDirection.getOrientation(data.readByte());

    byte c = data.readByte();
    if (c != -1) {
        this.color = EnumColor.fromId(c);
    }/*www  .j a  v  a2  s .c o m*/

    this.speed = data.readFloat();

    this.forceStackRefresh = data.readBoolean();
}

From source file:buildcraftAdditions.entities.EntityLaserShot.java

License:GNU General Public License

@Override
public void readSpawnData(ByteBuf additionalData) {
    strength = additionalData.readFloat();
}

From source file:buildcraftAdditions.tileEntities.TileCoolingTower.java

License:GNU General Public License

@Override
public void readFromByteBuff(ByteBuf buf) {
    valve = buf.readBoolean();//from ww w . j av a  2 s.c o  m
    heat = buf.readFloat();
    input.readFromByteBuff(buf);
    output.readFromByteBuff(buf);
    coolant.readFromByteBuff(buf);
    data.readFromByteBuff(buf);
    upgrades.readFromByteBuff(buf);
}

From source file:cn.academy.ability.teleport.msg.LocTeleMsg.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    super.fromBytes(buf);
    cp = buf.readFloat();
}

From source file:cn.academy.api.data.MsgSimpleChange.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    entityID = buf.readInt();/* w  w  w  .j  av  a2 s  . co  m*/
    cp = buf.readFloat();
    maxCP = buf.readFloat();

    skillCount = buf.readInt();
    skillExp = new float[skillCount];
    for (int i = 0; i < skillCount; ++i) {
        skillExp[i] = buf.readFloat();
    }
}

From source file:cn.academy.energy.msg.MsgEnergyHeartbeat.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    x = buf.readInt();/*from   w  ww  .j a  va  2s .  c  o  m*/
    y = buf.readInt();
    z = buf.readInt();
    energy = buf.readFloat();
    loaded = buf.readBoolean();
}