Example usage for com.google.common.io ByteArrayDataInput readInt

List of usage examples for com.google.common.io ByteArrayDataInput readInt

Introduction

In this page you can find the example usage for com.google.common.io ByteArrayDataInput readInt.

Prototype

@Override
    int readInt();

Source Link

Usage

From source file:nxminetilities.network.MultilightPacket.java

@Override
public void read(ByteArrayDataInput in) throws ProtocolException {
    x = in.readInt();
    y = in.readInt();/*  w ww . j a v  a  2s  . c  o m*/
    z = in.readInt();
    lightColourRed = in.readDouble();
    lightColourGreen = in.readDouble();
    lightColourBlue = in.readDouble();
    lightEnabled = in.readBoolean();
}

From source file:net.minecraftforge.common.network.packet.DimensionRegisterPacket.java

@Override
public ForgePacket consumePacket(byte[] data) {
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    dimensionId = dat.readInt();
    providerId = dat.readInt();/*  ww w.  j  av  a 2 s  . c om*/
    return this;
}

From source file:shadowmage.ancient_framework.common.network.Packet00MultiPart.java

@Override
public void readDataStream(ByteArrayDataInput data) {
    uniquePacketID = data.readInt();
    sourcePacketType = data.readInt();//  w  w  w  .j  ava2s .c o  m
    chunkNumber = data.readInt();
    totalChunks = data.readInt();
    startIndex = data.readInt();
    chunkLength = data.readInt();
    totalLength = data.readInt();
    datas = new byte[chunkLength];
    data.readFully(datas);
}

From source file:cpw.mods.fml.common.network.OpenGuiPacket.java

@Override
public FMLPacket consumePacket(byte[] data) {
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    windowId = dat.readInt();
    networkId = dat.readInt();/* w ww .  j a v  a 2  s  .c  o  m*/
    modGuiId = dat.readInt();
    x = dat.readInt();
    y = dat.readInt();
    z = dat.readInt();
    return this;
}

From source file:eplus.network.packets.GuiPacket.java

@Override
public void read(ByteArrayDataInput input) {
    this.username = input.readUTF();
    this.guiId = input.readInt();
    this.xPos = input.readInt();
    this.yPos = input.readInt();
    this.zPos = input.readInt();
}

From source file:cpw.mods.fml.common.network.ModIdentifiersPacket.java

@Override
public FMLPacket consumePacket(byte[] data) {
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    int listSize = dat.readInt();
    for (int i = 0; i < listSize; i++) {
        String modId = dat.readUTF();
        int networkId = dat.readInt();
        modIds.put(modId, networkId);/*from www. j  a  v a 2s.com*/
    }
    return this;
}

From source file:glowTools.handler.GTPacketHandler.java

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    try {/*w  w w  .ja v a 2 s .co m*/
        EntityPlayer entityPlayer = (EntityPlayer) player;
        ByteArrayDataInput in = ByteStreams.newDataInput(packet.data);
        int packetId = in.readInt();
        GTPacket gtPacket = GTPacket.constructPacket(packetId);
        gtPacket.read(in);
        gtPacket.execute(entityPlayer, entityPlayer.worldObj.isRemote ? Side.CLIENT : Side.SERVER);
    } catch (ProtocolException e) {
        if (player instanceof EntityPlayerMP) {
            ((EntityPlayerMP) player).playerNetServerHandler.kickPlayerFromServer("Protocol exception...!");
            Logger.getLogger(Reference.CHANNELNAME).warning("Player " + ((EntityPlayer) player).username
                    + " caused a Protocol Exception on a packet...!");
        }
    } catch (ReflectiveOperationException e) {
        throw new RuntimeException("Unexpected Reflection exception during Packet construction...!", e);
    }
}

From source file:unwrittenfun.minecraft.beam.handlers.PacketHandler.java

public void onRequestROffPacket(ByteArrayDataInput reader, World world) {
    int x = reader.readInt();
    int y = reader.readInt();
    int z = reader.readInt();
    TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
    if (tileEntity instanceof TEItemBeam)
        sendROffChangePacket((TEItemBeam) tileEntity);
}

From source file:unwrittenfun.minecraft.beam.handlers.PacketHandler.java

public void onROffChangePacket(ByteArrayDataInput reader, World world) {
    int x = reader.readInt();
    int y = reader.readInt();
    int z = reader.readInt();
    TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

    if (tileEntity instanceof TEItemBeam) {
        int rOffX = reader.readInt();
        int rOffY = reader.readInt();
        int rOffZ = reader.readInt();

        TEItemBeam beam = (TEItemBeam) tileEntity;
        beam.setReceiverOffset(rOffX, rOffY, rOffZ);
    }/*from  w  w w.  j a  v  a 2 s . c  o m*/
}

From source file:eb.network.packet.PacketPlaceBlock.java

@Override
public void read(ByteArrayDataInput bis) {
    super.read(bis);
    itemID = bis.readInt();
    metadata = bis.readInt();
}