nus-yam/ex-repair huggingface dataset:
Program: 80725
Project: 80725
Buggy source:
public void outputEnergy(){
  for (  EnumFacing facing : EnumFacing.values()) {
    if (currentStorage > 0) {
      TileEntity entity=worldObj.getTileEntity(pos.offset(facing));
      if (entity != null) {
        if (entity.hasCapability(CapabilityEnergy.ENERGY,facing.getOpposite())) {
          IEnergyStorage energy=entity.getCapability(CapabilityEnergy.ENERGY,facing);
          if (energy.canReceive()) {
            int giveAmount=energy.receiveEnergy(currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
 else         if (entity instanceof IEnergyReceiver) {
          IEnergyReceiver energy=(IEnergyReceiver)entity;
          if (energy.canConnectEnergy(facing.getOpposite())) {
            int giveAmount=energy.receiveEnergy(facing.getOpposite(),currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void outputEnergy(){
  for (  EnumFacing facing : EnumFacing.values()) {
    if (currentStorage > 0) {
      TileEntity entity=worldObj.getTileEntity(pos.offset(facing));
      if (entity != null) {
        if (entity.hasCapability(CapabilityEnergy.ENERGY,facing.getOpposite())) {
          IEnergyStorage energy=entity.getCapability(CapabilityEnergy.ENERGY,facing.getOpposite());
          if (energy.canReceive()) {
            int giveAmount=energy.receiveEnergy(currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
 else         if (entity instanceof IEnergyReceiver) {
          IEnergyReceiver energy=(IEnergyReceiver)entity;
          if (energy.canConnectEnergy(facing.getOpposite())) {
            int giveAmount=energy.receiveEnergy(facing.getOpposite(),currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
      }
    }
  }
}
Program: 80726
Project: 80726
Buggy source:
public void outputEnergy(){
  for (  EnumFacing facing : EnumFacing.values()) {
    if (currentStorage > 0) {
      TileEntity entity=worldObj.getTileEntity(pos.offset(facing));
      if (entity != null) {
        if (entity.hasCapability(CapabilityEnergy.ENERGY,facing.getOpposite())) {
          IEnergyStorage energy=entity.getCapability(CapabilityEnergy.ENERGY,facing);
          if (energy.canReceive()) {
            int giveAmount=energy.receiveEnergy(currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
 else         if (entity instanceof IEnergyReceiver) {
          IEnergyReceiver energy=(IEnergyReceiver)entity;
          if (energy.canConnectEnergy(facing.getOpposite())) {
            int giveAmount=energy.receiveEnergy(facing.getOpposite(),currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void outputEnergy(){
  for (  EnumFacing facing : EnumFacing.values()) {
    if (currentStorage > 0) {
      TileEntity entity=worldObj.getTileEntity(pos.offset(facing));
      if (entity != null) {
        if (entity.hasCapability(CapabilityEnergy.ENERGY,facing.getOpposite())) {
          IEnergyStorage energy=entity.getCapability(CapabilityEnergy.ENERGY,facing.getOpposite());
          if (energy.canReceive()) {
            int giveAmount=energy.receiveEnergy(currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
 else         if (entity instanceof IEnergyReceiver) {
          IEnergyReceiver energy=(IEnergyReceiver)entity;
          if (energy.canConnectEnergy(facing.getOpposite())) {
            int giveAmount=energy.receiveEnergy(facing.getOpposite(),currentStorage,false);
            if (giveAmount > 0) {
              changeCharge(giveAmount * -1);
            }
          }
        }
      }
    }
  }
}
Program: 80727
Project: 80727
Buggy source:
public static int getLevel(ItemStack itemStack){
  if (itemStack.getItem() instanceof ItemTool) {
    return ((ItemTool)itemStack.getItem()).getToolMaterial().getHarvestLevel();
  }
 else   if ((itemStack.getItem() instanceof ItemSword) || (itemStack.getItem() instanceof ItemHoe)) {
    String material="String_Node_Str";
    if (itemStack.getItem() instanceof ItemSword)     material=((ItemSword)itemStack.getItem()).getToolMaterialName();
 else     if (itemStack.getItem() instanceof ItemHoe)     material=((ItemHoe)itemStack.getItem()).getMaterialName();
    if (material.equals("String_Node_Str"))     return LEVEL_WOOD;
 else     if (material.equals("String_Node_Str"))     return LEVEL_STONE;
 else     if (material.equals("String_Node_Str"))     return LEVEL_IRON;
 else     if (material.equals("String_Node_Str"))     return LEVEL_GOLD;
 else     if (material.equals("String_Node_Str"))     return LEVEL_DIAMOND;
  }
 else {
    if (itemStack.hasTagCompound()) {
      return tinkersLevel(itemStack);
    }
  }
  return -1;
}

Fixed version (ground truth):
public static int getLevel(ItemStack itemStack){
  if (itemStack.getItem() instanceof ItemTool) {
    return ((ItemTool)itemStack.getItem()).getToolMaterial().getHarvestLevel();
  }
 else   if ((itemStack.getItem() instanceof ItemSword) || (itemStack.getItem() instanceof ItemHoe)) {
    String material="String_Node_Str";
    if (itemStack.getItem() instanceof ItemSword)     material=((ItemSword)itemStack.getItem()).getToolMaterialName();
 else     if (itemStack.getItem() instanceof ItemHoe)     material=((ItemHoe)itemStack.getItem()).getMaterialName();
    if (material.equals("String_Node_Str"))     return LEVEL_WOOD;
 else     if (material.equals("String_Node_Str"))     return LEVEL_STONE;
 else     if (material.equals("String_Node_Str"))     return LEVEL_IRON;
 else     if (material.equals("String_Node_Str"))     return LEVEL_GOLD;
 else     if (material.equals("String_Node_Str"))     return LEVEL_DIAMOND;
 else     if (material.equals("String_Node_Str"))     return LEVEL_DIAMOND;
  }
 else {
    if (itemStack.hasTagCompound()) {
      return tinkersLevel(itemStack);
    }
  }
  return -1;
}
Program: 80729
Project: 80729
Buggy source:
public void checkInventory(){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return;
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      int moveTo=extraSlotCheck(slots[i]);
      if (moveTo >= 0) {
        slots[i]=moveItemToSlot(slots[i],moveTo);
      }
    }
  }
  for (  EnumFacing facing : EnumFacing.values()) {
    if (sides[facing.ordinal()] == WrenchModes.Mode.Output) {
      if (worldObj.getTileEntity(pos.offset(facing)) instanceof ISidedInventory) {
        ISidedInventory externalInv=(ISidedInventory)worldObj.getTileEntity(pos.offset(facing));
        for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
          if (slots[i] != null) {
            addtoSidedExtInventory(externalInv,i);
          }
        }
      }
 else       if (worldObj.getTileEntity(pos.offset(facing)) instanceof IInventory) {
        IInventory externalInv=(IInventory)worldObj.getTileEntity(pos.offset(facing));
        for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
          if (slots[i] != null) {
            addtoExtInventory(externalInv,i);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void checkInventory(){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return;
  boolean openSlots=false;
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      int moveTo=extraSlotCheck(slots[i]);
      if (moveTo >= 0) {
        slots[i]=moveItemToSlot(slots[i],moveTo);
      }
    }
    if (slots[i] == null && !openSlots) {
      openSlots=true;
    }
  }
  for (  EnumFacing facing : EnumFacing.values()) {
    if (sides[facing.ordinal()] == WrenchModes.Mode.Output) {
      if (worldObj.getTileEntity(pos.offset(facing)) instanceof ISidedInventory) {
        ISidedInventory externalInv=(ISidedInventory)worldObj.getTileEntity(pos.offset(facing));
        for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
          if (slots[i] != null && addtoSidedExtInventory(externalInv,i)) {
            openSlots=true;
          }
        }
      }
 else       if (worldObj.getTileEntity(pos.offset(facing)) instanceof IInventory) {
        IInventory externalInv=(IInventory)worldObj.getTileEntity(pos.offset(facing));
        for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
          if (slots[i] != null && addtoExtInventory(externalInv,i)) {
            openSlots=true;
          }
        }
      }
    }
  }
  setInventoryFull(!openSlots);
}
Program: 80730
Project: 80730
Buggy source:
public boolean addToInventory(ItemStack item){
  if (item == null)   return false;
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  int extraSlot=extraSlotCheck(item);
  if (extraSlot >= 0) {
    item=moveItemToSlot(item,extraSlot);
  }
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      if (item != null) {
        if ((slots[i].isItemEqual(item)) && (slots[i].stackSize < slots[i].getMaxStackSize()) && (ItemStack.areItemStackTagsEqual(item,slots[i]))) {
          int avail=slots[i].getMaxStackSize() - slots[i].stackSize;
          if (avail >= item.stackSize) {
            slots[i].stackSize+=item.stackSize;
            item=null;
            return true;
          }
 else {
            item.stackSize-=avail;
            slots[i].stackSize+=avail;
          }
        }
      }
    }
  }
  if ((item != null) && (item.stackSize > 0)) {
    for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
      if (slots[i] == null) {
        if (this.isItemValidForSlot(i,item,true)) {
          slots[i]=item;
          item=null;
          return true;
        }
      }
    }
  }
  if ((item != null) && (item.stackSize == 0)) {
    item=null;
  }
  if (item != null) {
    dropItem(item);
    item=null;
  }
  return false;
}

Fixed version (ground truth):
public boolean addToInventory(ItemStack item){
  if (item == null)   return false;
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  int extraSlot=extraSlotCheck(item);
  if (extraSlot >= 0) {
    item=moveItemToSlot(item,extraSlot);
    if (item == null)     return true;
  }
  int emptySlot=-1;
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] == null) {
      if (emptySlot == -1 && this.isItemValidForSlot(i,item,true)) {
        emptySlot=i;
        setInventoryFull(false);
      }
      continue;
    }
    if (item == null || item.stackSize == 0) {
      continue;
    }
    if (slots[i].isItemEqual(item) && slots[i].stackSize < slots[i].getMaxStackSize() && ItemStack.areItemStackTagsEqual(item,slots[i])) {
      int avail=slots[i].getMaxStackSize() - slots[i].stackSize;
      if (avail >= item.stackSize) {
        slots[i].stackSize+=item.stackSize;
        item.stackSize=0;
        item=null;
      }
 else {
        item.stackSize-=avail;
        slots[i].stackSize+=avail;
      }
    }
  }
  if (emptySlot == -1)   setInventoryFull(true);
  if (item == null || item.stackSize == 0) {
    item=null;
    return true;
  }
  if (emptySlot != -1) {
    slots[emptySlot]=item;
    item=null;
    return true;
  }
  if (item != null) {
    if (PAConfig.allowInventoryOverflow)     dropItem(item);
    item=null;
  }
  return false;
}
Program: 80731
Project: 80731
Buggy source:
public boolean roomInInventory(ItemStack item){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  if (item == null)   return false;
  int stackSize=item.stackSize;
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      if ((slots[i].isItemEqual(item)) && (slots[i].stackSize < slots[i].getMaxStackSize()) && (ItemStack.areItemStackTagsEqual(item,slots[i]))) {
        int avail=slots[i].getMaxStackSize() - slots[i].stackSize;
        if (avail >= stackSize) {
          return true;
        }
 else {
          stackSize-=avail;
        }
      }
    }
  }
  if ((item != null) && (stackSize > 0)) {
    for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
      if (slots[i] == null) {
        return true;
      }
    }
  }
  if (stackSize == 0) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean roomInInventory(ItemStack item){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  if (item == null)   return false;
  int stackSize=item.stackSize;
  boolean hasRoom=false;
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] == null) {
      hasRoom=true;
      setInventoryFull(false);
    }
 else     if (stackSize > 0 && slots[i].isItemEqual(item) && (ItemStack.areItemStackTagsEqual(item,slots[i]))) {
      stackSize=Math.max(stackSize - (slots[i].getMaxStackSize() - slots[i].stackSize),0);
    }
    if (hasRoom || stackSize == 0)     return true;
  }
  setInventoryFull(true);
  return false;
}
Program: 80733
Project: 80733
Buggy source:
@Override public void clear(){
  for (int i=0; i < this.slots.length; ++i) {
    this.slots[i]=null;
  }
}

Fixed version (ground truth):
@Override public void clear(){
  for (int i=0; i < this.slots.length; ++i) {
    this.slots[i]=null;
  }
  setInventoryFull(false);
}
Program: 80734
Project: 80734
Buggy source:
/** 
 * This overridable method is intended for reading from NBT all data that is both saved to hdd and can be sent to the client TileEntity through S35PacketUpdateTileEntity and PartialTileNBTUpdateMessage. WARNING: Please check if the tag exists before reading it. Due to the nature of  PartialTileNBTUpdateMessage properties that didn't change since the last message will not be included. WARNING: Do not include slot contents here.  They are automagically synced when a GUI is opened using S30PacketWindowItems 
 * @param nbt
 */
public void readCommonNBT(NBTTagCompound nbt){
  if (nbt.hasKey("String_Node_Str"))   progress=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   burnLevel=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   firstLook=nbt.getBoolean("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   facing=EnumFacing.getFront(nbt.getInteger("String_Node_Str"));
  if (nbt.hasKey("String_Node_Str")) {
    int ary[]=nbt.getIntArray("String_Node_Str");
    for (int i=0; i < 6; i++) {
      sides[i]=WrenchModes.modes.get(ary[i]);
    }
  }
}

Fixed version (ground truth):
/** 
 * This overridable method is intended for reading from NBT all data that is both saved to hdd and can be sent to the client TileEntity through S35PacketUpdateTileEntity and PartialTileNBTUpdateMessage. WARNING: Please check if the tag exists before reading it. Due to the nature of  PartialTileNBTUpdateMessage properties that didn't change since the last message will not be included. WARNING: Do not include slot contents here.  They are automagically synced when a GUI is opened using S30PacketWindowItems 
 * @param nbt
 */
public void readCommonNBT(NBTTagCompound nbt){
  if (nbt.hasKey("String_Node_Str"))   progress=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   burnLevel=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   inventoryFull=nbt.getBoolean("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   firstLook=nbt.getBoolean("String_Node_Str");
  if (nbt.hasKey("String_Node_Str"))   facing=EnumFacing.getFront(nbt.getInteger("String_Node_Str"));
  if (nbt.hasKey("String_Node_Str")) {
    int ary[]=nbt.getIntArray("String_Node_Str");
    for (int i=0; i < 6; i++) {
      sides[i]=WrenchModes.modes.get(ary[i]);
    }
  }
}
Program: 80735
Project: 80735
Buggy source:
/** 
 * This overridable method is intended for writing to NBT all data that is both saved to hdd and can be sent to the client TileEntity through S35PacketUpdateTileEntity. WARNING: Do not include slot contents here.  They are automagically synced when a GUI is opened using S30PacketWindowItems 
 * @param nbt
 */
public void writeCommonNBT(NBTTagCompound nbt){
  nbt.setInteger("String_Node_Str",progress);
  nbt.setInteger("String_Node_Str",burnLevel);
  nbt.setBoolean("String_Node_Str",firstLook);
  nbt.setInteger("String_Node_Str",facing.ordinal());
  int ary[]=new int[6];
  for (int i=0; i < 6; i++) {
    ary[i]=sides[i].ordinal();
  }
  nbt.setIntArray("String_Node_Str",ary);
  ary=null;
}

Fixed version (ground truth):
/** 
 * This overridable method is intended for writing to NBT all data that is both saved to hdd and can be sent to the client TileEntity through S35PacketUpdateTileEntity. WARNING: Do not include slot contents here.  They are automagically synced when a GUI is opened using S30PacketWindowItems 
 * @param nbt
 */
public void writeCommonNBT(NBTTagCompound nbt){
  nbt.setInteger("String_Node_Str",progress);
  nbt.setInteger("String_Node_Str",burnLevel);
  nbt.setBoolean("String_Node_Str",inventoryFull);
  nbt.setBoolean("String_Node_Str",firstLook);
  nbt.setInteger("String_Node_Str",facing.ordinal());
  int ary[]=new int[6];
  for (int i=0; i < 6; i++) {
    ary[i]=sides[i].ordinal();
  }
  nbt.setIntArray("String_Node_Str",ary);
  ary=null;
}
Program: 80736
Project: 80736
Buggy source:
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkForChanges();
    checkInventory();
    if (isBurning()) {
      if (chopping && blockList.size() == 0) {
        chopping=false;
        addPartialUpdate("String_Node_Str",false);
      }
      if (blockList.size() > 0) {
        cutTree();
      }
 else       if (plantSapling) {
        plantSaplings(searchBlock,true);
        plantSapling=false;
        addPartialUpdate("String_Node_Str",false);
      }
      scanBlocks();
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkForChanges();
    checkInventory();
    if (isFull())     return;
    if (isBurning()) {
      if (chopping && blockList.size() == 0) {
        chopping=false;
        addPartialUpdate("String_Node_Str",false);
      }
      if (blockList.size() > 0) {
        cutTree();
      }
 else       if (plantSapling) {
        plantSaplings(searchBlock,true);
        plantSapling=false;
        addPartialUpdate("String_Node_Str",false);
      }
      scanBlocks();
    }
  }
}
Program: 80737
Project: 80737
Buggy source:
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    doPickup();
    checkInventory();
    if (isBurning()) {
      if (currentTime > 0) {
        currentTime--;
      }
 else {
        if (searchBlock > -1) {
          initFaker();
          EntityAnimal animal=findAnimalToFeed(searchBlock);
          if (animal != null)           feedAnimal(animal);
 else {
            animal=findAnimalToShear(searchBlock);
            if (animal != null)             shearAnimal(animal);
 else {
              animal=findAnimalToMilk(searchBlock);
              if (animal != null)               milkAnimal(animal);
 else {
                searchBlock=-1;
                addPartialUpdate("String_Node_Str",searchBlock);
              }
            }
          }
        }
 else {
          doSearch();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    doPickup();
    checkInventory();
    if (isFull())     return;
    if (isBurning()) {
      if (currentTime > 0) {
        currentTime--;
      }
 else {
        if (searchBlock > -1) {
          initFaker();
          EntityAnimal animal=findAnimalToFeed(searchBlock);
          if (animal != null)           feedAnimal(animal);
 else {
            animal=findAnimalToShear(searchBlock);
            if (animal != null)             shearAnimal(animal);
 else {
              animal=findAnimalToMilk(searchBlock);
              if (animal != null)               milkAnimal(animal);
 else {
                searchBlock=-1;
                addPartialUpdate("String_Node_Str",searchBlock);
              }
            }
          }
        }
 else {
          doSearch();
        }
      }
    }
  }
}
Program: 80739
Project: 80739
Buggy source:
public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkForChanges();
    checkInventory();
    if (isBurning()) {
      useCobbleGen();
      if (!isDone()) {
        mine();
      }
    }
  }
}

Fixed version (ground truth):
public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkForChanges();
    checkInventory();
    if (isFull())     return;
    if (isBurning()) {
      useCobbleGen();
      if (!isDone()) {
        mine();
      }
    }
  }
}
Program: 80740
Project: 80740
Buggy source:
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkInventory();
    if (isBurning()) {
      if (searchBlock > -1) {
        if (currentTime > 0) {
          if (checkPlant(searchBlock)) {
            currentTime--;
            if (currentTime <= 0) {
              harvestPlant(searchBlock);
              searchBlock=-1;
              addPartialUpdate("String_Node_Str",searchBlock);
            }
          }
 else {
            currentTime=0;
            searchBlock=-1;
            addPartialUpdate("String_Node_Str",searchBlock);
          }
          addPartialUpdate("String_Node_Str",currentTime);
        }
 else         if (plantSeed(searchBlock,true)) {
          searchBlock=-1;
          addPartialUpdate("String_Node_Str",searchBlock);
        }
 else {
          if (checkPlant(searchBlock)) {
            currentTime=harvestTime;
            addPartialUpdate("String_Node_Str",currentTime);
          }
        }
      }
 else {
        doSearch();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    checkInventory();
    if (isFull())     return;
    if (isBurning()) {
      if (searchBlock > -1) {
        if (currentTime > 0) {
          if (checkPlant(searchBlock)) {
            currentTime--;
            if (currentTime <= 0) {
              harvestPlant(searchBlock);
              searchBlock=-1;
              addPartialUpdate("String_Node_Str",searchBlock);
            }
          }
 else {
            currentTime=0;
            searchBlock=-1;
            addPartialUpdate("String_Node_Str",searchBlock);
          }
          addPartialUpdate("String_Node_Str",currentTime);
        }
 else         if (plantSeed(searchBlock,true)) {
          searchBlock=-1;
          addPartialUpdate("String_Node_Str",searchBlock);
        }
 else {
          if (checkPlant(searchBlock)) {
            currentTime=harvestTime;
            addPartialUpdate("String_Node_Str",currentTime);
          }
        }
      }
 else {
        doSearch();
      }
    }
  }
}
Program: 80746
Project: 80746
Buggy source:
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_AXE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_AXE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_AXE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Items.WOODEN_AXE});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_AXE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_AXE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_AXE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Items.WOODEN_AXE});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80747
Project: 80747
Buggy source:
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Blocks.CRAFTING_TABLE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Blocks.CRAFTING_TABLE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Blocks.CRAFTING_TABLE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Blocks.CRAFTING_TABLE});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Blocks.CRAFTING_TABLE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Blocks.CRAFTING_TABLE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Blocks.CRAFTING_TABLE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Blocks.CRAFTING_TABLE});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80748
Project: 80748
Buggy source:
@Override public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.SHEARS});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.SHEARS,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.SHEARS});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Items.SHEARS});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
@Override public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.SHEARS});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.SHEARS,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.SHEARS});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Items.SHEARS});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80749
Project: 80749
Buggy source:
@Override public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_SWORD});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_SWORD,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_SWORD});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Items.WOODEN_SWORD});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
@Override public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_SWORD});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_SWORD,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_SWORD});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Items.WOODEN_SWORD});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80750
Project: 80750
Buggy source:
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_PICKAXE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_PICKAXE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_PICKAXE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Items.WOODEN_PICKAXE});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_PICKAXE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_PICKAXE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_PICKAXE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Items.WOODEN_PICKAXE});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80751
Project: 80751
Buggy source:
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_HOE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_HOE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_HOE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',Blocks.CHEST,'p',Items.WOODEN_HOE});
  }
  GameRegistry.addRecipe(recipe);
}

Fixed version (ground truth):
public void addRecipe(Block previousTier){
  ShapedOreRecipe recipe=null;
  if (blockLevel == ToolHelper.LEVEL_STONE) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Blocks.STONE,'c',previousTier,'p',Items.STONE_HOE});
  }
 else   if (blockLevel == ToolHelper.LEVEL_IRON) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.IRON_INGOT,'c',previousTier,'p',Items.IRON_HOE,'b',Blocks.IRON_BLOCK});
  }
 else   if (blockLevel == ToolHelper.LEVEL_DIAMOND) {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',Items.DIAMOND,'c',previousTier,'p',Items.DIAMOND_HOE});
  }
 else {
    recipe=new ShapedOreRecipe(new ItemStack(this),new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",'s',"String_Node_Str",'r',previousTier,'c',"String_Node_Str",'p',Items.WOODEN_HOE});
  }
  GameRegistry.addRecipe(recipe);
}
Program: 80753
Project: 80753
Buggy source:
public void checkForChanges(){
  boolean update=false;
  if ((slots[2] == null) && (lastPick >= 0)) {
    lastPick=-1;
    update=true;
  }
 else   if (slots[2] != null) {
    if (ToolHelper.getLevel(slots[2]) != lastPick) {
      lastPick=ToolHelper.getLevel(slots[2]);
      update=true;
    }
  }
  if ((slots[3] == null) && (lastShovel >= 0)) {
    lastShovel=-1;
    update=true;
  }
 else   if (slots[3] != null) {
    if (ToolHelper.getLevel(slots[3]) != lastShovel) {
      lastShovel=ToolHelper.getLevel(slots[3]);
      update=true;
    }
  }
  if (previousUpgrades != getUpgrades()) {
    previousUpgrades=getUpgrades();
    update=true;
  }
  if (update) {
    scanBlocks();
    currentColumn=getRange();
    currentBlock=null;
    miningTime=0;
    currentYLevel=pos.getY() - 1;
  }
}

Fixed version (ground truth):
public void checkForChanges(){
  boolean update=false;
  if ((slots[2] == null) && (lastPick >= 0)) {
    lastPick=-1;
    update=true;
  }
 else   if (slots[2] != null) {
    if (ToolHelper.getLevel(slots[2]) != lastPick) {
      lastPick=ToolHelper.getLevel(slots[2]);
      update=true;
    }
  }
  if ((slots[3] == null) && (lastShovel >= 0)) {
    lastShovel=-1;
    update=true;
  }
 else   if (slots[3] != null) {
    if (ToolHelper.getLevel(slots[3]) != lastShovel) {
      lastShovel=ToolHelper.getLevel(slots[3]);
      update=true;
    }
  }
  if (previousUpgrades != getUpgrades()) {
    previousUpgrades=getUpgrades();
    update=true;
  }
  if (update) {
    scanBlocks();
    currentColumn=getRange();
    currentBlock=null;
    elapsedDuration=0;
    blockMineDuration=0;
    currentYLevel=pos.getY() - 1;
  }
}
Program: 80754
Project: 80754
Buggy source:
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    if (slots[SLOT_CHARGER] != null) {
      if (currentStorage > 0) {
        if (slots[SLOT_CHARGER].getItem() instanceof IEnergyContainerItem) {
          IEnergyContainerItem container=(IEnergyContainerItem)slots[SLOT_CHARGER].getItem();
          if (container.getEnergyStored(slots[SLOT_CHARGER]) < container.getMaxEnergyStored(slots[SLOT_CHARGER])) {
            int giveAmount=container.receiveEnergy(slots[SLOT_CHARGER],currentStorage,false);
            if (giveAmount > 0)             changeCharge(giveAmount * -1);
          }
        }
      }
    }
    outputEnergy();
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (!worldObj.isRemote) {
    if (slots[SLOT_CHARGER] != null) {
      if (currentStorage > 0) {
        if (slots[SLOT_CHARGER].getItem() instanceof IEnergyContainerItem) {
          IEnergyContainerItem container=(IEnergyContainerItem)slots[SLOT_CHARGER].getItem();
          if (container.getEnergyStored(slots[SLOT_CHARGER]) < container.getMaxEnergyStored(slots[SLOT_CHARGER])) {
            int giveAmount=container.receiveEnergy(slots[SLOT_CHARGER],currentStorage,false);
            if (giveAmount > 0)             changeCharge(giveAmount * -1);
          }
        }
      }
    }
    if (worldObj.getRedstonePower(pos,EnumFacing.UP) == 0 || worldObj.getRedstonePower(pos,EnumFacing.DOWN) == 0 || worldObj.getRedstonePower(pos,EnumFacing.NORTH) == 0 || worldObj.getRedstonePower(pos,EnumFacing.SOUTH) == 0 || worldObj.getRedstonePower(pos,EnumFacing.WEST) == 0 || worldObj.getRedstonePower(pos,EnumFacing.EAST) == 0) {
      outputEnergy();
    }
  }
}
Program: 80755
Project: 80755
Buggy source:
@Override public int receiveEnergy(EnumFacing from,int maxReceive,boolean simulate){
  int energyReceived=0;
  if (from.getOpposite().getIndex() == getBlockMetadata()) {
    if (!simulate) {
      if (maxReceive > transferRate) {
        energyReceived=transferRate;
      }
 else {
        energyReceived=maxReceive;
      }
      changeCharge(energyReceived);
    }
  }
  return energyReceived;
}

Fixed version (ground truth):
@Override public int receiveEnergy(EnumFacing from,int maxReceive,boolean simulate){
  int energyReceived=0;
  if (from.getOpposite().getIndex() == getBlockMetadata()) {
    if (currentStorage + maxReceive <= maxStorage || currentStorage + transferRate <= maxStorage) {
      if (!simulate) {
        if (maxReceive > transferRate) {
          energyReceived=transferRate;
        }
 else {
          energyReceived=maxReceive;
        }
        changeCharge(energyReceived);
      }
    }
  }
  return energyReceived;
}
Program: 80756
Project: 80756
Buggy source:
@Override public boolean isLog(ItemStack item){
  if (item == null)   return false;
  return (item.getUnlocalizedName().contains("String_Node_Str"));
}

Fixed version (ground truth):
@Override public boolean isLog(ItemStack item){
  if (item == null)   return false;
  if (item.getItem() == null)   return false;
  return (item.getItem().getUnlocalizedName().contains("String_Node_Str"));
}
Program: 80757
Project: 80757
Buggy source:
@Override public boolean isLeaf(ItemStack item){
  if (item == null)   return false;
  Boolean rv=false;
  try {
    rv=item.getUnlocalizedName().contains("String_Node_Str");
  }
 catch (  java.lang.NullPointerException e) {
    ProgressiveAutomation.logger.warn("String_Node_Str");
  }
  return rv;
}

Fixed version (ground truth):
@Override public boolean isLeaf(ItemStack item){
  if (item == null)   return false;
  if (item.getItem() == null)   return false;
  return (item.getItem().getUnlocalizedName().contains("String_Node_Str"));
}
Program: 80758
Project: 80758
Buggy source:
public int getMaxEnergyStored(EnumFacing from){
  if (slots[SLOT_FUEL].getItem() instanceof ItemRFEngine) {
    return getEngine().getMaxCharge();
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int getMaxEnergyStored(EnumFacing from){
  if (slots[SLOT_FUEL] != null && slots[SLOT_FUEL].getItem() instanceof ItemRFEngine) {
    return getEngine().getMaxCharge();
  }
 else {
    return 0;
  }
}
Program: 80759
Project: 80759
Buggy source:
public boolean isItemValidForSlot(int slot,ItemStack stack){
  if ((slot == SLOT_FUEL) && (getItemBurnTime(stack) > 0) && (ToolHelper.getType(stack) == -1)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isItemValidForSlot(int slot,ItemStack stack){
  if ((slot == SLOT_FUEL) && (getItemBurnTime(stack) > 0) && (ToolHelper.getType(stack) == -1)) {
    return true;
  }
  if (((slot >= SLOT_INVENTORY_START) && (slot <= SLOT_INVENTORY_END)) && (SLOT_INVENTORY_START != SLOT_INVENTORY_END)) {
    return true;
  }
  return false;
}
Program: 80760
Project: 80760
Buggy source:
@EventHandler public void init(FMLInitializationEvent event){
  PAItems.init();
  PABlocks.init();
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,guiHandler);
  FMLCommonHandler.instance().bus().register(instance);
  MinecraftForge.EVENT_BUS.register(new EventRenderWorld());
}

Fixed version (ground truth):
@EventHandler public void init(FMLInitializationEvent event){
  PAItems.init();
  PABlocks.init();
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,guiHandler);
  FMLCommonHandler.instance().bus().register(instance);
  proxy.init();
}
Program: 80761
Project: 80761
Buggy source:
public UpgradeableTileEntity(int numSlots){
  super(numSlots);
  installedUpgrades=new EnumMap<UpgradeType,Integer>(UpgradeType.class);
  allowedUpgrades=Collections.emptySet();
  EventRenderWorld.addMachine(this);
}

Fixed version (ground truth):
public UpgradeableTileEntity(int numSlots){
  super(numSlots);
  installedUpgrades=new EnumMap<UpgradeType,Integer>(UpgradeType.class);
  allowedUpgrades=Collections.emptySet();
  if (ProgressiveAutomation.proxy.isClient()) {
    EventRenderWorld.addMachine(this);
  }
}
Program: 80763
Project: 80763
Buggy source:
public boolean addToInventory(ItemStack item){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  int extraSlot=extraSlotCheck(item);
  if (extraSlot >= 0) {
    item=moveItemToSlot(item,extraSlot);
  }
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      if (item != null) {
        if ((slots[i].isItemEqual(item)) && (slots[i].stackSize < slots[i].getMaxStackSize()) && (ItemStack.areItemStackTagsEqual(item,slots[i]))) {
          int avail=slots[i].getMaxStackSize() - slots[i].stackSize;
          if (avail >= item.stackSize) {
            slots[i].stackSize+=item.stackSize;
            item=null;
            return true;
          }
 else {
            item.stackSize-=avail;
            slots[i].stackSize+=avail;
          }
        }
      }
    }
  }
  if ((item != null) && (item.stackSize > 0)) {
    for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
      if (slots[i] == null) {
        if (this.isItemValidForSlot(i,item)) {
          slots[i]=item;
          item=null;
          return true;
        }
      }
    }
  }
  if ((item != null) && (item.stackSize == 0)) {
    item=null;
  }
  if (item != null) {
    dropItem(item);
    item=null;
  }
  return false;
}

Fixed version (ground truth):
public boolean addToInventory(ItemStack item){
  if ((SLOT_INVENTORY_START == -1) || (SLOT_INVENTORY_END == -1))   return false;
  int extraSlot=extraSlotCheck(item);
  if (extraSlot >= 0) {
    item=moveItemToSlot(item,extraSlot);
  }
  for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
    if (slots[i] != null) {
      if (item != null) {
        if ((slots[i].isItemEqual(item)) && (slots[i].stackSize < slots[i].getMaxStackSize()) && (ItemStack.areItemStackTagsEqual(item,slots[i]))) {
          int avail=slots[i].getMaxStackSize() - slots[i].stackSize;
          if (avail >= item.stackSize) {
            slots[i].stackSize+=item.stackSize;
            item=null;
            return true;
          }
 else {
            item.stackSize-=avail;
            slots[i].stackSize+=avail;
          }
        }
      }
    }
  }
  if ((item != null) && (item.stackSize > 0)) {
    for (int i=SLOT_INVENTORY_START; i <= SLOT_INVENTORY_END; i++) {
      if (slots[i] == null) {
        if (this.isItemValidForSlot(i,item,true)) {
          slots[i]=item;
          item=null;
          return true;
        }
      }
    }
  }
  if ((item != null) && (item.stackSize == 0)) {
    item=null;
  }
  if (item != null) {
    dropItem(item);
    item=null;
  }
  return false;
}
Program: 80764
Project: 80764
Buggy source:
public boolean isItemValidForSlot(int slot,ItemStack stack){
  if ((slot == SLOT_FUEL) && (getItemBurnTime(stack) > 0) && (ToolHelper.getType(stack) == -1)) {
    return true;
  }
  if (((slot >= SLOT_INVENTORY_START) && (slot <= SLOT_INVENTORY_END)) && (SLOT_INVENTORY_START != SLOT_INVENTORY_END)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isItemValidForSlot(int slot,ItemStack stack,boolean internalStorage){
  if ((slot == SLOT_FUEL) && (getItemBurnTime(stack) > 0) && (ToolHelper.getType(stack) == -1)) {
    return true;
  }
  if (((slot >= SLOT_INVENTORY_START) && (slot <= SLOT_INVENTORY_END)) && (SLOT_INVENTORY_START != SLOT_INVENTORY_END) && (internalStorage)) {
    return true;
  }
  return false;
}
Program: 80765
Project: 80765
Buggy source:
@Override public boolean canExtractItem(int slot,ItemStack stack,int side){
  if (sides[side] == WrenchModes.Mode.Disabled)   return false;
  if ((sides[side] == WrenchModes.Mode.Normal) || (sides[side] == WrenchModes.Mode.Output)) {
    if (slot == OUTPUT_SLOT) {
      return true;
    }
 else     if ((slot >= SLOT_INVENTORY_START) && (slot <= SLOT_INVENTORY_END) && (side != 0)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canExtractItem(int slot,ItemStack stack,int side){
  if (sides[side] == WrenchModes.Mode.Disabled)   return false;
  if ((sides[side] == WrenchModes.Mode.Output) || (sides[side] == WrenchModes.Mode.Normal)) {
    if (slot == OUTPUT_SLOT) {
      return true;
    }
  }
  if (sides[side] == WrenchModes.Mode.Input) {
    if ((slot >= SLOT_INVENTORY_START) && (slot <= SLOT_INVENTORY_END)) {
      return true;
    }
  }
  return false;
}