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:de.ellpeck.actuallyadditions.mod.network.PacketParticle.java

@Override
public void fromBytes(ByteBuf buf) {
    this.startX = buf.readDouble();
    this.startY = buf.readDouble();
    this.startZ = buf.readDouble();
    this.endX = buf.readDouble();
    this.endY = buf.readDouble();
    this.endZ = buf.readDouble();
    this.particleAmount = buf.readInt();
    this.particleSize = buf.readFloat();

    this.color = new float[3];
    for (int i = 0; i < this.color.length; i++) {
        this.color[i] = buf.readFloat();
    }//from w  w w. ja  v a2 s . c  o  m
}

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()));
    }/* www .j  a  va  2 s .co m*/
}

From source file:de.sanandrew.mods.betterboat.network.PacketSendBoatPos.java

License:Creative Commons License

@Override
public void fromBytes(ByteBuf buf) {
    this.boatId = buf.readInt();
    this.posX = buf.readDouble();
    this.posY = buf.readDouble();
    this.posZ = buf.readDouble();
    this.rotationYaw = buf.readFloat();
    this.rotationPitch = buf.readFloat();
}

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 ww  .j a va2 s. c  o  m*/
    if (buffer.readBoolean()) {
        this.targetCache = this.world.getEntityByID(buffer.readInt());
    }
}

From source file:de.sanandrew.mods.turretmod.registry.turret.shieldgen.TurretForcefield.java

License:Creative Commons License

@Override
public void readSpawnData(ITurretInst turretInst, ByteBuf buf) {
    ShieldTurret shield = turretInst.getRAM(() -> new ShieldTurret(turretInst));
    shield.value = buf.readFloat();
    shield.recovery = buf.readFloat();/*from w  w w .j a va2s .  c  o  m*/
}

From source file:de.sanandrew.mods.turretmod.tileentity.electrolytegen.TileEntityElectrolyteGenerator.java

License:Creative Commons License

@Override
public void fromBytes(ByteBuf buf) {
    this.energyStorage.fluxAmount = buf.readInt();
    this.effectiveness = buf.readFloat();
    for (int i = 0, max = this.processes.length; i < max; i++) {
        if (buf.readBoolean()) {
            this.processes[i] = new ElectrolyteProcess(buf);
        } else {//w  ww  .j a va  2s  .c  om
            this.processes[i] = null;
        }
    }
}

From source file:eu.jangos.realm.network.packet.client.misc.CMSG_WORLD_TELEPORT.java

License:Apache License

@Override
public void decode(ByteBuf buf) throws Exception {
    if ((buf.readableBytes() + 4) < this.size) {
        throw new Exception();
    }//from ww w  . j  av  a2  s  .  co  m

    this.time = buf.readInt();
    this.mapID = buf.readInt();
    this.posX = buf.readFloat();
    this.posY = buf.readFloat();
    this.posZ = buf.readFloat();
    this.orientation = buf.readFloat();
}

From source file:gedi.remote.codec.DefaultDecoder.java

License:Apache License

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {

    if (in.readableBytes() < Integer.BYTES)
        return;/*w  ww . jav  a2 s  .  c  om*/

    in.markReaderIndex();
    int size = in.readInt();

    if (in.readableBytes() < size) {
        in.resetReaderIndex();
        return;
    }

    // everything has arrived, decode
    char[] classname = new char[in.readInt()];
    for (int i = 0; i < classname.length; i++)
        classname[i] = (char) (in.readByte() & 255);

    String clsName = String.valueOf(classname);

    if (clsName.length() == 1) {

        switch (clsName) {
        case "A":
            char[] re = new char[in.readInt()];
            for (int i = 0; i < re.length; i++)
                re[i] = (char) (in.readByte() & 255);
            out.add(String.valueOf(re));
            break;
        case "B":
            out.add(in.readByte());
            break;
        case "S":
            out.add(in.readShort());
            break;
        case "I":
            out.add(in.readInt());
            break;
        case "L":
            out.add(in.readLong());
            break;
        case "F":
            out.add(in.readFloat());
            break;
        case "D":
            out.add(in.readDouble());
            break;
        }

    } else {

        if (!ClassPathCache.getInstance().existsClass(clsName)) {
            in.resetReaderIndex();
            return;
        }

        Class<?> cls = Class.forName(clsName);
        BinarySerializable re = (BinarySerializable) cls.newInstance();

        BinaryBlob buff = new BinaryBlob(size - Integer.BYTES - classname.length);
        in.readBytes(buff.getBuffer());
        buff.getBuffer().flip();

        re.deserialize(buff);

        out.add(re);
    }
}

From source file:growthcraft.cellar.common.tileentity.component.TileHeatingComponent.java

License:Open Source License

@Override
public boolean readFromStream(ByteBuf stream) {
    this.heat = stream.readFloat();
    return false;
}

From source file:growthcraft.cellar.common.tileentity.device.BrewKettle.java

License:Open Source License

/**
 * @param buf - buffer to read from/*from w w w. j  a  v  a 2 s  . c  o m*/
 */
@Override
public boolean readFromStream(ByteBuf buf) {
    super.readFromStream(buf);
    this.time = buf.readDouble();
    this.timeMax = buf.readDouble();
    this.grain = buf.readFloat();
    heatComponent.readFromStream(buf);
    return false;
}