// This is called client side.
 public List<ClientScreenModule> getClientScreenModules() {
   if (clientScreenModules == null) {
     needsServerData = false;
     clientScreenModules = new ArrayList<ClientScreenModule>();
     for (int i = 0; i < inventoryHelper.getCount(); i++) {
       ItemStack itemStack = inventoryHelper.getStackInSlot(i);
       if (itemStack != null && itemStack.getItem() instanceof ModuleProvider) {
         ModuleProvider moduleProvider = (ModuleProvider) itemStack.getItem();
         ClientScreenModule clientScreenModule;
         try {
           clientScreenModule = moduleProvider.getClientScreenModule().newInstance();
         } catch (InstantiationException e) {
           e.printStackTrace();
           continue;
         } catch (IllegalAccessException e) {
           e.printStackTrace();
           continue;
         }
         clientScreenModule.setupFromNBT(
             itemStack.getTagCompound(), worldObj.provider.dimensionId, xCoord, yCoord, zCoord);
         clientScreenModules.add(clientScreenModule);
         if (clientScreenModule.needsServerData()) {
           needsServerData = true;
         }
       } else {
         clientScreenModules.add(
             null); // To keep the indexing correct so that the modules correspond with there slot
                    // number.
       }
     }
   }
   return clientScreenModules;
 }
 private void writeBufferToNBT(NBTTagCompound tagCompound) {
   NBTTagList bufferTagList = new NBTTagList();
   for (int i = ScreenContainer.SLOT_MODULES; i < inventoryHelper.getCount(); i++) {
     ItemStack stack = inventoryHelper.getStackInSlot(i);
     NBTTagCompound nbtTagCompound = new NBTTagCompound();
     if (stack != null) {
       stack.writeToNBT(nbtTagCompound);
     }
     bufferTagList.appendTag(nbtTagCompound);
   }
   tagCompound.setTag("Items", bufferTagList);
 }
  // This is called server side.
  public List<ScreenModule> getScreenModules() {
    if (screenModules == null) {
      totalRfPerTick = 0;
      screenModules = new ArrayList<ScreenModule>();
      for (int i = 0; i < inventoryHelper.getCount(); i++) {
        ItemStack itemStack = inventoryHelper.getStackInSlot(i);
        if (itemStack != null && itemStack.getItem() instanceof ModuleProvider) {
          ModuleProvider moduleProvider = (ModuleProvider) itemStack.getItem();
          ScreenModule screenModule;
          try {
            screenModule = moduleProvider.getServerScreenModule().newInstance();
          } catch (InstantiationException e) {
            e.printStackTrace();
            continue;
          } catch (IllegalAccessException e) {
            e.printStackTrace();
            continue;
          }
          screenModule.setupFromNBT(
              itemStack.getTagCompound(), worldObj.provider.dimensionId, xCoord, yCoord, zCoord);
          screenModules.add(screenModule);
          totalRfPerTick += screenModule.getRfPerTick();

          if (screenModule instanceof ComputerScreenModule) {
            ComputerScreenModule computerScreenModule = (ComputerScreenModule) screenModule;
            String tag = computerScreenModule.getTag();
            if (!computerModules.containsKey(tag)) {
              computerModules.put(tag, new ArrayList<ComputerScreenModule>());
            }
            computerModules.get(tag).add(computerScreenModule);
          }
        } else {
          screenModules.add(
              null); // To keep the indexing correct so that the modules correspond with there slot
                     // number.
        }
      }
    }
    return screenModules;
  }
 @Override
 public int getSizeInventory() {
   return inventoryHelper.getCount();
 }