Example usage for io.netty.buffer ByteBuf readDouble

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

Introduction

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

Prototype

public abstract double readDouble();

Source Link

Document

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

Usage

From source file:jp.llv.locapi.PlayerPositionAndLook.java

License:Open Source License

@Override
public void read(ByteBuf buf) {
    this.x = buf.readDouble();
    this.y = buf.readDouble();
    this.z = buf.readDouble();
    this.yaw = buf.readFloat();
    this.pitch = buf.readFloat();
    this.flag = buf.readByte();
}

From source file:k4unl.minecraft.Hydraulicraft.network.LocationDoublePacket.java

License:LGPL

@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
    x = buffer.readDouble();
    y = buffer.readDouble();
    z = buffer.readDouble();
}

From source file:makeo.gadomancy.common.network.packets.PacketTCWispyLine.java

License:LGPL

@Override
public void fromBytes(ByteBuf buf) {
    dimId = buf.readInt();/*from  ww w .  j  a va2 s . c o m*/
    pedestalX = buf.readDouble();
    pedestalY = buf.readDouble();
    pedestalZ = buf.readDouble();
    originX = buf.readDouble();
    originY = buf.readDouble();
    originZ = buf.readDouble();
    tickCap = buf.readInt();
    colorAsInt = buf.readInt();
}

From source file:mal.carbonization.network.FuelConversionBenchMessageServer.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    xpos = buf.readInt();/*from w ww. j  ava 2  s.  c om*/
    ypos = buf.readInt();
    zpos = buf.readInt();
    fuelState = buf.readBoolean();
    currentIndex = buf.readInt();
    craftingCooldown = buf.readInt();
    maxCooldown = buf.readInt();
    bonusYield = buf.readDouble();
    voidUpgrade = buf.readBoolean();
    ejectSide = buf.readInt();
    maxFuel = buf.readInt();
    fuelStack = buf.readInt();
    inventory = buf.readBoolean();
    if (inventory) {
        int inputsize = buf.readInt();
        int iitemcount = buf.readInt();
        byte[] inputbyte = new byte[inputsize];
        buf.readBytes(inputbyte);
        inventoryStacks = ByteArraytoItemStack(inputbyte, iitemcount);

        int outputsize = buf.readInt();
        int oitemcount = buf.readInt();
        byte[] outputbyte = new byte[outputsize];
        buf.readBytes(outputbyte);
        upgradeStacks = ByteArraytoItemStack(outputbyte, oitemcount);
    }
}

From source file:mal.carbonization.network.FurnacesMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    xpos = buf.readInt();//from w w  w . ja  v a  2  s  . c  om
    ypos = buf.readInt();
    zpos = buf.readInt();
    facing = buf.readByte();
    metadata = buf.readInt();
    usesExtraTime = buf.readBoolean();
    isActive = buf.readBoolean();
    furnaceCookTimeMultiplyer = buf.readDouble();
    furnaceMaxCookTime = buf.readInt();
    tier = buf.readInt();
    furnaceBurnTime = buf.readInt();
    currentItemBurnTime = buf.readInt();
    furnaceCookTime = buf.readInt();

    int l = buf.readInt();
    int c = buf.readInt();
    byte[] b = new byte[l];
    buf.readBytes(b);
    inventory = ByteArraytoItemStack(b, c);
}

From source file:mal.carbonization.network.MultiblockFurnaceMessageServer.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    xpos = buf.readInt();/*from  w  w w  .  j  a  v  a2 s.c o m*/
    ypos = buf.readInt();
    zpos = buf.readInt();
    xsize = buf.readInt();
    ysize = buf.readInt();
    zsize = buf.readInt();
    useInventory = buf.readBoolean();
    byte offsetsize = buf.readByte();
    offset = new int[offsetsize];
    for (int i = 0; i < offset.length; i++)
        offset[i] = buf.readInt();
    properlyActivated = buf.readBoolean();
    oreCapacity = buf.readInt();
    slagTank = buf.readInt();
    byte tiersize = buf.readByte();
    componentTiers = new double[tiersize];
    for (int j = 0; j < componentTiers.length; j++)
        componentTiers[j] = buf.readDouble();
    if (useInventory) {
        int l = buf.readInt();
        int c = buf.readInt();
        byte[] b = new byte[l];
        buf.readBytes(b);
        inputStacks = ByteArraytoItemStack(b, c);
        int ll = buf.readInt();
        int cc = buf.readInt();
        byte[] bb = new byte[ll];
        buf.readBytes(bb);
        outputStacks = ByteArraytoItemStack(bb, cc);
    }
    fuelStack = buf.readInt();
    numQueueJobs = buf.readInt();
    grossCookTime = buf.readInt();
    grossMaxCookTime = buf.readInt();
    maxFuelCapacity = buf.readInt();
    passFuel = buf.readBoolean();
    int queuenum = buf.readInt();
    queue = new ArrayList<MultiblockWorkQueueItem>();
    for (int i = 0; i < queuenum; i++) {
        int by = buf.readInt();
        byte[] ba = new byte[by];
        buf.readBytes(ba);
        MultiblockWorkQueueItem q = queueItemfromBytes(ba);
        if (q != null)
            queue.add(q);
    }
    try {
        int slagnum = buf.readInt();
        byte[] slagbyte = new byte[slagnum];
        buf.readBytes(slagbyte);
        ByteArrayInputStream bin = new ByteArrayInputStream(slagbyte);
        ObjectInputStream in = new ObjectInputStream(bin);
        oreSlagInQueue = (HashMap<String, Integer>) in.readObject();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:mal.carbonization.network.TunnelBoreMessageServer.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    xpos = buf.readInt();/* ww  w  .  jav  a2s.c o  m*/
    ypos = buf.readInt();
    zpos = buf.readInt();
    xSize = buf.readInt();
    ySize = buf.readInt();
    facing = buf.readInt();
    cycles = buf.readInt();
    maxDigCooldown = buf.readInt();
    digCooldown = buf.readInt();
    fuelStack = buf.readInt();
    maxFuel = buf.readInt();
    digSilkTouch = buf.readBoolean();
    digIgnoreHardness = buf.readBoolean();
    digFortuneLevel = buf.readInt();
    hollowScaffold = buf.readBoolean();
    fuelMultiplyer = buf.readDouble();
    fixedPosition = buf.readBoolean();
    voidUpgrade = buf.readBoolean();
    inventory = buf.readBoolean();
    if (inventory) {
        int upgradeSize = buf.readInt();
        int iitemcount = buf.readInt();
        byte[] upgradebyte = new byte[upgradeSize];
        buf.readBytes(upgradebyte);
        upgradeSlots = ByteArraytoItemStack(upgradebyte, iitemcount);

        int dimensionsize = buf.readInt();
        int ditemcount = buf.readInt();
        byte[] inputbyte = new byte[dimensionsize];
        buf.readBytes(inputbyte);
        dimensionStack = ByteArraytoItemStack(inputbyte, ditemcount);
    }

}

From source file:matteroverdrive.network.packet.bi.PacketFirePlasmaShot.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.shot = new WeaponShot(buf);
    this.sender = buf.readInt();
    this.position = Vec3.createVectorHelper(buf.readDouble(), buf.readDouble(), buf.readDouble());
    this.direction = Vec3.createVectorHelper(buf.readFloat(), buf.readFloat(), buf.readFloat());
}

From source file:matteroverdrive.network.packet.server.PacketTeleportPlayer.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    x = buf.readDouble();
    y = buf.readDouble();
    z = buf.readDouble();
}

From source file:mca.network.PacketCodec.java

License:Open Source License

public void decode(Packet packet, ChannelHandlerContext context, ByteBuf buffer) {
    EnumPacketType type = (EnumPacketType) packet.packetType;

    try {//from w  w w . j  av a2 s.  com
        switch (type) {
        case AddAI:
            packet.arguments[0] = buffer.readInt();
            break;

        case AddBaby:
            packet.arguments[0] = buffer.readBoolean();
            break;

        case ArrangedMarriageParticles:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            break;

        case BabyInfo:
            packet.arguments[0] = readObject(buffer);
            break;

        case BroadcastKillEntity:
            packet.arguments[0] = buffer.readInt();
            break;

        case AddBabyRequest:
            packet.arguments[0] = readObject(buffer);
            packet.arguments[1] = readObject(buffer);
            break;

        case AddMarriageRequest:
            packet.arguments[0] = readObject(buffer);
            packet.arguments[1] = readObject(buffer);
            break;

        case RemoveBabyRequest:
            packet.arguments[0] = readObject(buffer);
            break;

        case RemoveMarriageRequest:
            packet.arguments[0] = readObject(buffer);
            break;

        case ClientSideCommand:
            packet.arguments[0] = readObject(buffer);
            break;

        case GiveRelationshipGift:
            packet.arguments[0] = buffer.readInt();
            break;

        case GiveAid:
            packet.arguments[0] = buffer.readInt();
            break;

        case Engagement:
            packet.arguments[0] = buffer.readInt();
            break;

        case ForceRespawn:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            packet.arguments[2] = buffer.readInt();
            packet.arguments[3] = buffer.readInt();
            break;

        case GetTombstoneText:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            packet.arguments[2] = buffer.readInt();
            break;

        case HaveBaby:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            break;

        case KillEntity:
            packet.arguments[0] = buffer.readInt();
            break;

        case MountHorse:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            break;

        case NameBaby:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readBoolean();
            break;

        case NotifyPlayer:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            break;

        case OpenGui:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readByte();
            break;

        case PlayerMarriage:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            packet.arguments[2] = buffer.readInt();
            break;

        case RemoveItem:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            packet.arguments[2] = buffer.readInt();
            packet.arguments[3] = buffer.readInt();
            break;

        case ReturnInventory:
            packet.arguments[0] = buffer.readInt();
            break;

        case SayLocalized:
            boolean hasPlayer = buffer.readBoolean();
            boolean hasEntity = buffer.readBoolean();
            boolean hasPrefix = buffer.readBoolean();
            boolean hasSuffix = buffer.readBoolean();

            final String playerName = hasPlayer ? (String) readObject(buffer) : null;
            final int entityId = hasEntity ? buffer.readInt() : -1;
            final String phraseId = (String) readObject(buffer);
            final boolean useCharacterType = buffer.readBoolean();
            final String prefix = hasPrefix ? (String) readObject(buffer) : null;
            final String suffix = hasSuffix ? (String) readObject(buffer) : null;

            packet.arguments = new Object[10];
            packet.arguments[0] = hasPlayer;
            packet.arguments[1] = hasEntity;
            packet.arguments[2] = hasPrefix;
            packet.arguments[3] = hasSuffix;
            packet.arguments[4] = playerName;
            packet.arguments[5] = entityId;
            packet.arguments[6] = phraseId;
            packet.arguments[7] = useCharacterType;
            packet.arguments[8] = prefix;
            packet.arguments[9] = suffix;
            break;

        case SetChore:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            break;

        case SetFamilyTree:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            break;

        case SetFieldValue:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            packet.arguments[2] = readObject(buffer);
            break;

        case SetInventory:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            break;

        case SetPosition:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readDouble();
            packet.arguments[2] = buffer.readDouble();
            packet.arguments[3] = buffer.readDouble();
            break;

        case SetTarget:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            break;

        case SetTombstoneText:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readInt();
            packet.arguments[2] = buffer.readInt();
            packet.arguments[3] = readObject(buffer);
            packet.arguments[4] = readObject(buffer);
            packet.arguments[5] = readObject(buffer);
            packet.arguments[6] = readObject(buffer);
            break;

        case SetWorldProperties:
            packet.arguments[0] = readObject(buffer);
            break;

        case StartTrade:
            packet.arguments[0] = buffer.readInt();
            break;

        case StopJumping:
            packet.arguments[0] = buffer.readInt();
            break;

        case SwingArm:
            packet.arguments[0] = buffer.readInt();
            break;

        case SyncEditorSettings:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            packet.arguments[2] = buffer.readBoolean();
            packet.arguments[3] = buffer.readInt();
            packet.arguments[4] = buffer.readFloat();
            packet.arguments[5] = buffer.readFloat();
            packet.arguments[6] = buffer.readFloat();
            packet.arguments[7] = buffer.readInt();
            packet.arguments[8] = readObject(buffer);
            packet.arguments[9] = readObject(buffer);
            break;

        case SyncRequest:
            packet.arguments[0] = buffer.readInt();
            break;

        case Sync:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = readObject(buffer);
            break;

        case UpdateFurnace:
            packet.arguments[0] = buffer.readInt();
            packet.arguments[1] = buffer.readBoolean();
            break;

        default:
            break;
        }
    }

    catch (Throwable e) {
        e.printStackTrace();
    }
}