Program: 30675
Project: 30675
Buggy source:
@Override public void initGui(){
  maxRows=getMaxRows();
  perRow=AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
  boolean hasNEI=AppEng.instance.isIntegrationEnabled("String_Node_Str");
  int NEI=hasNEI ? 4 : 0;
  int top=hasNEI ? 22 : 4;
  int magicNumber=114 + 1;
  int extraSpace=height - magicNumber - NEI- top- reservedSpace;
  rows=(int)Math.floor(extraSpace / 18);
  if (rows > maxRows) {
    top+=(rows - maxRows) * 18 / 2;
    rows=maxRows;
  }
  if (hasNEI)   rows--;
  if (rows < 3)   rows=3;
  meSlots.clear();
  for (int y=0; y < rows; y++) {
    for (int x=0; x < perRow; x++) {
      meSlots.add(new InternalSlotME(repo,x + y * perRow,xoffset + x * 18,18 + y * 18));
    }
  }
  if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL)   this.xSize=standardSize + ((perRow - 9) * 18);
 else   this.xSize=standardSize;
  super.initGui();
  this.ySize=magicNumber + rows * 18 + reservedSpace;
  this.guiTop=top;
  int offset=guiTop + 8;
  if (customSortOrder) {
    buttonList.add(SortByBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.SORT_BY,configSrc.getSetting(Settings.SORT_BY)));
    offset+=20;
  }
  if (viewCell || this instanceof GuiWirelessTerm) {
    buttonList.add(ViewBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.VIEW_MODE,configSrc.getSetting(Settings.VIEW_MODE)));
    offset+=20;
  }
  buttonList.add(SortDirBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.SORT_DIRECTION,configSrc.getSetting(Settings.SORT_DIRECTION)));
  offset+=20;
  buttonList.add(searchBoxSettings=new GuiImgButton(this.guiLeft - 18,offset,Settings.SEARCH_MODE,AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
  offset+=20;
  if (!(this instanceof GuiMEPortableCell)) {
    buttonList.add(terminalStyleBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.TERMINAL_STYLE,AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
  }
  searchField=new MEGuiTextField(fontRendererObj,this.guiLeft + Math.max(82,xoffset),this.guiTop + 6,89,fontRendererObj.FONT_HEIGHT);
  searchField.setEnableBackgroundDrawing(false);
  searchField.setMaxStringLength(25);
  searchField.setTextColor(0xFFFFFF);
  searchField.setVisible(true);
  Enum setting=AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
  searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
  if (isSubGui()) {
    searchField.setText(memoryText);
    repo.searchString=memoryText;
    repo.updateView();
    setScrollBar();
  }
  for (  Object s : inventorySlots.inventorySlots) {
    if (s instanceof AppEngSlot) {
      if (((AppEngSlot)s).xDisplayPosition < 197)       ((AppEngSlot)s).yDisplayPosition=((AppEngSlot)s).defY + ySize - 78 - 5;
    }
  }
}

Fixed version (ground truth):
@Override public void initGui(){
  maxRows=getMaxRows();
  perRow=AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
  boolean hasNEI=AppEng.instance.isIntegrationEnabled("String_Node_Str");
  int NEI=hasNEI ? 0 : 0;
  int top=hasNEI ? 22 : 0;
  int magicNumber=114 + 1;
  int extraSpace=height - magicNumber - NEI- top- reservedSpace;
  rows=(int)Math.floor(extraSpace / 18);
  if (rows > maxRows) {
    top+=(rows - maxRows) * 18 / 2;
    rows=maxRows;
  }
  if (hasNEI)   rows--;
  if (rows < 3)   rows=3;
  meSlots.clear();
  for (int y=0; y < rows; y++) {
    for (int x=0; x < perRow; x++) {
      meSlots.add(new InternalSlotME(repo,x + y * perRow,xoffset + x * 18,18 + y * 18));
    }
  }
  if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL)   this.xSize=standardSize + ((perRow - 9) * 18);
 else   this.xSize=standardSize;
  super.initGui();
  this.ySize=magicNumber + rows * 18 + reservedSpace;
  int unusedSpace=height - ySize;
  guiTop=(int)Math.floor((float)unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
  int offset=guiTop + 8;
  if (customSortOrder) {
    buttonList.add(SortByBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.SORT_BY,configSrc.getSetting(Settings.SORT_BY)));
    offset+=20;
  }
  if (viewCell || this instanceof GuiWirelessTerm) {
    buttonList.add(ViewBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.VIEW_MODE,configSrc.getSetting(Settings.VIEW_MODE)));
    offset+=20;
  }
  buttonList.add(SortDirBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.SORT_DIRECTION,configSrc.getSetting(Settings.SORT_DIRECTION)));
  offset+=20;
  buttonList.add(searchBoxSettings=new GuiImgButton(this.guiLeft - 18,offset,Settings.SEARCH_MODE,AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
  offset+=20;
  if (!(this instanceof GuiMEPortableCell)) {
    buttonList.add(terminalStyleBox=new GuiImgButton(this.guiLeft - 18,offset,Settings.TERMINAL_STYLE,AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
  }
  searchField=new MEGuiTextField(fontRendererObj,this.guiLeft + Math.max(82,xoffset),this.guiTop + 6,89,fontRendererObj.FONT_HEIGHT);
  searchField.setEnableBackgroundDrawing(false);
  searchField.setMaxStringLength(25);
  searchField.setTextColor(0xFFFFFF);
  searchField.setVisible(true);
  Enum setting=AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
  searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
  if (isSubGui()) {
    searchField.setText(memoryText);
    repo.searchString=memoryText;
    repo.updateView();
    setScrollBar();
  }
  for (  Object s : inventorySlots.inventorySlots) {
    if (s instanceof AppEngSlot) {
      if (((AppEngSlot)s).xDisplayPosition < 197)       repositionSlot((AppEngSlot)s);
    }
  }
}