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:buildcraft.core.fluids.TankManager.java

License:Minecraft Mod Public

@SideOnly(Side.CLIENT)
public void readData(ByteBuf data) {
    for (Tank tank : tanks) {
        int fluidId = data.readShort();
        if (fluidId > 0) {
            tank.setFluid(new FluidStack(fluidId, data.readInt()));
            tank.colorRenderCache = data.readInt();
        } else {/* ww w . j  av a2 s  .com*/
            tank.setFluid(null);
            tank.colorRenderCache = 0xFFFFFF;
        }
    }
}

From source file:buildcraft.core.lib.fluids.TankManager.java

License:Minecraft Mod Public

@SideOnly(Side.CLIENT)
public void readData(ByteBuf data) {
    for (Tank tank : tanks) {
        int fluidId = data.readShort();
        if (FluidRegistry.getFluid(fluidId) != null) {
            tank.setFluid(new FluidStack(FluidRegistry.getFluid(fluidId), data.readInt()));
            tank.colorRenderCache = data.readInt();
        } else {//from   w  w  w  .ja v a2 s  .co  m
            tank.setFluid(null);
            tank.colorRenderCache = 0xFFFFFF;
        }
    }
}

From source file:buildcraft.core.lib.network.base.Packet.java

License:Minecraft Mod Public

public void readData(ByteBuf data) {
    dimensionId = data.readInt();
    hasDoneByteStuff = true;
}

From source file:buildcraft.core.lib.network.command.CommandTargetEntity.java

License:Minecraft Mod Public

@Override
public ICommandReceiver handle(EntityPlayer player, ByteBuf data, World world) {
    int id = data.readInt();
    Entity entity = world.getEntityByID(id);
    if (entity != null && entity instanceof ICommandReceiver) {
        return (ICommandReceiver) entity;
    }// w  w  w.  ja v a 2s  .c o  m
    return null;
}

From source file:buildcraft.core.lib.network.command.CommandTargetTile.java

License:Minecraft Mod Public

@Override
public ICommandReceiver handle(EntityPlayer player, ByteBuf data, World world) {
    int posX = data.readInt();
    int posY = data.readShort();
    int posZ = data.readInt();
    if (world.blockExists(posX, posY, posZ)) {
        TileEntity tile = world.getTileEntity(posX, posY, posZ);
        if (tile instanceof ICommandReceiver) {
            return (ICommandReceiver) tile;
        }//from   w  w  w.  ja v a 2s .  c o m
    }
    return null;
}

From source file:buildcraft.core.lib.network.PacketCoordinates.java

License:Minecraft Mod Public

@Override
public void readData(ByteBuf data) {
    id = data.readByte();
    posX = data.readInt();
    posY = data.readShort();
    posZ = data.readInt();
}

From source file:buildcraft.core.lib.network.PacketEntityUpdate.java

License:Minecraft Mod Public

@Override
public void readIdentificationData(ByteBuf data) {
    entityId = data.readInt();
}

From source file:buildcraft.core.lib.network.PacketGuiReturn.java

License:Minecraft Mod Public

@Override
public void readData(ByteBuf data) {
    int dim = data.readInt();
    World world = DimensionManager.getWorld(dim);
    boolean tileReturn = data.readBoolean();

    if (tileReturn) {
        int x = data.readInt();
        int y = data.readInt();
        int z = data.readInt();

        TileEntity t = world.getTileEntity(x, y, z);

        if (t instanceof IGuiReturnHandler) {
            ((IGuiReturnHandler) t).readGuiData(data, sender);
        }// ww w .  j  a  va 2s. c  o m
    } else {
        int entityId = data.readInt();
        Entity entity = world.getEntityByID(entityId);

        if (entity instanceof IGuiReturnHandler) {
            ((IGuiReturnHandler) entity).readGuiData(data, sender);
        }
    }
}

From source file:buildcraft.core.lib.network.PacketTileUpdate.java

License:Minecraft Mod Public

@Override
public void readIdentificationData(ByteBuf data) {
    posX = data.readInt();
    posY = data.readShort();
    posZ = data.readInt();
}

From source file:buildcraft.core.network.PacketCoordinates.java

License:Minecraft Mod Public

@Override
public void readData(ByteBuf data) {
    id = data.readByte();
    posX = data.readInt();
    posY = data.readInt();
    posZ = data.readInt();
}