Example usage for io.netty.buffer ByteBuf readInt

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

Introduction

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

Prototype

public abstract int readInt();

Source Link

Document

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

Usage

From source file:com.yyon.grapplinghook.network.GrappleAttachMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.id = buf.readInt();
    this.x = buf.readDouble();
    this.y = buf.readDouble();
    this.z = buf.readDouble();
    this.controlid = buf.readInt();
    this.entityid = buf.readInt();
    this.maxlen = buf.readInt();
    int blockx = buf.readInt();
    int blocky = buf.readInt();
    int blockz = buf.readInt();
    this.blockpos = new BlockPos(blockx, blocky, blockz);
}

From source file:com.yyon.grapplinghook.network.GrappleAttachPosMessage.java

License:Open Source License

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

From source file:com.yyon.grapplinghook.network.GrappleClickMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.id = buf.readInt();
    this.leftclick = buf.readBoolean();
}

From source file:com.yyon.grapplinghook.network.GrappleEndMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.entityid = buf.readInt();
    this.arrowid = buf.readInt();
}

From source file:com.yyon.grapplinghook.network.MultiHookMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.id = buf.readInt();
    this.sneaking = buf.readBoolean();
}

From source file:com.yyon.grapplinghook.network.PlayerMovementMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    try {/*w  w w  .java  2s  .  c  om*/
        this.entityId = buf.readInt();
        this.x = buf.readDouble();
        this.y = buf.readDouble();
        this.z = buf.readDouble();
        this.mx = buf.readDouble();
        this.my = buf.readDouble();
        this.mz = buf.readDouble();
    } catch (Exception e) {
        System.out.println(buf);
    }
}

From source file:com.yyon.grapplinghook.network.ToolConfigMessage.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.id = buf.readInt();
}

From source file:com.zaradai.distributor.messaging.netty.handler.MessageDecoder.java

License:Apache License

private void readHeader(ByteBuf frame) throws EncodingException {
    int header;//from w w w  . j  a  v a 2 s.c o m

    try {
        header = frame.readInt();
    } catch (Exception e) {
        throw new EncodingException("Unable to read header data", e);
    }

    if (header != Message.MAGIC_NUMBER) {
        throw new EncodingException("Invalid header");
    }
}

From source file:com.zaradai.distributor.messaging.netty.handler.MessagingHandshake.java

License:Apache License

private boolean canReadServerHeader(ByteBuf in) {
    if (serverHeaderSize == -1) {
        if (in.readableBytes() >= HEADER_INT_SIZE) {
            serverHeaderSize = in.readInt();
        } else {/*from w  ww. j  a v a 2 s .c  o  m*/
            return false;
        }
    }

    return (in.readableBytes() >= serverHeaderSize);
}

From source file:com.zaradai.distributor.messaging.netty.handler.MessagingHandshake.java

License:Apache License

private int readProtocolHeader(ByteBuf in) {
    return in.readInt();
}