nus-yam/ex-repair huggingface dataset:
Program: 21772
Project: 21772
Buggy source:
/** 
 * Get   {@link minechem.item.journal.JournalPage}s for given names
 * @param pageNames the page names
 * @return can be an empty array
 */
public JournalPage[] getResearchPages(String[] pageNames){
  JournalPage[] pages=new JournalPage[pageNames.length];
  for (int i=0; i < pageNames.length; i++) {
    pages[i]=getResearchPage(pageNames[i]);
  }
  return ArrayHelper.removeNulls(pages,JournalPage.class);
}

Fixed version (ground truth):
/** 
 * Get   {@link minechem.item.journal.JournalPage}s for given names
 * @param pageNames the page names
 * @return can be an empty array
 */
public JournalPage[] getResearchPages(String[] pageNames){
  JournalPage[] pages=new JournalPage[pageNames.length];
  for (int i=0; i < pageNames.length; i++) {
    pages[i]=getResearchPage(pageNames[i]);
  }
  pages=ArrayHelper.removeNulls(pages,JournalPage.class);
  if (pages.length % 2 != 0) {
    JournalPage[] expandedPages=new JournalPage[pages.length + 1];
    System.arraycopy(pages,0,expandedPages,0,pages.length);
    expandedPages[pages.length]=getResearchPage("String_Node_Str");
    return expandedPages;
  }
  return pages;
}
Program: 21773
Project: 21773
Buggy source:
private void drawFoldedPages(){
  if (displayPage > 0) {
    GuiDraw.drawTexturedModalRect(5,163,0,188,21,21);
  }
  if (displayPage + 2 < pageIndex.length) {
    GuiDraw.drawTexturedModalRect(230,160,21,188,21,21);
  }
}

Fixed version (ground truth):
private void drawFoldedPages(){
  if (displayPage > 1) {
    GuiDraw.drawTexturedModalRect(5,163,0,188,21,21);
  }
  if (displayPage + 2 < pageIndex.length) {
    GuiDraw.drawTexturedModalRect(230,160,21,188,21,21);
  }
}
Program: 21774
Project: 21774
Buggy source:
/** 
 * @param c
 * @param keycode
 */
@Override protected void keyTyped(char c,int keycode){
  if (keycode == Keyboard.KEY_LEFT) {
    if (displayPage > 0) {
      displayPage--;
      if (displayPage > 0) {
        displayPage--;
      }
    }
  }
  if (keycode == Keyboard.KEY_RIGHT) {
    if (displayPage < pageIndex.length) {
      displayPage++;
      if (displayPage < pageIndex.length) {
        displayPage++;
      }
    }
  }
  loadPage(displayPage);
  super.keyTyped(c,keycode);
}

Fixed version (ground truth):
/** 
 * @param c
 * @param keycode
 */
@Override protected void keyTyped(char c,int keycode){
  if (keycode == Keyboard.KEY_LEFT) {
    if (displayPage > 0) {
      displayPage--;
      if (displayPage > 0) {
        displayPage--;
      }
    }
  }
  if (keycode == Keyboard.KEY_RIGHT) {
    if (displayPage < pageIndex.length - 1) {
      displayPage++;
      if (displayPage < pageIndex.length - 1) {
        displayPage++;
      }
    }
  }
  loadPage(displayPage);
  super.keyTyped(c,keycode);
}
Program: 21775
Project: 21775
Buggy source:
@Override public void draw(){
  super.draw();
  if (isEnabled()) {
    if (isFullyOpened()) {
      getFontRenderer().drawString(linkText,getLinkX(),getLinkY(),linkColor,true);
      if (isLinkAtOffsetPosition(gui.getMouseX(),gui.getMouseY())) {
        gui.drawTooltip(linkTextList);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void draw(){
  super.draw();
  if (isEnabled()) {
    if (isFullyOpened()) {
      getFontRenderer().drawString(linkText,getLinkX(),getLinkY(),linkColor,true);
      if (isLinkAtOffsetPosition(gui.getMouseX(),gui.getMouseY())) {
        gui.drawTooltip(linkTextList);
      }
      GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
      GL11.glDisable(GL11.GL_LIGHTING);
    }
  }
}
Program: 21776
Project: 21776
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float opacity,int mousex,int mousey){
  this.mc.renderEngine.bindTexture(Compendium.Texture.GUI.opticalMicroscope);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  drawTexturedModalRect(x,y,0,0,xSize,ySize);
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float opacity,int mousex,int mousey){
  this.mc.renderEngine.bindTexture(Compendium.Resource.GUI.opticalMicroscope);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  drawTexturedModalRect(x,y,0,0,xSize,ySize);
}
Program: 21777
Project: 21777
Buggy source:
public static ArrayList<PotionChemical> pushTogetherChemicals(ArrayList<PotionChemical> list){
  for (int i=list.size() - 1; i >= 0; i--) {
    if (list.get(i) == null) {
      continue;
    }
    for (int j=0; j < i; j++) {
      if (list.get(j) == null) {
        list.set(j,list.get(i));
        list.set(j,null);
        break;
      }
 else       if (list.get(j).sameAs(list.get(i))) {
        list.get(j).amount+=list.get(i).amount;
        list.set(i,null);
        break;
      }
    }
  }
  list.removeAll(Collections.singleton(null));
  return list;
}

Fixed version (ground truth):
public static ArrayList<PotionChemical> pushTogetherChemicals(ArrayList<PotionChemical> oldList){
  ArrayList<PotionChemical> list=new ArrayList<PotionChemical>();
  for (  PotionChemical chemical : oldList)   list.add(chemical.copy());
  for (int i=list.size() - 1; i >= 0; i--) {
    if (list.get(i) == null) {
      continue;
    }
    for (int j=0; j < i; j++) {
      if (list.get(j) == null) {
        list.set(j,list.get(i));
        list.set(j,null);
        break;
      }
 else       if (list.get(j).sameAs(list.get(i))) {
        list.get(j).amount+=list.get(i).amount;
        list.set(i,null);
        break;
      }
    }
  }
  list.removeAll(Collections.singleton(null));
  return list;
}
Program: 21779
Project: 21779
Buggy source:
public void draw(TextureManager renderEngine){
  renderEngine.bindTexture(texture);
  ToggleButton button=buttons.get(state);
  drawTexturedModalRect(x,y,button.u,button.v,width,height);
  String tooltip=MinechemUtil.getLocalString(button.tooltip);
  int cx=(container.width - container.getXSize()) / 2;
  int cy=(container.height - container.getYSize()) / 2;
  int tooltipWidth=mc.fontRenderer.getStringWidth(tooltip);
  if (isMoverOver()) {
    container.drawHoveringText(tooltip,cx + 77 - (tooltipWidth / 2),cy + 100);
  }
}

Fixed version (ground truth):
public void draw(TextureManager renderEngine){
  renderEngine.bindTexture(texture);
  ToggleButton button=buttons.get(state);
  drawTexturedModalRect(x,y,button.u,button.v,width,height);
  String tooltip=MinechemUtil.getLocalString(button.tooltip);
  int cx=(container.width - container.getXSize()) / 2;
  int cy=(container.height - container.getYSize()) / 2;
  int tooltipWidth=mc.fontRenderer.getStringWidth(tooltip);
  if (isMoverOver()) {
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    container.drawHoveringText(tooltip,cx + 77 - (tooltipWidth / 2),cy + 100);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
}
Program: 21780
Project: 21780
Buggy source:
/** 
 * Sets ghost items that will make the crafting recipe from currently selected item in chemists journal if located in that slot.
 */
public void setRecipe(SynthesisRecipe recipe){
  clearRecipeMatrix();
  if (recipe != null) {
    ItemStack[] ingredients=MinechemUtil.convertChemicalArrayIntoItemStackArray(recipe.getShapedRecipe());
    for (int i=0; i < Math.min(kRecipe.length,ingredients.length); i++) {
      inventory[kRecipe[i]]=ingredients[i];
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets ghost items that will make the crafting recipe from currently selected item in chemists journal if located in that slot.
 */
public void setRecipe(SynthesisRecipe recipe){
  clearRecipeMatrix();
  if (recipe != null) {
    ItemStack[] ingredients=MinechemUtil.convertChemicalArrayIntoItemStackArray(recipe.isShaped() ? recipe.getShapedRecipe() : recipe.getShapelessRecipe());
    for (int i=0; i < Math.min(kRecipe.length,ingredients.length); i++) {
      inventory[kRecipe[i]]=ingredients[i];
    }
  }
}
Program: 21782
Project: 21782
Buggy source:
public static void incPlayerInventory(ItemStack current,int inc,EntityPlayer player,ItemStack give){
  current.stackSize+=inc;
  if (!player.inventory.addItemStackToInventory(give)) {
    player.dropPlayerItemWithRandomChoice(give,false);
  }
}

Fixed version (ground truth):
public static void incPlayerInventory(ItemStack current,int inc,EntityPlayer player,ItemStack give){
  if (inc < 0)   current.splitStack(-inc);
 else   if (inc > 0) {
    if (current.stackSize + inc <= current.getMaxStackSize())     current.stackSize+=inc;
 else {
      int added=current.getMaxStackSize() - current.stackSize;
      current.stackSize=current.getMaxStackSize();
      ItemStack extraStack=current.copy();
      extraStack.stackSize=inc - added;
      if (!player.inventory.addItemStackToInventory(extraStack)) {
        player.dropPlayerItemWithRandomChoice(extraStack,false);
      }
    }
  }
  if (!player.inventory.addItemStackToInventory(give)) {
    player.dropPlayerItemWithRandomChoice(give,false);
  }
}
Program: 21784
Project: 21784
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    int filled=0;
    for (int i=0; i < 6; i++) {
      FluidStack fluidStack=new FluidStack(FluidRegistry.WATER,125);
      if (getMolecule(stack) != MoleculeEnum.water)       fluidStack=new FluidStack(FluidHelper.molecules.get(getMolecule(stack)),125);
      filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,false);
      if (filled > 0) {
        if (result)         ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,true);
        if (!player.capabilities.isCreativeMode)         MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
        return result;
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    int filled=0;
    for (int i=0; i < 6; i++) {
      FluidStack fluidStack=new FluidStack(FluidRegistry.WATER,125);
      if (getMolecule(stack) != MoleculeEnum.water)       fluidStack=new FluidStack(FluidHelper.molecules.get(getMolecule(stack)),125);
      filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,false);
      if (filled > 0) {
        if (result)         ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,true);
        if (!player.capabilities.isCreativeMode)         MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
        return result || stack.stackSize <= 0;
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}
Program: 21786
Project: 21786
Buggy source:
private void drawItemStack(ItemStack itemstack){
  this.zLevel=100.0F;
  renderItem.zLevel=100.0F;
  renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  renderItem.renderItemOverlayIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  this.zLevel=0.0F;
  renderItem.zLevel=0.0F;
}

Fixed version (ground truth):
private void drawItemStack(ItemStack itemstack){
  GL11.glDisable(GL11.GL_LIGHTING);
  RenderHelper.enableGUIStandardItemLighting();
  this.zLevel=100.0F;
  renderItem.zLevel=100.0F;
  renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  renderItem.renderItemOverlayIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  this.zLevel=0.0F;
  renderItem.zLevel=0.0F;
}
Program: 21787
Project: 21787
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    int filled=0;
    for (int i=0; i < 6; i++) {
      filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.molecules.get(getMolecule(stack)),125),false);
      if (filled > 0) {
        if (result)         ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.molecules.get(getMolecule(stack)),125),true);
        if (!player.capabilities.isCreativeMode)         MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
        return result;
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    int filled=0;
    for (int i=0; i < 6; i++) {
      FluidStack fluidStack=new FluidStack(FluidRegistry.WATER,125);
      if (getMolecule(stack) != MoleculeEnum.water)       fluidStack=new FluidStack(FluidHelper.molecules.get(getMolecule(stack)),125);
      filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,false);
      if (filled > 0) {
        if (result)         ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),fluidStack,true);
        if (!player.capabilities.isCreativeMode)         MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
        return result;
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}
Program: 21788
Project: 21788
Buggy source:
public SynthesisRecipe(ItemStack output,boolean shaped,int energyCost,ArrayList<PotionChemical> recipe){
  this.output=output;
  this.isShaped=shaped;
  this.energyCost=energyCost;
  if (shaped)   this.shapedRecipe=recipe.toArray(new PotionChemical[recipe.size()]);
 else   this.unshapedRecipe=recipe;
}

Fixed version (ground truth):
public SynthesisRecipe(ItemStack output,boolean shaped,int energyCost,ArrayList<PotionChemical> recipe){
  this.output=output;
  this.isShaped=shaped;
  this.energyCost=energyCost;
  if (shaped)   this.shapedRecipe=recipe.toArray(new PotionChemical[recipe.size()]);
  this.unshapedRecipe=recipe;
}
Program: 21789
Project: 21789
Buggy source:
/** 
 * Determines if there is enough power to allow the player to take the item from the output slot.
 */
public boolean hasEnoughPowerForCurrentRecipe(){
  if (this.currentRecipe != null) {
    return canAffordRecipe(this.currentRecipe);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines if there is enough power to allow the player to take the item from the output slot.
 */
public boolean hasEnoughPowerForCurrentRecipe(){
  if (!Settings.powerUseEnabled)   return true;
  if (this.currentRecipe != null) {
    return canAffordRecipe(this.currentRecipe);
  }
  return true;
}
Program: 21790
Project: 21790
Buggy source:
private boolean takeStackFromStorage(ItemStack ingredient,ItemStack[] storage){
  int ingredientAmountLeft=ingredient.stackSize;
  for (int slot=0; slot < storage.length; slot++) {
    ItemStack storageItem=storage[slot];
    if (storageItem != null && Compare.stacksAreSameKind(storageItem,ingredient)) {
      int amountToTake=Math.min(storageItem.stackSize,ingredientAmountLeft);
      ingredientAmountLeft-=amountToTake;
      storageItem.stackSize-=amountToTake;
      if (storageItem.stackSize <= 0) {
        storage[slot]=null;
      }
      if (ingredientAmountLeft <= 0) {
        break;
      }
    }
  }
  return ingredientAmountLeft == 0;
}

Fixed version (ground truth):
private boolean takeStackFromStorage(ItemStack ingredient,ItemStack[] storage){
  if (ingredient == null)   return true;
  int ingredientAmountLeft=ingredient.stackSize;
  for (int slot=0; slot < storage.length; slot++) {
    ItemStack storageItem=storage[slot];
    if (storageItem != null && Compare.stacksAreSameKind(storageItem,ingredient)) {
      int amountToTake=Math.min(storageItem.stackSize,ingredientAmountLeft);
      ingredientAmountLeft-=amountToTake;
      storageItem.stackSize-=amountToTake;
      if (storageItem.stackSize <= 0) {
        storage[slot]=null;
      }
      if (ingredientAmountLeft <= 0) {
        break;
      }
    }
  }
  return ingredientAmountLeft == 0;
}
Program: 21791
Project: 21791
Buggy source:
public void drawTexture(int x,int y,ResourceLocation resource){
  int w=16;
  int h=16;
  this.mc.getTextureManager().bindTexture(resource);
  GL11.glColor4f(1F,1F,1F,1F);
  Tessellator tessellator=Tessellator.instance;
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV(x + 0,y + h,this.zLevel,0D,1D);
  tessellator.addVertexWithUV(x + w,y + h,this.zLevel,1D,1D);
  tessellator.addVertexWithUV(x + w,y + 0,this.zLevel,1D,0D);
  tessellator.addVertexWithUV(x + 0,y + 0,this.zLevel,0D,0D);
  tessellator.draw();
}

Fixed version (ground truth):
public void drawTexture(int x,int y,ResourceLocation resource){
  int w=16;
  int h=16;
  this.mc.getTextureManager().bindTexture(resource);
  GL11.glColor4f(1F,1F,1F,1F);
  Tessellator tessellator=Tessellator.instance;
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV(x + 0,y + h,this._zLevel,0D,1D);
  tessellator.addVertexWithUV(x + w,y + h,this._zLevel,1D,1D);
  tessellator.addVertexWithUV(x + w,y + 0,this._zLevel,1D,0D);
  tessellator.addVertexWithUV(x + 0,y + 0,this._zLevel,0D,0D);
  tessellator.draw();
}
Program: 21792
Project: 21792
Buggy source:
private void drawItemStack(ItemStack itemstack){
  this.zLevel=100.0F;
  renderItem.zLevel=100.0F;
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,240 / 1.0F,240 / 1.0F);
  renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  renderItem.renderItemOverlayIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  this.zLevel=0.0F;
  renderItem.zLevel=0.0F;
}

Fixed version (ground truth):
private void drawItemStack(ItemStack itemstack){
  this.zLevel=100.0F;
  renderItem.zLevel=100.0F;
  renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  renderItem.renderItemOverlayIntoGUI(mc.fontRenderer,mc.renderEngine,itemstack,0,0);
  this.zLevel=0.0F;
  renderItem.zLevel=0.0F;
}
Program: 21793
Project: 21793
Buggy source:
private void drawSlots(int x,int y){
  GL11.glPushMatrix();
  ScissorHelper.startScissor(mc,x + 9,y + 7,140,176);
  int ypos=(int)((listHeight - 150) * scrollBar.getScrollValue());
  GL11.glTranslatef(0,-ypos,0);
  for (  GuiFakeSlot slot : itemListSlots) {
    slot.setYOffset(-ypos);
    slot.draw();
  }
  ScissorHelper.endScissor();
  GL11.glPopMatrix();
}

Fixed version (ground truth):
private void drawSlots(int x,int y){
  GL11.glPushMatrix();
  ScissorHelper.startScissor(mc,x + 9,y + 26,140,176);
  int ypos=(int)((listHeight - 150) * scrollBar.getScrollValue());
  GL11.glTranslatef(0,ypos,0);
  for (  GuiFakeSlot slot : itemListSlots) {
    slot.setYOffset(ypos);
    slot.draw();
  }
  ScissorHelper.endScissor();
  GL11.glPopMatrix();
}
Program: 21794
Project: 21794
Buggy source:
@Override public void handleMouseInput(){
  super.handleMouseInput();
  int i=Mouse.getEventX() * this.width / this.mc.displayWidth;
  int j=this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
  mouseX=i - (width - xSize) / 2;
  mouseY=j - (height - ySize) / 2;
  if (isScrollBarActive() && scrollBar.pointInScrollBar(mouseX,mouseY)) {
    scrollBar.handleMouseInput();
  }
}

Fixed version (ground truth):
@Override public void handleMouseInput(){
  super.handleMouseInput();
  int i=Mouse.getEventX() * this.width / this.mc.displayWidth;
  int j=this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
  mouseX=i - (width - xSize) / 2;
  mouseY=j - (height - ySize) / 2;
  if (isScrollBarActive()) {
    scrollBar.handleMouseInput();
  }
}
Program: 21795
Project: 21795
Buggy source:
private void drawMicroscopeOverlay(){
  zLevel=401;
  drawTexturedModalRect(eyepieceX,eyepieceY,176,0,54,54);
}

Fixed version (ground truth):
private void drawMicroscopeOverlay(){
  this.zLevel=600F;
  drawTexturedModalRect(eyepieceX,eyepieceY,176,0,54,54);
}
Program: 21796
Project: 21796
Buggy source:
private void drawUnshapedOverlay(){
  zLevel=0;
  drawTexturedModalRect(97,26,176,70,54,54);
}

Fixed version (ground truth):
private void drawUnshapedOverlay(){
  this.zLevel=0;
  drawTexturedModalRect(97,26,176,70,54,54);
}
Program: 21797
Project: 21797
Buggy source:
@Override public void renderItemAndEffectIntoGUI(FontRenderer fontRenderer,TextureManager textureManager,ItemStack itemStack,int x,int y){
  if (itemStack == null) {
    return;
  }
  Slot slot=microscopeContainer.getSlot(0);
  if (slot.getStack() != null) {
    GL11.glPushMatrix();
    setScissor(microscopeGui.eyepieceX,microscopeGui.eyepieceY,52,52);
    int renderX=microscopeGui.getGuiLeft() + slot.xDisplayPosition;
    int renderY=microscopeGui.getGuiTop() + slot.yDisplayPosition;
    GL11.glTranslatef(renderX,renderY,0.0F);
    GL11.glScalef(3.0F,3.0F,1.0F);
    GL11.glTranslatef(-renderX - 5.3F,-renderY - 5.3F,2.0F);
    super.renderItemAndEffectIntoGUI(fontRenderer,textureManager,slot.getStack(),renderX,renderY);
    stopScissor();
    GL11.glPopMatrix();
  }
  if (itemStack == inventoryPlayer.getItemStack() && microscopeGui.isMouseInMicroscope()) {
    GL11.glPushMatrix();
    setScissor(microscopeGui.eyepieceX,microscopeGui.eyepieceY,52,52);
    int renderX=x;
    int renderY=y;
    GL11.glTranslatef(renderX,renderY,0.0F);
    GL11.glScalef(3.0F,3.0F,1.0F);
    GL11.glTranslatef(-renderX - 5.3F,-renderY - 5.3F,600F);
    super.renderItemAndEffectIntoGUI(fontRenderer,textureManager,itemStack,renderX,renderY);
    stopScissor();
    GL11.glPopMatrix();
  }
}

Fixed version (ground truth):
@Override public void renderItemAndEffectIntoGUI(FontRenderer fontRenderer,TextureManager textureManager,ItemStack itemStack,int x,int y){
  if (itemStack == null) {
    return;
  }
  RenderHelper.enableGUIStandardItemLighting();
  Slot slot=microscopeContainer.getSlot(0);
  if (slot.getStack() != null) {
    GL11.glPushMatrix();
    setScissor(microscopeGui.eyepieceX,microscopeGui.eyepieceY,52,52);
    int renderX=microscopeGui.getGuiLeft() + slot.xDisplayPosition;
    int renderY=microscopeGui.getGuiTop() + slot.yDisplayPosition;
    GL11.glTranslatef(renderX,renderY,0.0F);
    GL11.glScalef(3.0F,3.0F,1.0F);
    GL11.glTranslatef(-renderX - 5.3F,-renderY - 5.3F,2.0F);
    super.renderItemAndEffectIntoGUI(fontRenderer,textureManager,slot.getStack(),renderX,renderY);
    stopScissor();
    GL11.glPopMatrix();
  }
  if (itemStack == inventoryPlayer.getItemStack() && microscopeGui.isMouseInMicroscope()) {
    GL11.glPushMatrix();
    setScissor(microscopeGui.eyepieceX,microscopeGui.eyepieceY,52,52);
    int renderX=x;
    int renderY=y;
    GL11.glTranslatef(renderX,renderY,0.0F);
    GL11.glScalef(3.0F,3.0F,1.0F);
    GL11.glTranslatef(-renderX - 5.3F,-renderY - 5.3F,540F);
    super.renderItemAndEffectIntoGUI(fontRenderer,textureManager,itemStack,renderX,renderY);
    stopScissor();
    GL11.glPopMatrix();
  }
}
Program: 21800
Project: 21800
Buggy source:
@Override public int getRenderType(){
  return super.getRenderType();
}

Fixed version (ground truth):
@Override public int getRenderType(){
  return RENDER_ID;
}
Program: 21806
Project: 21806
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemStack,World world,EntityPlayer player){
  player.setItemInUse(itemStack,getMaxItemUseDuration(itemStack));
  MovingObjectPosition movingObjectPosition=this.getMovingObjectPositionFromPlayer(world,player,false);
  if (!player.capabilities.isCreativeMode && itemStack.stackSize < 8)   MinechemUtil.scanForMoreStacks(itemStack,player);
  if (movingObjectPosition == null || (itemStack.stackSize < 8 && !player.capabilities.isCreativeMode)) {
    return itemStack;
  }
  if (movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
    int blockX=movingObjectPosition.blockX;
    int blockY=movingObjectPosition.blockY;
    int blockZ=movingObjectPosition.blockZ;
    ForgeDirection dir=ForgeDirection.getOrientation(movingObjectPosition.sideHit);
    blockX+=dir.offsetX;
    blockY+=dir.offsetY;
    blockZ+=dir.offsetZ;
    if (!player.canPlayerEdit(blockX,blockY,blockZ,movingObjectPosition.sideHit,itemStack)) {
      return itemStack;
    }
    return emptyTube(itemStack,player,world,blockX,blockY,blockZ);
  }
  return itemStack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemStack,World world,EntityPlayer player){
  player.setItemInUse(itemStack,getMaxItemUseDuration(itemStack));
  MovingObjectPosition movingObjectPosition=this.getMovingObjectPositionFromPlayer(world,player,false);
  if (movingObjectPosition == null || player.capabilities.isCreativeMode) {
    return itemStack;
  }
  if (movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
    int blockX=movingObjectPosition.blockX;
    int blockY=movingObjectPosition.blockY;
    int blockZ=movingObjectPosition.blockZ;
    ForgeDirection dir=ForgeDirection.getOrientation(movingObjectPosition.sideHit);
    blockX+=dir.offsetX;
    blockY+=dir.offsetY;
    blockZ+=dir.offsetZ;
    if (!player.canPlayerEdit(blockX,blockY,blockZ,movingObjectPosition.sideHit,itemStack)) {
      return itemStack;
    }
    return emptyTube(itemStack,player,world,blockX,blockY,blockZ);
  }
  return itemStack;
}
Program: 21809
Project: 21809
Buggy source:
@Override public ItemStack decrStackSize(int slot,int amount){
  if (slot == kJournal[0]) {
    clearRecipeMatrix();
  }
  if (this.inventory[slot] != null) {
    ItemStack itemstack;
    if (slot == kOutput[0]) {
      int toRemove=amount;
      while (toRemove > 0) {
        if (takeInputStacks()) {
          toRemove--;
        }
 else {
          if (amount == toRemove) {
            return null;
          }
 else {
            ItemStack result=getStackInSlot(slot).copy();
            result.stackSize=(amount - toRemove);
            return result;
          }
        }
      }
    }
    if (this.inventory[slot].stackSize <= amount) {
      itemstack=this.inventory[slot];
      this.inventory[slot]=null;
      return itemstack;
    }
 else {
      itemstack=this.inventory[slot].splitStack(amount);
      if (this.inventory[slot].stackSize == 0) {
        this.inventory[slot]=null;
      }
      return itemstack;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  if (slot == kJournal[0]) {
    clearRecipeMatrix();
  }
  if (this.inventory[slot] != null) {
    ItemStack itemstack;
    if (slot == kOutput[0]) {
      int toRemove=amount;
      while (toRemove > 0) {
        ItemStack result=getStackInSlot(slot).copy();
        if (takeInputStacks()) {
          toRemove-=result.stackSize;
        }
 else {
          if (amount == toRemove) {
            return null;
          }
 else {
            result.stackSize=(amount - toRemove);
            return result;
          }
        }
      }
    }
    if (this.inventory[slot].stackSize <= amount) {
      itemstack=this.inventory[slot];
      this.inventory[slot]=null;
      return itemstack;
    }
 else {
      itemstack=this.inventory[slot].splitStack(amount);
      if (this.inventory[slot].stackSize == 0) {
        this.inventory[slot]=null;
      }
      return itemstack;
    }
  }
 else {
    return null;
  }
}
Program: 21810
Project: 21810
Buggy source:
public MinechemFluidBlock(MinechemFluid fluid,Material material){
  super(fluid,material);
  setQuantaPerBlock(fluid.getQuanta());
}

Fixed version (ground truth):
public MinechemFluidBlock(MinechemFluid fluid,Material material){
  super(fluid,material);
  setQuantaPerBlock(fluid.getQuanta());
  unlocalizedName=fluid.getUnlocalizedName();
}
Program: 21811
Project: 21811
Buggy source:
public static String getLongName(ItemStack itemstack){
  int atomicNumber=itemstack.getItemDamage();
  return atomicNumber < ElementEnum.heaviestMass ? elements[atomicNumber].name() : MinechemHelper.getLocalString("String_Node_Str");
}

Fixed version (ground truth):
public static String getLongName(ItemStack itemstack){
  int atomicNumber=itemstack.getItemDamage();
  return atomicNumber < ElementEnum.heaviestMass ? MinechemHelper.getLocalString(elements[atomicNumber].getUnlocalizedName()) : MinechemHelper.getLocalString("String_Node_Str");
}
Program: 21812
Project: 21812
Buggy source:
@Override public String getItemStackDisplayName(ItemStack par1ItemStack){
  int itemDamage=par1ItemStack.getItemDamage();
  return MoleculeEnum.getById(itemDamage).name();
}

Fixed version (ground truth):
@Override public String getItemStackDisplayName(ItemStack par1ItemStack){
  int itemDamage=par1ItemStack.getItemDamage();
  return MinechemHelper.getLocalString(MoleculeEnum.getById(itemDamage).getUnlocalizedName());
}
Program: 21813
Project: 21813
Buggy source:
protected PotionEnchantmentCoated(MoleculeEnum chem,int id){
  super(id,0,EnumEnchantmentType.weapon);
  this.chemical=chem;
  this.setName(chem.name() + "String_Node_Str");
  PotionEnchantmentCoated.chemLookup.put(chem,this);
}

Fixed version (ground truth):
protected PotionEnchantmentCoated(MoleculeEnum chem,int id){
  super(id,0,EnumEnchantmentType.weapon);
  this.chemical=chem;
  this.setName(chem.getUnlocalizedName() + "String_Node_Str");
  PotionEnchantmentCoated.chemLookup.put(chem,this);
}
Program: 21814
Project: 21814
Buggy source:
private String getLongName(ItemStack stack){
  Item item=stack.getItem();
  if (item == MinechemItemsRegistration.element) {
    return ElementItem.getLongName(stack);
  }
 else   if (item == MinechemItemsRegistration.molecule) {
    return MoleculeItem.getMolecule(stack).name();
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
private String getLongName(ItemStack stack){
  Item item=stack.getItem();
  if (item == MinechemItemsRegistration.element) {
    return ElementItem.getLongName(stack);
  }
 else   if (item == MinechemItemsRegistration.molecule) {
    return MinechemHelper.getLocalString(MoleculeItem.getMolecule(stack).getUnlocalizedName());
  }
  return "String_Node_Str";
}
Program: 21815
Project: 21815
Buggy source:
public static String getChemicalName(PotionChemical potionChemical){
  if (potionChemical instanceof Element)   return ((Element)potionChemical).element.name();
 else   return ((Molecule)potionChemical).molecule.name();
}

Fixed version (ground truth):
public static String getChemicalName(PotionChemical potionChemical){
  if (potionChemical instanceof Element)   return getLocalString(((Element)potionChemical).element.name());
 else   return getLocalString(((Molecule)potionChemical).molecule.name());
}
Program: 21816
Project: 21816
Buggy source:
private void renderItemInEquipped(ItemStack itemstack,ElementEnum element,IIcon testtube,IIcon contents){
  Tessellator tessellator=Tessellator.instance;
  setColorForElement(element);
  ItemRenderer.renderItemIn2D(tessellator,contents.getMaxU(),contents.getMinV(),contents.getMinU(),contents.getMaxV(),contents.getIconWidth(),contents.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
}

Fixed version (ground truth):
private void renderItemInEquipped(ItemStack itemstack,ElementEnum element,IIcon testtube,IIcon contents){
  Tessellator tessellator=Tessellator.instance;
  setColorForElement(element);
  ItemRenderer.renderItemIn2D(tessellator,contents.getMaxU(),contents.getMinV(),contents.getMinU(),contents.getMaxV(),contents.getIconWidth(),contents.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
  ItemRenderer.renderItemIn2D(tessellator,testtube.getMaxU(),testtube.getMinV(),testtube.getMinU(),testtube.getMaxV(),testtube.getIconWidth(),testtube.getIconHeight(),0.0625F);
}
Program: 21817
Project: 21817
Buggy source:
private void renderItemInEquipped(ItemRenderType type,ItemStack itemstack,IIcon testtube,IIcon pass1,IIcon pass2){
  MoleculeEnum molecule=MoleculeItem.getMolecule(itemstack);
  Tessellator tessellator=Tessellator.instance;
  GL11.glColor3f(molecule.red,molecule.green,molecule.blue);
  ItemRenderer.renderItemIn2D(tessellator,pass1.getMaxU(),pass1.getMinV(),pass1.getMinU(),pass1.getMaxV(),pass1.getIconWidth(),pass1.getIconHeight(),0.0625F);
  GL11.glColor3f(molecule.red2,molecule.green2,molecule.blue2);
  ItemRenderer.renderItemIn2D(tessellator,pass2.getMaxU(),pass2.getMinV(),pass2.getMinU(),pass2.getMaxV(),pass2.getIconWidth(),pass2.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
  ItemRenderer.renderItemIn2D(tessellator,testtube.getMaxU(),testtube.getMinV(),testtube.getMinU(),testtube.getMaxV(),testtube.getIconWidth(),testtube.getIconHeight(),0.0625F);
}

Fixed version (ground truth):
private void renderItemInEquipped(ItemRenderType type,ItemStack itemstack,IIcon testtube,IIcon pass1,IIcon pass2){
  MoleculeEnum molecule=MoleculeItem.getMolecule(itemstack);
  Tessellator tessellator=Tessellator.instance;
  GL11.glScalef(0.7f,0.7f,0.7f);
  GL11.glColor3f(molecule.red,molecule.green,molecule.blue);
  ItemRenderer.renderItemIn2D(tessellator,pass1.getMaxU(),pass1.getMinV(),pass1.getMinU(),pass1.getMaxV(),pass1.getIconWidth(),pass1.getIconHeight(),0.0625F);
  GL11.glColor3f(molecule.red2,molecule.green2,molecule.blue2);
  ItemRenderer.renderItemIn2D(tessellator,pass2.getMaxU(),pass2.getMinV(),pass2.getMinU(),pass2.getMaxV(),pass2.getIconWidth(),pass2.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
  ItemRenderer.renderItemIn2D(tessellator,testtube.getMaxU(),testtube.getMinV(),testtube.getMinU(),testtube.getMaxV(),testtube.getIconWidth(),testtube.getIconHeight(),0.0625F);
}
Program: 21818
Project: 21818
Buggy source:
private static List<Object> toChemicalsWithAmount(Object[] chemicalsStr){
  List<Object> chemicals=new ArrayList<Object>();
  int pos=0;
  while (pos < chemicalsStr.length) {
    if (chemicalsStr[pos] instanceof Integer) {
      chemicals.add(createChemical(getChemicalType((String)chemicalsStr[pos + 1]),(Integer)chemicalsStr[pos]));
      pos+=2;
    }
 else     if (chemicalsStr[pos] instanceof String) {
      chemicals.add(createChemical(getChemicalType((String)chemicalsStr[pos + 1]),1));
      pos+=1;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return chemicals;
}

Fixed version (ground truth):
private static List<Object> toChemicalsWithAmount(Object[] chemicalsStr){
  List<Object> chemicals=new ArrayList<Object>();
  int pos=0;
  while (pos < chemicalsStr.length) {
    if (chemicalsStr[pos] instanceof Integer) {
      chemicals.add(createChemical(getChemicalType((String)chemicalsStr[pos + 1]),(Integer)chemicalsStr[pos]));
      pos+=2;
    }
 else     if (chemicalsStr[pos] instanceof String) {
      chemicals.add(createChemical(getChemicalType((String)chemicalsStr[pos]),1));
      pos+=1;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return chemicals;
}
Program: 21819
Project: 21819
Buggy source:
private void renderItemInEquipped(ItemRenderType type,ItemStack itemstack,IIcon testtube,IIcon pass1,IIcon pass2){
  MoleculeEnum molecule=MoleculeItem.getMolecule(itemstack);
  Tessellator tessellator=Tessellator.instance;
  GL11.glScalef(0.7f,0.7f,0.7f);
  GL11.glColor3f(molecule.red,molecule.green,molecule.blue);
  ItemRenderer.renderItemIn2D(tessellator,pass1.getMaxU(),pass1.getMinV(),pass1.getMinU(),pass1.getMaxV(),pass1.getIconWidth(),pass1.getIconHeight(),0.0625F);
  GL11.glColor3f(molecule.red2,molecule.green2,molecule.blue2);
  ItemRenderer.renderItemIn2D(tessellator,pass2.getMaxU(),pass2.getMinV(),pass2.getMinU(),pass2.getMaxV(),pass2.getIconWidth(),pass2.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
  ItemRenderer.renderItemIn2D(tessellator,testtube.getMaxU(),testtube.getMinV(),testtube.getMinU(),testtube.getMaxV(),testtube.getIconWidth(),testtube.getIconHeight(),0.0625F);
}

Fixed version (ground truth):
private void renderItemInEquipped(ItemRenderType type,ItemStack itemstack,IIcon testtube,IIcon pass1,IIcon pass2){
  MoleculeEnum molecule=MoleculeItem.getMolecule(itemstack);
  Tessellator tessellator=Tessellator.instance;
  GL11.glColor3f(molecule.red,molecule.green,molecule.blue);
  ItemRenderer.renderItemIn2D(tessellator,pass1.getMaxU(),pass1.getMinV(),pass1.getMinU(),pass1.getMaxV(),pass1.getIconWidth(),pass1.getIconHeight(),0.0625F);
  GL11.glColor3f(molecule.red2,molecule.green2,molecule.blue2);
  ItemRenderer.renderItemIn2D(tessellator,pass2.getMaxU(),pass2.getMinV(),pass2.getMinU(),pass2.getMaxV(),pass2.getIconWidth(),pass2.getIconHeight(),0.0625F);
  GL11.glColor3f(1.0F,1.0F,1.0F);
  ItemRenderer.renderItemIn2D(tessellator,testtube.getMaxU(),testtube.getMinV(),testtube.getMinU(),testtube.getMaxV(),testtube.getIconWidth(),testtube.getIconHeight(),0.0625F);
}
Program: 21820
Project: 21820
Buggy source:
@Override public ItemStack getOutputStack(){
  return new ItemStack(MinechemItemsRegistration.element,0,element.ordinal());
}

Fixed version (ground truth):
@Override public ItemStack getOutputStack(){
  return new ItemStack(MinechemItemsRegistration.element,1,element.ordinal());
}
Program: 21821
Project: 21821
Buggy source:
public static Vector<Vector3> findAvailableSpacesAtCrossSection(World world,int centerX,int centerY,int centerZ,int size){
  Vector<Vector3> spaces=new Vector<Vector3>();
  for (int xOffset=-size; xOffset <= size; xOffset++) {
    for (int zOffset=-size; zOffset <= size; zOffset++) {
      int x=centerX + xOffset;
      int z=centerZ + zOffset;
      if (world.isAirBlock(x,centerY,z) || !world.getBlock(x,centerY,z).getMaterial().isSolid()) {
        spaces.add(new Vector3(x,centerY,z));
      }
    }
  }
  return spaces;
}

Fixed version (ground truth):
public static List<CoordTuple> findAvailableSpacesAtCrossSection(World world,int centerX,int centerY,int centerZ,int size){
  List<CoordTuple> spaces=new ArrayList<CoordTuple>();
  for (int xOffset=-size; xOffset <= size; xOffset++) {
    for (int zOffset=-size; zOffset <= size; zOffset++) {
      int x=centerX + xOffset;
      int z=centerZ + zOffset;
      if (world.isAirBlock(x,centerY,z) || !world.getBlock(x,centerY,z).getMaterial().isSolid()) {
        spaces.add(new CoordTuple(x,centerY,z));
      }
    }
  }
  return spaces;
}
Program: 21824
Project: 21824
Buggy source:
/** 
 * The key of outputs is a chemical, the value of outputs is chance. If explosionLevel==Float.NaN, then it will not explode.
 * @param outputs
 * @param explosionLevel
 */
public ChemicalFluidReactionOutput(Map<MinechemChemicalType,Float> outputs,float explosionLevel){
  this.outputs=outputs;
  this.explosionLevel=explosionLevel;
}

Fixed version (ground truth):
/** 
 * If explosionLevel==Float.NaN, then it will not explode.
 * @param outputs
 * @param explosionLevel
 */
public ChemicalFluidReactionOutput(List<MinechemChemicalType> outputs,float explosionLevel){
  this.outputs=outputs;
  this.explosionLevel=explosionLevel;
}
Program: 21825
Project: 21825
Buggy source:
public List<ItemStack> getStorageInventory(){
  if (Settings.decaySafeMachines) {
    return new ArrayList<ItemStack>();
  }
 else {
    List<ItemStack> storageInventory=new ArrayList<ItemStack>();
    for (int slot=0; slot < 27; slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        storageInventory.add(stack);
      }
    }
    return storageInventory;
  }
}

Fixed version (ground truth):
@Override public List<ItemStack> getStorageInventory(){
  if (Settings.decaySafeMachines) {
    return new ArrayList<ItemStack>();
  }
 else {
    List<ItemStack> storageInventory=new ArrayList<ItemStack>();
    for (int slot=0; slot < 27; slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        storageInventory.add(stack);
      }
    }
    return storageInventory;
  }
}
Program: 21826
Project: 21826
Buggy source:
public List<ItemStack> getPlayerInventory(){
  if (Settings.decaySafeMachines) {
    List<ItemStack> inv=new ArrayList<ItemStack>();
    for (int slot=0; slot < this.inventorySlots.size(); slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        inv.add(stack);
      }
    }
    return inv;
  }
 else {
    List<ItemStack> playerInventory=new ArrayList<ItemStack>();
    for (int slot=27; slot < this.inventorySlots.size(); slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        playerInventory.add(stack);
      }
    }
    return playerInventory;
  }
}

Fixed version (ground truth):
@Override public List<ItemStack> getPlayerInventory(){
  if (Settings.decaySafeMachines) {
    List<ItemStack> inv=new ArrayList<ItemStack>();
    for (int slot=0; slot < this.inventorySlots.size(); slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        inv.add(stack);
      }
    }
    return inv;
  }
 else {
    List<ItemStack> playerInventory=new ArrayList<ItemStack>();
    for (int slot=27; slot < this.inventorySlots.size(); slot++) {
      ItemStack stack=getSlot(slot).getStack();
      if (stack != null) {
        playerInventory.add(stack);
      }
    }
    return playerInventory;
  }
}
Program: 21827
Project: 21827
Buggy source:
public List<ItemStack> getStorageInventory(){
  List<ItemStack> storageInventory=new ArrayList<ItemStack>();
  for (int slot=0; slot < 27; slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      storageInventory.add(stack);
    }
  }
  return storageInventory;
}

Fixed version (ground truth):
@Override public List<ItemStack> getStorageInventory(){
  List<ItemStack> storageInventory=new ArrayList<ItemStack>();
  for (int slot=0; slot < 27; slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      storageInventory.add(stack);
    }
  }
  return storageInventory;
}
Program: 21828
Project: 21828
Buggy source:
public List<ItemStack> getPlayerInventory(){
  List<ItemStack> playerInventory=new ArrayList<ItemStack>();
  for (int slot=27; slot < this.inventorySlots.size(); slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      playerInventory.add(stack);
    }
  }
  return playerInventory;
}

Fixed version (ground truth):
@Override public List<ItemStack> getPlayerInventory(){
  List<ItemStack> playerInventory=new ArrayList<ItemStack>();
  for (int slot=27; slot < this.inventorySlots.size(); slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      playerInventory.add(stack);
    }
  }
  return playerInventory;
}
Program: 21829
Project: 21829
Buggy source:
public List<ItemStack> getPlayerInventory(){
  List<ItemStack> playerInventory=new ArrayList<ItemStack>();
  for (int slot=27; slot < this.inventorySlots.size(); slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      playerInventory.add(stack);
    }
  }
  return playerInventory;
}

Fixed version (ground truth):
@Override public List<ItemStack> getPlayerInventory(){
  List<ItemStack> playerInventory=new ArrayList<ItemStack>();
  for (int slot=27; slot < this.inventorySlots.size(); slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      playerInventory.add(stack);
    }
  }
  return playerInventory;
}
Program: 21830
Project: 21830
Buggy source:
public List<ItemStack> getStorageInventory(){
  List<ItemStack> storageInventory=new ArrayList<ItemStack>();
  for (int slot=0; slot < 27; slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      storageInventory.add(stack);
    }
  }
  return storageInventory;
}

Fixed version (ground truth):
@Override public List<ItemStack> getStorageInventory(){
  List<ItemStack> storageInventory=new ArrayList<ItemStack>();
  for (int slot=0; slot < 27; slot++) {
    ItemStack stack=getSlot(slot).getStack();
    if (stack != null) {
      storageInventory.add(stack);
    }
  }
  return storageInventory;
}
Program: 21831
Project: 21831
Buggy source:
@Override public IMessage onMessage(ChemistJournalActiveItemMessage message,MessageContext ctx){
  ItemStack journal=ctx.getServerHandler().playerEntity.inventory.mainInventory[this.slot];
  if (journal != null && journal.getItem() == MinechemItemsRegistration.journal) {
    ItemStack activeStack=new ItemStack(Item.getItemById(message.itemID),1,message.itemDMG);
    MinechemItemsRegistration.journal.setActiveStack(activeStack,journal);
  }
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(ChemistJournalActiveItemMessage message,MessageContext ctx){
  ItemStack journal=ctx.getServerHandler().playerEntity.inventory.mainInventory[message.slot];
  if (journal != null && journal.getItem() == MinechemItemsRegistration.journal) {
    ItemStack activeStack=new ItemStack(Item.getItemById(message.itemID),1,message.itemDMG);
    MinechemItemsRegistration.journal.setActiveStack(activeStack,journal);
  }
  return null;
}
Program: 21832
Project: 21832
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (!completeStructure) {
    return;
  }
  if (!worldObj.isRemote && worldObj.getTotalWorldTime() % 50 == 0 && energyUpdateTracker.markTimeIfDelay(worldObj,Constants.TICKS_PER_SECOND * 2)) {
    if (inventory[kStartInput] != null) {
      ItemStack fissionResult=getFissionOutput();
      if (inventory[kOutput[0]] == null || (inventory[kOutput[0]].stackSize < 64 && fissionResult != null && fissionResult.getItem() == inventory[kOutput[0]].getItem() && fissionResult.getItemDamage() == inventory[kOutput[0]].getItemDamage() && !worldObj.isRemote)) {
        if (useEnergy(getEnergyNeeded())) {
          addToOutput(fissionResult);
          removeInputs();
        }
      }
      fissionResult=getFissionOutput();
    }
  }
  if (!worldObj.isRemote) {
    FissionUpdateMessage message=new FissionUpdateMessage(this);
    MessageHandler.INSTANCE.sendToAllAround(message,new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId,this.xCoord,this.yCoord,this.zCoord,Settings.UpdateRadius));
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!completeStructure) {
    return;
  }
  if (!worldObj.isRemote) {
    if (inventory[kStartInput] != null) {
      ItemStack fissionResult=getFissionOutput();
      if (fissionResult != null && (inventory[kOutput[0]] == null || (inventory[kOutput[0]].stackSize < 64 && fissionResult.getItem() == inventory[kOutput[0]].getItem() && fissionResult.getItemDamage() == inventory[kOutput[0]].getItemDamage()))) {
        if (useEnergy(getEnergyNeeded())) {
          addToOutput(fissionResult);
          removeInputs();
        }
      }
    }
    FissionUpdateMessage message=new FissionUpdateMessage(this);
    MessageHandler.INSTANCE.sendToAllAround(message,new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId,this.xCoord,this.yCoord,this.zCoord,Settings.UpdateRadius));
  }
}
Program: 21833
Project: 21833
Buggy source:
private ItemStack getFissionOutput(){
  if (hasInputs()) {
    int mass=inventory[kInput[0]].getItemDamage() + 1;
    int newMass=mass / 2;
    if (newMass > 1) {
      return new ItemStack(MinechemItemsRegistration.element,2,newMass - 1);
    }
 else {
      return null;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private ItemStack getFissionOutput(){
  if (hasInputs()) {
    int mass=inventory[kInput[0]].getItemDamage() + 1;
    int newMass=mass / 2;
    if (newMass > 0) {
      return new ItemStack(MinechemItemsRegistration.element,2,newMass - 1);
    }
 else {
      return null;
    }
  }
 else {
    return null;
  }
}