Example usage for io.netty.buffer ByteBufInputStream readInt

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

Introduction

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

Prototype

@Override
    public int readInt() throws IOException 

Source Link

Usage

From source file:de.sanandrew.mods.enderstuffp.network.packet.PacketTileDataSync.java

License:Creative Commons License

@Override
public void process(ByteBufInputStream stream, ByteBuf rawData, INetHandler handler) throws IOException {
    EnderStuffPlus.proxy.syncTileData(stream.readInt(), stream.readInt(), stream.readInt(), stream);
}

From source file:de.sanandrew.mods.enderstuffp.tileentity.TileEntityBiomeDataCrystal.java

License:Creative Commons License

@Override
public void readFromStream(ByteBufInputStream stream) throws IOException {
    this.dataProgress = stream.readInt();
}

From source file:de.sanandrew.mods.enderstuffp.tileentity.TileEntityOreGenerator.java

License:Creative Commons License

@Override
public void readFromStream(ByteBufInputStream stream) throws IOException {
    this.fluxAmount = stream.readInt();
    this.fluxGenerated = stream.readInt();
    this.ticksGenRemain = stream.readInt();
}

From source file:de.sanandrew.mods.particledeco.network.packet.PacketParticleBoxSettings.java

License:Creative Commons License

@Override
public void process(ByteBufInputStream stream, ByteBuf rawData, INetHandler handler) throws IOException {
    if (handler instanceof NetHandlerPlayServer) {
        TileEntity te = ((NetHandlerPlayServer) handler).playerEntity.worldObj.getTileEntity(stream.readInt(),
                stream.readInt(), stream.readInt());
        if (te instanceof TileEntityParticleBox) {
            ((TileEntityParticleBox) te).particleData = ParticleBoxData.getDataFromByteBuf(stream);
        }/*from  w  ww  .  ja v a2s.co m*/
    }
}

From source file:de.sanandrew.mods.particledeco.util.ParticleBoxData.java

License:Creative Commons License

public static ParticleBoxData getDataFromByteBuf(ByteBufInputStream stream) throws IOException {
    return getNewData(stream.readInt(), stream.readFloat(), stream.readFloat(),
            EnumParticleType.values[stream.readInt()], EnumParticleSpread.values[stream.readInt()]);
}

From source file:de.sanandrew.mods.turretmod.client.util.ClientProxy.java

License:Creative Commons License

@Override
public void processTargetListClt(ByteBufInputStream stream) throws IOException {
    int entityId = stream.readInt();
    int listSize = stream.readInt();
    Entity e = getMinecraft().theWorld.getEntityByID(entityId);
    if (e instanceof EntityTurretBase) {
        List<Class<? extends EntityLiving>> applicableTargets = new ArrayList<>(listSize);
        for (int i = 0; i < listSize; i++) {
            String clsName = stream.readUTF();
            Class<? extends EntityLiving> entityCls = SAPUtils
                    .getCasted(EntityList.stringToClassMapping.get(clsName));
            applicableTargets.add(entityCls);
        }//from   w  ww.ja v  a 2 s. c o m

        ((EntityTurretBase) e).getTargetHandler().setTargetList(applicableTargets);
    }
}

From source file:de.sanandrew.mods.turretmod.client.util.ClientProxy.java

License:Creative Commons License

@Override
public void processUpgradeListClt(ByteBufInputStream stream) throws IOException {
    int entityId = stream.readInt();
    int listSize = stream.readInt();
    Entity e = getMinecraft().theWorld.getEntityByID(entityId);

    if (e instanceof EntityTurretBase) {
        List<TurretUpgrade> currUpgList = new ArrayList<>(listSize);
        for (int i = 0; i < listSize; i++) {
            String regName = stream.readUTF();
            currUpgList.add(TurretUpgradeRegistry.getUpgrade(regName));
        }/*ww w.  ja v a  2  s  .  c  o  m*/
        EntityTurretBase turret = (EntityTurretBase) e;
        turret.getUpgradeHandler().applyUpgradeList(turret, currUpgList);
    }
}

From source file:de.sanandrew.mods.turretmod.client.util.ClientProxy.java

License:Creative Commons License

@Override
public void processTransmitterExpTime(ByteBufInputStream stream) throws IOException {
    TileEntity tileEntity = getMinecraft().theWorld.getTileEntity(stream.readInt(), stream.readInt(),
            stream.readInt());/*w  ww.j  a v a2 s.  c  om*/
    if (tileEntity instanceof TileEntityItemTransmitter) {
        ((TileEntityItemTransmitter) tileEntity).requestTimeout = stream.readInt();
    }
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketDismantleTurret.java

License:Creative Commons License

@Override
public void process(ByteBufInputStream stream, ByteBuf rawData, INetHandler iNetHandler) throws IOException {
    if (iNetHandler instanceof NetHandlerPlayServer) {
        EntityPlayer player = ((NetHandlerPlayServer) iNetHandler).playerEntity;
        EntityTurretBase turret = (EntityTurretBase) player.worldObj.getEntityByID(stream.readInt());
        //            turret.
    }//from   w  w  w  . ja v  a 2  s  .c  om
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketEjectAllUpgrades.java

License:Creative Commons License

@Override
public void process(ByteBufInputStream stream, ByteBuf rawData, INetHandler iNetHandler) throws IOException {
    if (iNetHandler instanceof NetHandlerPlayServer) {
        EntityPlayer player = ((NetHandlerPlayServer) iNetHandler).playerEntity;
        EntityTurretBase turret = (EntityTurretBase) player.worldObj.getEntityByID(stream.readInt());

        List<TurretUpgrade> allUpgrades = turret.getUpgradeHandler().getUpgradeList();
        Iterator<TurretUpgrade> itUpgrades = allUpgrades.iterator();
        while (itUpgrades.hasNext()) {
            TurretUpgrade upgrade = itUpgrades.next();
            ItemStack stack = TmrItems.turretUpgrade.getStackWithUpgrade(upgrade, 1);
            turret.getUpgradeHandler().removeUpgrade(turret, upgrade);
            itUpgrades.remove();/*from   w w  w  .j  a v a 2  s.  c  o  m*/
            if ((stack = InventoryUtils.addStackToInventory(stack, player.inventory)) != null) {
                turret.entityDropItem(stack, 0.0F);
            }
            player.inventoryContainer.detectAndSendChanges();
        }
    }
}