nus-yam/ex-repair huggingface dataset:
Program: 156970
Project: 156970
Buggy source:
private boolean shouldRenderNormalPipeSide(PipeRenderState state,ForgeDirection direction){
  return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0;
}

Fixed version (ground truth):
private boolean shouldRenderNormalPipeSide(PipeRenderState state,ForgeDirection direction){
  return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0 && !state.plugMatrix.isConnected(direction);
}
Program: 156971
Project: 156971
Buggy source:
public void initialize(Pipe pipe){
  if (pipe == null) {
    BuildCraftCore.bcLog.log(Level.WARNING,"String_Node_Str",new Object[]{xCoord,yCoord,zCoord});
    worldObj.setBlockToAir(xCoord,yCoord,zCoord);
    return;
  }
  this.pipe=pipe;
  tileBuffer=new TileBuffer[6];
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    Position pos=new Position(xCoord,yCoord,zCoord,o);
    pos.moveForwards(1.0);
    tileBuffer[o.ordinal()]=new TileBuffer();
    tileBuffer[o.ordinal()].initialize(worldObj,(int)pos.x,(int)pos.y,(int)pos.z);
  }
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity tile=getTile(o);
    if (tile instanceof ITileBufferHolder) {
      ((ITileBufferHolder)tile).blockCreated(o,BuildCraftTransport.genericPipeBlock.blockID,this);
    }
  }
  bindPipe();
  computeConnections();
  scheduleRenderUpdate();
  pipe.initialize();
  initialized=true;
}

Fixed version (ground truth):
public void initialize(Pipe pipe){
  if (pipe == null) {
    BuildCraftCore.bcLog.log(Level.WARNING,"String_Node_Str",new Object[]{xCoord,yCoord,zCoord});
    worldObj.setBlockToAir(xCoord,yCoord,zCoord);
    return;
  }
  this.pipe=pipe;
  tileBuffer=new TileBuffer[6];
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    Position pos=new Position(xCoord,yCoord,zCoord,o);
    pos.moveForwards(1.0);
    tileBuffer[o.ordinal()]=new TileBuffer();
    tileBuffer[o.ordinal()].initialize(worldObj,(int)pos.x,(int)pos.y,(int)pos.z);
  }
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity tile=getTile(o);
    if (tile instanceof ITileBufferHolder) {
      ((ITileBufferHolder)tile).blockCreated(o,BuildCraftTransport.genericPipeBlock.blockID,this);
    }
    if (tile instanceof TileGenericPipe) {
      ((TileGenericPipe)tile).scheduleNeighborChange();
    }
  }
  bindPipe();
  computeConnections();
  scheduleRenderUpdate();
  pipe.initialize();
  initialized=true;
}
Program: 156972
Project: 156972
Buggy source:
/** 
 * Checks if this tile is connected to another tile
 * @param with - The other Tile
 * @param side - The orientation to get to the other tile ('with')
 * @return true if pipes are considered connected
 */
protected boolean arePipesConnected(TileEntity with,ForgeDirection side){
  Pipe pipe1=pipe;
  if (!BlockGenericPipe.isValid(pipe1))   return false;
  if (with instanceof TileGenericPipe) {
    Pipe pipe2=((TileGenericPipe)with).pipe;
    if (!BlockGenericPipe.isValid(pipe2))     return false;
    if (!pipe2.canPipeConnect(this,side.getOpposite()))     return false;
  }
  return pipe1 != null ? pipe1.canPipeConnect(with,side) : false;
}

Fixed version (ground truth):
/** 
 * Checks if this tile is connected to another tile
 * @param with - The other Tile
 * @param side - The orientation to get to the other tile ('with')
 * @return true if pipes are considered connected
 */
protected boolean arePipesConnected(TileEntity with,ForgeDirection side){
  Pipe pipe1=pipe;
  if (hasPlug(side))   return false;
  if (!BlockGenericPipe.isValid(pipe1))   return false;
  if (with instanceof TileGenericPipe) {
    if (((TileGenericPipe)with).hasPlug(side.getOpposite()))     return false;
    Pipe pipe2=((TileGenericPipe)with).pipe;
    if (!BlockGenericPipe.isValid(pipe2))     return false;
    if (!pipe2.canPipeConnect(this,side.getOpposite()))     return false;
  }
  return pipe1 != null ? pipe1.canPipeConnect(with,side) : false;
}
Program: 156973
Project: 156973
Buggy source:
public boolean addPlug(ForgeDirection forgeDirection){
  if (hasPlug(forgeDirection))   return false;
  plugs[forgeDirection.ordinal()]=true;
  worldObj.notifyBlockChange(this.xCoord,this.yCoord,this.zCoord,worldObj.getBlockId(this.xCoord,this.yCoord,this.zCoord));
  scheduleRenderUpdate();
  return true;
}

Fixed version (ground truth):
public boolean addPlug(ForgeDirection forgeDirection){
  if (hasPlug(forgeDirection))   return false;
  plugs[forgeDirection.ordinal()]=true;
  worldObj.notifyBlockChange(this.xCoord,this.yCoord,this.zCoord,worldObj.getBlockId(this.xCoord,this.yCoord,this.zCoord));
  scheduleNeighborChange();
  scheduleRenderUpdate();
  return true;
}
Program: 156974
Project: 156974
Buggy source:
public void removeAndDropPlug(ForgeDirection forgeDirection){
  if (!hasPlug(forgeDirection))   return;
  plugs[forgeDirection.ordinal()]=false;
  Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.plugItem),this.xCoord,this.yCoord,this.zCoord);
  worldObj.notifyBlockChange(this.xCoord,this.yCoord,this.zCoord,worldObj.getBlockId(this.xCoord,this.yCoord,this.zCoord));
  scheduleRenderUpdate();
}

Fixed version (ground truth):
public void removeAndDropPlug(ForgeDirection forgeDirection){
  if (!hasPlug(forgeDirection))   return;
  plugs[forgeDirection.ordinal()]=false;
  Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.plugItem),this.xCoord,this.yCoord,this.zCoord);
  worldObj.notifyBlockChange(this.xCoord,this.yCoord,this.zCoord,worldObj.getBlockId(this.xCoord,this.yCoord,this.zCoord));
  scheduleNeighborChange();
  scheduleRenderUpdate();
}
Program: 156977
Project: 156977
Buggy source:
public void readFromNBT(NBTTagCompound nbttagcompound){
  isActive=nbttagcompound.getBoolean("String_Node_Str");
  progressPart=nbttagcompound.getShort("String_Node_Str");
  progress=nbttagcompound.getFloat("String_Node_Str");
}

Fixed version (ground truth):
public void readFromNBT(NBTTagCompound nbttagcompound){
  isActive=nbttagcompound.getBoolean("String_Node_Str");
  singlePulse=nbttagcompound.getBoolean("String_Node_Str");
}
Program: 156978
Project: 156978
Buggy source:
public void enablePulse(){
  isActive=true;
}

Fixed version (ground truth):
public void enablePulse(int count){
  isActive=true;
  singlePulse=false;
  pulseCount=count;
}
Program: 156979
Project: 156979
Buggy source:
public void disablePulse(){
  isActive=false;
}

Fixed version (ground truth):
public void disablePulse(){
  if (!isActive) {
    hasPulsed=false;
  }
  isActive=false;
  pulseCount=0;
}
Program: 156980
Project: 156980
Buggy source:
public void update(){
  if (powerReceptor == null)   return;
  if (progressPart != 0) {
    progress+=getPulseSpeed();
    if (progress > 0.5 && progressPart == 1) {
      progressPart=2;
      powerReceptor.getPowerProvider().receiveEnergy(1,ForgeDirection.WEST);
    }
 else     if (progress >= 1) {
      progress=0;
      progressPart=0;
    }
  }
 else   if (isActive) {
    progressPart=1;
  }
}

Fixed version (ground truth):
public void update(){
  if (powerReceptor == null)   return;
  if (isActive) {
    tick++;
    if (!singlePulse || !hasPulsed) {
      if (tick % 10 == 0 || !hasPulsed) {
        powerReceptor.getPowerProvider().receiveEnergy(Math.min(1 << (pulseCount - 1),64),ForgeDirection.WEST);
        if (singlePulse) {
          hasPulsed=true;
        }
      }
    }
  }
}
Program: 156981
Project: 156981
Buggy source:
public void writeToNBT(NBTTagCompound nbttagcompound){
  nbttagcompound.setBoolean("String_Node_Str",isActive);
  nbttagcompound.setShort("String_Node_Str",(short)progressPart);
  nbttagcompound.setFloat("String_Node_Str",progress);
}

Fixed version (ground truth):
public void writeToNBT(NBTTagCompound nbttagcompound){
  nbttagcompound.setBoolean("String_Node_Str",singlePulse);
  nbttagcompound.setBoolean("String_Node_Str",isActive);
}
Program: 156982
Project: 156982
Buggy source:
public abstract boolean resolveAction(IAction action);

Fixed version (ground truth):
public abstract boolean resolveAction(IAction action,int count);
Program: 156983
Project: 156983
Buggy source:
@Override public void addActions(LinkedList<IAction> list){
  if (pipe.wireSet[IPipe.WireColor.Red.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_2.ordinal()) {
    list.add(BuildCraftTransport.actionRedSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Blue.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_3.ordinal()) {
    list.add(BuildCraftTransport.actionBlueSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Green.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_4.ordinal()) {
    list.add(BuildCraftTransport.actionGreenSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Yellow.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_4.ordinal()) {
    list.add(BuildCraftTransport.actionYellowSignal);
  }
  if (hasPulser()) {
    list.add(BuildCraftTransport.actionEnergyPulser);
  }
}

Fixed version (ground truth):
@Override public void addActions(LinkedList<IAction> list){
  if (pipe.wireSet[IPipe.WireColor.Red.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_2.ordinal()) {
    list.add(BuildCraftTransport.actionRedSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Blue.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_3.ordinal()) {
    list.add(BuildCraftTransport.actionBlueSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Green.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_4.ordinal()) {
    list.add(BuildCraftTransport.actionGreenSignal);
  }
  if (pipe.wireSet[IPipe.WireColor.Yellow.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_4.ordinal()) {
    list.add(BuildCraftTransport.actionYellowSignal);
  }
  if (hasPulser()) {
    list.add(BuildCraftTransport.actionEnergyPulser);
    list.add(BuildCraftTransport.actionSingleEnergyPulse);
  }
}
Program: 156984
Project: 156984
Buggy source:
@Override public boolean resolveAction(IAction action){
  if (action instanceof ActionEnergyPulser) {
    pulser.enablePulse();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean resolveAction(IAction action,int count){
  if (action instanceof ActionEnergyPulser) {
    pulser.enablePulse(count);
    return true;
  }
 else   if (action instanceof ActionSingleEnergyPulse) {
    pulser.enableSinglePulse(count);
    return true;
  }
  return false;
}
Program: 156986
Project: 156986
Buggy source:
/** 
 * Should return the index in the array returned by GetTextureIcons() for a specified direction
 * @param direction - The direction for which the indexed should be rendered. Unknown for pipe center
 * @return An index valid in the array returned by getTextureIcons() 
 */
public abstract int getIconIndex(ForgeDirection direction);

Fixed version (ground truth):
/** 
 * Should return the index in the array returned by GetTextureIcons() for a specified direction
 * @param direction - The direction for which the indexed should be rendered. Unknown for pipe center
 * @return An index valid in the array returned by getTextureIcons()
 */
public abstract int getIconIndex(ForgeDirection direction);
Program: 156987
Project: 156987
Buggy source:
public BptSlot internalGetNextBlock(World world,IBuilderInventory inv,LinkedList<BptSlot> list){
  BptSlot result=null;
  while (list.size() > 0) {
    BptSlot slot=list.getFirst();
    if (BuildCraftAPI.softBlock(slot.blockId) == BuildCraftAPI.softBlock(world.getBlockId(slot.x,slot.y,slot.z))) {
      list.removeFirst();
    }
 else     if (slot.mode == Mode.ClearIfInvalid) {
      result=slot;
      list.removeFirst();
      break;
    }
 else {
      int size=inv.getSizeInventory();
      for (int i=0; i < size; ++i) {
        if (!inv.isBuildingMaterial(i)) {
          continue;
        }
        ItemStack stack=inv.decrStackSize(i,1);
        if (stack != null && stack.stackSize > 0) {
          result=slot.clone();
          result.stackToUse=stack;
          list.removeFirst();
          break;
        }
      }
      break;
    }
  }
  return result;
}

Fixed version (ground truth):
public BptSlot internalGetNextBlock(World world,IBuilderInventory inv,LinkedList<BptSlot> list){
  BptSlot result=null;
  while (list.size() > 0) {
    BptSlot slot=list.getFirst();
    if (slot.blockId == world.getBlockId(slot.x,slot.y,slot.z)) {
      list.removeFirst();
    }
 else     if (slot.mode == Mode.ClearIfInvalid) {
      result=slot;
      list.removeFirst();
      break;
    }
 else {
      int size=inv.getSizeInventory();
      for (int i=0; i < size; ++i) {
        if (!inv.isBuildingMaterial(i)) {
          continue;
        }
        ItemStack stack=inv.decrStackSize(i,1);
        if (stack != null && stack.stackSize > 0) {
          result=slot.clone();
          result.stackToUse=stack;
          list.removeFirst();
          break;
        }
      }
      break;
    }
  }
  return result;
}
Program: 156988
Project: 156988
Buggy source:
private void updateCraftingResults(){
  if (this.currentRecipe == null || !this.currentRecipe.matches(internalInventoryCrafting,worldObj))   currentRecipe=CraftingHelper.findMatchingRecipe(internalInventoryCrafting,worldObj);
  ItemStack resultStack=null;
  if (currentRecipe != null) {
    resultStack=currentRecipe.getCraftingResult(internalInventoryCrafting);
  }
  craftResult.setInventorySlotContents(0,resultStack);
  onInventoryChanged();
}

Fixed version (ground truth):
private void updateCraftingResults(){
  if (internalInventoryCrafting == null) {
    return;
  }
  internalInventoryCrafting.recipeUpdate(true);
  if (this.currentRecipe == null || !this.currentRecipe.matches(internalInventoryCrafting,worldObj))   currentRecipe=CraftingHelper.findMatchingRecipe(internalInventoryCrafting,worldObj);
  ItemStack resultStack=null;
  if (currentRecipe != null) {
    resultStack=currentRecipe.getCraftingResult(internalInventoryCrafting);
  }
  craftResult.setInventorySlotContents(0,resultStack);
  internalInventoryCrafting.recipeUpdate(false);
  onInventoryChanged();
}
Program: 156990
Project: 156990
Buggy source:
@Override public ILiquidTank getTank(ForgeDirection direction,LiquidStack type){
  return null;
}

Fixed version (ground truth):
@Override public ILiquidTank getTank(ForgeDirection direction,LiquidStack type){
  ForgeDirection dir=ForgeDirection.values()[worldObj.getBlockMetadata(xCoord,yCoord,zCoord)];
switch (direction) {
case NORTH:
switch (dir) {
case WEST:
      return ingredient2;
case EAST:
    return ingredient1;
default :
  return null;
}
case SOUTH:
switch (dir) {
case WEST:
return ingredient1;
case EAST:
return ingredient2;
default :
return null;
}
case EAST:
switch (dir) {
case NORTH:
return ingredient2;
case SOUTH:
return ingredient1;
default :
return null;
}
case WEST:
switch (dir) {
case NORTH:
return ingredient1;
case SOUTH:
return ingredient2;
default :
return null;
}
case DOWN:
return result;
default :
return null;
}
}
Program: 156991
Project: 156991
Buggy source:
@Override public ILiquidTank getTank(ForgeDirection direction,LiquidStack type){
  return null;
}

Fixed version (ground truth):
@Override public ILiquidTank getTank(ForgeDirection direction,LiquidStack type){
  return tank;
}
Program: 156992
Project: 156992
Buggy source:
public ItemStack addToInventory(ItemStack stackToMove){
  for (int i=0; i < _inventory.getSizeInventory(); i++) {
    ItemStack stack=_inventory.getStackInSlot(i);
    if (stack == null) {
      _inventory.setInventorySlotContents(i,stackToMove);
      return null;
    }
    if (stackToMove.itemID == stack.itemID && (stackToMove.getItem().isDamageable() || stackToMove.getItemDamage() == stack.getItemDamage())) {
      if (stackToMove.stackSize + stack.stackSize <= stack.getMaxStackSize()) {
        stack.stackSize+=stackToMove.stackSize;
        return null;
      }
      int itemsToMove=stack.getMaxStackSize() - stack.stackSize;
      stack.stackSize+=itemsToMove;
      stackToMove.stackSize-=itemsToMove;
    }
  }
  return stackToMove;
}

Fixed version (ground truth):
public ItemStack addToInventory(ItemStack stackToMove){
  for (int i=0; i < _inventory.getSizeInventory(); i++) {
    ItemStack stack=_inventory.getStackInSlot(i);
    if (stack == null) {
      _inventory.setInventorySlotContents(i,stackToMove);
      return null;
    }
    if (stackToMove.itemID == stack.itemID && (stackToMove.getItem().isDamageable() || stackToMove.getItemDamage() == stack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack,stackToMove)) {
      if (stackToMove.stackSize + stack.stackSize <= stack.getMaxStackSize()) {
        stack.stackSize+=stackToMove.stackSize;
        return null;
      }
      int itemsToMove=stack.getMaxStackSize() - stack.stackSize;
      stack.stackSize+=itemsToMove;
      stackToMove.stackSize-=itemsToMove;
    }
  }
  return stackToMove;
}
Program: 156993
Project: 156993
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (CoreProxy.proxy.isRenderWorld(worldObj) || worldObj.getWorldTime() % 5 != 0)   return;
  TileEntity tile=this.worldObj.getBlockTileEntity(xCoord,yCoord - 1,zCoord);
  if (tile == null)   return;
  ISpecialInventory special=null;
  InventoryUtil externalInventory=null;
  if (tile instanceof ISpecialInventory) {
    special=(ISpecialInventory)tile;
  }
 else   if (tile instanceof ISidedInventory) {
    externalInventory=new InventoryUtil(new SidedInventoryAdapter((ISidedInventory)tile,ForgeDirection.UP));
  }
 else   if (tile instanceof IInventory) {
    externalInventory=new InventoryUtil((IInventory)tile);
  }
  for (int internalSlot=0; internalSlot < _inventory.getSizeInventory(); internalSlot++) {
    ItemStack stackInSlot=_inventory.getStackInSlot(internalSlot);
    if (stackInSlot == null)     continue;
    if (special != null) {
      ItemStack clonedStack=stackInSlot.copy().splitStack(1);
      if (special.addItem(clonedStack,true,ForgeDirection.UP) > 0) {
        _inventory.decrStackSize(internalSlot,1);
        return;
      }
      continue;
    }
    if (externalInventory != null && externalInventory.hasRoomForItem(stackInSlot)) {
      ItemStack stackToMove=_inventory.decrStackSize(internalSlot,1);
      externalInventory.addToInventory(stackToMove);
      return;
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (CoreProxy.proxy.isRenderWorld(worldObj) || worldObj.getWorldTime() % 5 != 0)   return;
  TileEntity tile=this.worldObj.getBlockTileEntity(xCoord,yCoord - 1,zCoord);
  if (tile == null)   return;
  ITransactor transactor=Transactor.getTransactorFor(tile);
  if (transactor == null)   return;
  for (int internalSlot=0; internalSlot < _inventory.getSizeInventory(); internalSlot++) {
    ItemStack stackInSlot=_inventory.getStackInSlot(internalSlot);
    if (stackInSlot == null)     continue;
    ItemStack clonedStack=stackInSlot.copy().splitStack(1);
    if (transactor.addItem(clonedStack,ForgeDirection.UP,true).stackSize <= 0) {
      _inventory.decrStackSize(internalSlot,1);
      return;
    }
  }
}
Program: 156994
Project: 156994
Buggy source:
@Override public ItemStack decrStackSize(int i,int j){
  if (itemInInventory != null) {
    ItemStack newStack=itemInInventory.splitStack(j);
    if (itemInInventory.stackSize == 0) {
      itemInInventory=null;
    }
    return newStack;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  if (itemInInventory != null) {
    if (itemInInventory.stackSize <= 0) {
      itemInInventory=null;
      return null;
    }
    ItemStack newStack=itemInInventory;
    if (amount >= newStack.stackSize) {
      itemInInventory=null;
    }
 else {
      newStack=itemInInventory.splitStack(amount);
    }
    return newStack;
  }
  return null;
}
Program: 156995
Project: 156995
Buggy source:
@Override public void update(){
  super.update();
  if (itemInInventory != null) {
    LiquidStack liquid=null;
    if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD) {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
    }
 else {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(itemInInventory);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        tile.setInventorySlotContents(0,Utils.consumeItem(itemInInventory));
      }
    }
  }
  if (heat > COOLANT_THRESHOLD) {
    int extraHeat=heat - COOLANT_THRESHOLD;
    LiquidStack coolant=this.coolantTank.getLiquid();
    IronEngineCoolant currentCoolant=IronEngineCoolant.getCoolantForLiquid(coolant);
    if (currentCoolant != null) {
      if (coolant.amount * currentCoolant.coolingPerUnit > extraHeat) {
        coolant.amount-=Math.round(extraHeat / currentCoolant.coolingPerUnit);
        heat=COOLANT_THRESHOLD;
      }
 else {
        heat-=coolant.amount * currentCoolant.coolingPerUnit;
        coolant.amount=0;
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !tile.isRedstonePowered)) {
    heat-=10;
  }
  if (heat <= 0)   heat=0;
  if (heat == 0 && penaltyCooling > 0) {
    penaltyCooling--;
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (itemInInventory != null) {
    LiquidStack liquid;
    if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD) {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
    }
 else {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(itemInInventory);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        tile.setInventorySlotContents(0,Utils.consumeItem(itemInInventory));
      }
    }
  }
  if (heat > COOLANT_THRESHOLD) {
    int extraHeat=heat - COOLANT_THRESHOLD;
    LiquidStack coolant=this.coolantTank.getLiquid();
    IronEngineCoolant currentCoolant=IronEngineCoolant.getCoolantForLiquid(coolant);
    if (currentCoolant != null) {
      if (coolant.amount * currentCoolant.coolingPerUnit > extraHeat) {
        coolant.amount-=Math.round(extraHeat / currentCoolant.coolingPerUnit);
        heat=COOLANT_THRESHOLD;
      }
 else {
        heat-=coolant.amount * currentCoolant.coolingPerUnit;
        coolant.amount=0;
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !tile.isRedstonePowered)) {
    heat-=10;
  }
  if (heat <= 0) {
    heat=0;
  }
  if (heat == 0 && penaltyCooling > 0) {
    penaltyCooling--;
  }
}
Program: 156996
Project: 156996
Buggy source:
@Override public ItemStack decrStackSize(int i,int j){
  if (itemInInventory != null) {
    ItemStack newStack=itemInInventory.splitStack(j);
    if (itemInInventory.stackSize == 0) {
      itemInInventory=null;
    }
    return newStack;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  if (itemInInventory != null) {
    if (itemInInventory.stackSize <= 0) {
      itemInInventory=null;
      return null;
    }
    ItemStack newStack=itemInInventory;
    if (amount >= newStack.stackSize) {
      itemInInventory=null;
    }
 else {
      newStack=itemInInventory.splitStack(amount);
    }
    return newStack;
  }
  return null;
}
Program: 156997
Project: 156997
Buggy source:
@Override public void update(){
  super.update();
  if (itemInInventory != null) {
    LiquidStack liquid;
    if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD) {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
    }
 else {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(itemInInventory);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        tile.setInventorySlotContents(0,Utils.consumeItem(itemInInventory));
      }
    }
  }
  if (heat > COOLANT_THRESHOLD) {
    int extraHeat=heat - COOLANT_THRESHOLD;
    LiquidStack coolant=this.coolantTank.getLiquid();
    IronEngineCoolant currentCoolant=IronEngineCoolant.getCoolantForLiquid(coolant);
    if (currentCoolant != null) {
      if (coolant.amount * currentCoolant.coolingPerUnit > extraHeat) {
        coolant.amount-=Math.round(extraHeat / currentCoolant.coolingPerUnit);
        heat=COOLANT_THRESHOLD;
      }
 else {
        heat-=coolant.amount * currentCoolant.coolingPerUnit;
        coolant.amount=0;
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !tile.isRedstonePowered)) {
    heat-=10;
  }
  if (heat <= 0) {
    heat=0;
  }
  if (heat == 0 && penaltyCooling > 0) {
    penaltyCooling--;
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (itemInInventory != null) {
    LiquidStack liquid;
    if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD) {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
    }
 else {
      liquid=LiquidContainerRegistry.getLiquidForFilledItem(itemInInventory);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        tile.setInventorySlotContents(0,Utils.consumeItem(itemInInventory));
      }
    }
  }
  if (heat > COOLANT_THRESHOLD) {
    int extraHeat=heat - COOLANT_THRESHOLD;
    LiquidStack coolant=this.coolantTank.getLiquid();
    IronEngineCoolant currentCoolant=IronEngineCoolant.getCoolantForLiquid(coolant);
    if (currentCoolant != null) {
      if (coolant.amount * currentCoolant.coolingPerUnit > extraHeat) {
        coolant.amount-=Math.round(extraHeat / currentCoolant.coolingPerUnit);
        heat=COOLANT_THRESHOLD;
      }
 else {
        heat-=coolant.amount * currentCoolant.coolingPerUnit;
        coolantTank.setLiquid(null);
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !tile.isRedstonePowered)) {
    heat-=10;
  }
  if (heat <= 0) {
    heat=0;
  }
  if (heat == 0 && penaltyCooling > 0) {
    penaltyCooling--;
  }
}
Program: 156998
Project: 156998
Buggy source:
@Override public void burn(){
  currentOutput=0;
  LiquidStack fuel=this.fuelTank.getLiquid();
  IronEngineFuel currentFuel=IronEngineFuel.getFuelForLiquid(fuel);
  if (currentFuel == null) {
    return;
  }
  if (penaltyCooling <= 0 && tile.isRedstonePowered) {
    lastPowered=true;
    if (burnTime > 0 || fuel.amount > 0) {
      if (burnTime > 0) {
        burnTime--;
      }
 else {
        fuel.amount--;
        burnTime=currentFuel.totalBurningTime / LiquidContainerRegistry.BUCKET_VOLUME;
      }
      currentOutput=currentFuel.powerPerCycle;
      addEnergy(currentFuel.powerPerCycle);
      heat+=currentFuel.powerPerCycle;
    }
  }
 else   if (penaltyCooling <= 0) {
    if (lastPowered) {
      lastPowered=false;
      penaltyCooling=30 * 20;
    }
  }
}

Fixed version (ground truth):
@Override public void burn(){
  currentOutput=0;
  LiquidStack fuel=this.fuelTank.getLiquid();
  IronEngineFuel currentFuel=IronEngineFuel.getFuelForLiquid(fuel);
  if (currentFuel == null) {
    return;
  }
  if (penaltyCooling <= 0 && tile.isRedstonePowered) {
    lastPowered=true;
    if (burnTime > 0 || fuel.amount > 0) {
      if (burnTime > 0) {
        burnTime--;
      }
 else {
        if (--fuel.amount <= 0)         fuelTank.setLiquid(null);
        burnTime=currentFuel.totalBurningTime / LiquidContainerRegistry.BUCKET_VOLUME;
      }
      currentOutput=currentFuel.powerPerCycle;
      addEnergy(currentFuel.powerPerCycle);
      heat+=currentFuel.powerPerCycle;
    }
  }
 else   if (penaltyCooling <= 0) {
    if (lastPowered) {
      lastPowered=false;
      penaltyCooling=30 * 20;
    }
  }
}
Program: 156999
Project: 156999
Buggy source:
@Override public ItemStack decrStackSize(int i,int j){
  ItemStack newStack=stackList[i].copy();
  newStack.stackSize=j;
  stackList[i].stackSize-=j;
  if (stackList[i].stackSize == 0) {
    stackList[i]=null;
  }
  return newStack;
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slotId,int count){
  if (stackList[slotId] == null)   return null;
  if (stackList[slotId].stackSize > count)   return stackList[slotId].splitStack(count);
  ItemStack stack=stackList[slotId];
  stackList[slotId]=null;
  return stack;
}
Program: 157000
Project: 157000
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  NBTTagList nbttaglist=nbt.getTagList("String_Node_Str");
  for (int j=0; j < nbttaglist.tagCount(); ++j)   try {
    NBTTagCompound dataTag=(NBTTagCompound)nbttaglist.tagAt(j);
    IPipedItem entity=new EntityPassiveItem(null);
    entity.readFromNBT(dataTag);
    if (entity.isCorrupted()) {
      entity.remove();
      continue;
    }
    entity.setContainer(container);
    EntityData data=new EntityData(entity,ForgeDirection.getOrientation(dataTag.getInteger("String_Node_Str")));
    data.output=ForgeDirection.getOrientation(dataTag.getInteger("String_Node_Str"));
    data.toCenter=dataTag.getBoolean("String_Node_Str");
    entitiesToLoad.add(data);
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  NBTTagList nbttaglist=nbt.getTagList("String_Node_Str");
  for (int j=0; j < nbttaglist.tagCount(); ++j) {
    try {
      NBTTagCompound dataTag=(NBTTagCompound)nbttaglist.tagAt(j);
      IPipedItem entity=new EntityPassiveItem(null);
      entity.readFromNBT(dataTag);
      if (entity.isCorrupted()) {
        entity.remove();
        continue;
      }
      entity.setContainer(container);
      EntityData data=new EntityData(entity,ForgeDirection.getOrientation(dataTag.getInteger("String_Node_Str")));
      data.output=ForgeDirection.getOrientation(dataTag.getInteger("String_Node_Str"));
      data.toCenter=dataTag.getBoolean("String_Node_Str");
      entitiesToLoad.add(data);
    }
 catch (    Throwable t) {
      t.printStackTrace();
    }
  }
}
Program: 157001
Project: 157001
Buggy source:
/** 
 * Handles a packet describing a stack of items inside a pipe.
 * @param packet
 */
public void handleItemPacket(PacketPipeTransportContent packet){
  if (packet.getID() != PacketIds.PIPE_CONTENTS)   return;
  EntityData data=travelingEntities.remove(packet.getEntityId());
  IPipedItem item=null;
  if (data == null) {
    item=EntityPassiveItem.getOrCreate(worldObj,packet.getEntityId());
  }
 else {
    item=data.item;
  }
  item.setItemStack(new ItemStack(packet.getItemId(),packet.getStackSize(),packet.getItemDamage()));
  if (item.getPosition() == null)   item.setPosition(packet.getPosX(),packet.getPosY(),packet.getPosZ());
  item.setSpeed(packet.getSpeed());
  if (item.getContainer() != null && item.getContainer() != container) {
    ((PipeTransportItems)((TileGenericPipe)item.getContainer()).pipe.transport).scheduleRemoval(item);
    item.setContainer(container);
  }
  data=new EntityData(item,packet.getInputOrientation());
  data.output=packet.getOutputOrientation();
  travelingEntities.put(item.getEntityId(),data);
}

Fixed version (ground truth):
/** 
 * Handles a packet describing a stack of items inside a pipe.
 * @param packet
 */
public void handleItemPacket(PacketPipeTransportContent packet){
  if (packet.getID() != PacketIds.PIPE_CONTENTS)   return;
  EntityData data=travelingEntities.remove(packet.getEntityId());
  IPipedItem item;
  if (data == null) {
    item=EntityPassiveItem.getOrCreate(worldObj,packet.getEntityId());
  }
 else {
    item=data.item;
  }
  item.setItemStack(new ItemStack(packet.getItemId(),packet.getStackSize(),packet.getItemDamage()));
  if (item.getPosition() == null)   item.setPosition(packet.getPosX(),packet.getPosY(),packet.getPosZ());
  item.setSpeed(packet.getSpeed());
  if (item.getContainer() != null && item.getContainer() != container) {
    ((PipeTransportItems)((TileGenericPipe)item.getContainer()).pipe.transport).scheduleRemoval(item);
    item.setContainer(container);
  }
  data=new EntityData(item,packet.getInputOrientation());
  data.output=packet.getOutputOrientation();
  travelingEntities.put(item.getEntityId(),data);
}
Program: 157002
Project: 157002
Buggy source:
/** 
 * Returns a list of all possible movements, that is to say adjacent implementers of IPipeEntry or TileEntityChest.
 */
public LinkedList<ForgeDirection> getPossibleMovements(EntityData data){
  LinkedList<ForgeDirection> result=new LinkedList<ForgeDirection>();
  data.blacklist.add(data.input.getOpposite());
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS)   if (!data.blacklist.contains(o) && container.pipe.outputOpen(o))   if (canReceivePipeObjects(o,data.item))   result.add(o);
  if (result.size() == 0 && allowBouncing) {
    if (canReceivePipeObjects(data.input.getOpposite(),data.item))     result.add(data.input.getOpposite());
  }
  if (this.container.pipe instanceof IPipeTransportItemsHook) {
    Position pos=new Position(xCoord,yCoord,zCoord,data.input);
    result=((IPipeTransportItemsHook)this.container.pipe).filterPossibleMovements(result,pos,data.item);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns a list of all possible movements, that is to say adjacent implementers of IPipeEntry or TileEntityChest.
 */
public LinkedList<ForgeDirection> getPossibleMovements(EntityData data){
  LinkedList<ForgeDirection> result=new LinkedList<ForgeDirection>();
  data.blacklist.add(data.input.getOpposite());
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    if (!data.blacklist.contains(o) && container.pipe.outputOpen(o))     if (canReceivePipeObjects(o,data.item))     result.add(o);
  }
  if (result.size() == 0 && allowBouncing) {
    if (canReceivePipeObjects(data.input.getOpposite(),data.item))     result.add(data.input.getOpposite());
  }
  if (this.container.pipe instanceof IPipeTransportItemsHook) {
    Position pos=new Position(xCoord,yCoord,zCoord,data.input);
    result=((IPipeTransportItemsHook)this.container.pipe).filterPossibleMovements(result,pos,data.item);
  }
  return result;
}
Program: 157003
Project: 157003
Buggy source:
private void moveToCenter(){
  int[] maxInput=new int[]{0,0,0,0,0,0};
  int transferInCount=0;
  LiquidStack stackInCenter=internalTanks[ForgeDirection.UNKNOWN.ordinal()].drain(flowRate,false);
  int spaceAvailable=internalTanks[ForgeDirection.UNKNOWN.ordinal()].getCapacity();
  if (stackInCenter != null) {
    spaceAvailable-=stackInCenter.amount;
  }
  for (  ForgeDirection direction : directions) {
    LiquidStack testStack=internalTanks[direction.ordinal()].drain(flowRate,false);
    if (testStack == null)     continue;
    if (stackInCenter != null && !stackInCenter.isLiquidEqual(testStack))     continue;
    maxInput[direction.ordinal()]=testStack.amount;
    transferInCount++;
  }
  for (  ForgeDirection direction : directions) {
    if (transferState[direction.ordinal()] != TransferState.Output && maxInput[direction.ordinal()] > 0) {
      int ammountToDrain=(int)((double)maxInput[direction.ordinal()] / (double)flowRate / (double)transferInCount * (double)Math.min(flowRate,spaceAvailable));
      if (ammountToDrain < 1) {
        ammountToDrain++;
      }
      LiquidStack liquidToPush=internalTanks[direction.ordinal()].drain(ammountToDrain,false);
      if (liquidToPush != null) {
        int filled=internalTanks[ForgeDirection.UNKNOWN.ordinal()].fill(liquidToPush,true);
        internalTanks[direction.ordinal()].drain(filled,true);
      }
    }
  }
}

Fixed version (ground truth):
private void moveToCenter(){
  int transferInCount=0;
  LiquidStack stackInCenter=internalTanks[ForgeDirection.UNKNOWN.ordinal()].drain(flowRate,false);
  int spaceAvailable=internalTanks[ForgeDirection.UNKNOWN.ordinal()].getCapacity();
  if (stackInCenter != null) {
    spaceAvailable-=stackInCenter.amount;
  }
  for (  ForgeDirection dir : directions) {
    inputPerTick[dir.ordinal()]=0;
    if (transferState[dir.ordinal()] == TransferState.Output) {
      continue;
    }
    LiquidStack testStack=internalTanks[dir.ordinal()].drain(flowRate,false);
    if (testStack == null) {
      continue;
    }
    if (stackInCenter != null && !stackInCenter.isLiquidEqual(testStack)) {
      continue;
    }
    inputPerTick[dir.ordinal()]=testStack.amount;
    transferInCount++;
  }
  for (  ForgeDirection dir : directions) {
    if (transferState[dir.ordinal()] != TransferState.Output && inputPerTick[dir.ordinal()] > 0) {
      int ammountToDrain=(int)((double)inputPerTick[dir.ordinal()] / (double)flowRate / (double)transferInCount * (double)Math.min(flowRate,spaceAvailable));
      if (ammountToDrain < 1) {
        ammountToDrain++;
      }
      LiquidStack liquidToPush=internalTanks[dir.ordinal()].drain(ammountToDrain,false);
      if (liquidToPush != null) {
        int filled=internalTanks[ForgeDirection.UNKNOWN.ordinal()].fill(liquidToPush,true);
        internalTanks[dir.ordinal()].drain(filled,true);
      }
    }
  }
}
Program: 157004
Project: 157004
Buggy source:
public PipeLiquidsGold(int itemID){
  super(new PipeTransportLiquids(),new PipeLogicGold(),itemID);
  ((PipeTransportLiquids)transport).flowRate=80;
  ((PipeTransportLiquids)transport).travelDelay=4;
}

Fixed version (ground truth):
public PipeLiquidsGold(int itemID){
  super(new PipeTransportLiquids(),new PipeLogicGold(),itemID);
  ((PipeTransportLiquids)transport).flowRate=40;
  ((PipeTransportLiquids)transport).travelDelay=4;
}
Program: 157005
Project: 157005
Buggy source:
protected void drawForegroundSelection(int mouseX,int mouseY){
  String s="String_Node_Str";
  int cornerX=(width - xSize) / 2;
  int cornerY=(height - ySize) / 2;
  int position=getSlotAtLocation(mouseX - cornerX,mouseY - cornerY);
  if (position != -1) {
    AdvancedSlot slot=slots[position];
    if (slot != null)     s=slot.getDescription();
  }
  if (s.length() > 0) {
    int i2=(mouseX - cornerX);
    int k2=mouseY - cornerY;
    drawCreativeTabHoveringText(s,i2,k2);
  }
}

Fixed version (ground truth):
protected void drawForegroundSelection(int mouseX,int mouseY){
  String s="String_Node_Str";
  int cornerX=(width - xSize) / 2;
  int cornerY=(height - ySize) / 2;
  int position=getSlotAtLocation(mouseX - cornerX,mouseY - cornerY);
  if (position != -1) {
    AdvancedSlot slot=slots[position];
    if (slot != null)     s=slot.getDescription();
  }
  if (s.length() > 0) {
    int i2=(mouseX - cornerX);
    int k2=mouseY - cornerY;
    drawCreativeTabHoveringText(s,i2,k2);
    RenderHelper.enableGUIStandardItemLighting();
  }
}
Program: 157006
Project: 157006
Buggy source:
@Override public void setPowerProvider(IPowerProvider provider){
  provider=powerProvider;
}

Fixed version (ground truth):
@Override public void setPowerProvider(IPowerProvider provider){
  powerProvider=provider;
}
Program: 157007
Project: 157007
Buggy source:
public void step(){
  if (currentDate != worldObj.getWorldTime()) {
    currentDate=worldObj.getWorldTime();
    powerQuery=nextPowerQuery;
    nextPowerQuery=new int[]{0,0,0,0,0,0};
    double[] next=Arrays.copyOf(internalPower,6);
    internalPower=internalNextPower;
    internalNextPower=next;
    for (int i=0; i < nextPowerQuery.length; i++) {
      if (powerQuery[i] == 0.0d) {
        internalNextPower[i]-=1;
      }
    }
  }
}

Fixed version (ground truth):
public void step(){
  if (currentDate != worldObj.getWorldTime()) {
    currentDate=worldObj.getWorldTime();
    powerQuery=nextPowerQuery;
    nextPowerQuery=new int[]{0,0,0,0,0,0};
    double[] next=Arrays.copyOf(internalPower,6);
    internalPower=internalNextPower;
    internalNextPower=next;
    for (int i=0; i < nextPowerQuery.length; i++) {
      if (powerQuery[i] == 0.0d && internalNextPower[i] > 0) {
        internalNextPower[i]-=1;
      }
    }
  }
}
Program: 157008
Project: 157008
Buggy source:
public boolean findTarget(boolean doSet){
  if (worldObj.isRemote)   return false;
  boolean[][] blockedColumns=new boolean[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2];
  for (int searchY=yCoord + 3; searchY >= 0; --searchY) {
    int startX, endX, incX;
    if (searchY % 2 == 0) {
      startX=0;
      endX=bluePrintBuilder.bluePrint.sizeX - 2;
      incX=1;
    }
 else {
      startX=bluePrintBuilder.bluePrint.sizeX - 3;
      endX=-1;
      incX=-1;
    }
    for (int searchX=startX; searchX != endX; searchX+=incX) {
      int startZ, endZ, incZ;
      if (searchX % 2 == searchY % 2) {
        startZ=0;
        endZ=bluePrintBuilder.bluePrint.sizeZ - 2;
        incZ=1;
      }
 else {
        startZ=bluePrintBuilder.bluePrint.sizeZ - 3;
        endZ=-1;
        incZ=-1;
      }
      for (int searchZ=startZ; searchZ != endZ; searchZ+=incZ) {
        if (!blockedColumns[searchX][searchZ]) {
          int bx=box.xMin + searchX + 1, by=searchY, bz=box.zMin + searchZ + 1;
          int blockId=worldObj.getBlockId(bx,by,bz);
          if (!BlockUtil.canChangeBlock(worldObj,bx,by,bz)) {
            blockedColumns[searchX][searchZ]=true;
          }
 else           if (isQuarriableBlock(blockId,bx,by + 1,bz)) {
            if (doSet) {
              setTarget(bx,by + 1,bz);
            }
            return true;
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean findTarget(boolean doSet){
  if (worldObj.isRemote)   return false;
  boolean[][] blockedColumns=new boolean[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2];
  for (int searchY=yCoord + 3; searchY >= 0; --searchY) {
    int startX, endX, incX;
    if (searchY % 2 == 0) {
      startX=0;
      endX=bluePrintBuilder.bluePrint.sizeX - 2;
      incX=1;
    }
 else {
      startX=bluePrintBuilder.bluePrint.sizeX - 3;
      endX=-1;
      incX=-1;
    }
    for (int searchX=startX; searchX != endX; searchX+=incX) {
      int startZ, endZ, incZ;
      if (searchX % 2 == searchY % 2) {
        startZ=0;
        endZ=bluePrintBuilder.bluePrint.sizeZ - 2;
        incZ=1;
      }
 else {
        startZ=bluePrintBuilder.bluePrint.sizeZ - 3;
        endZ=-1;
        incZ=-1;
      }
      for (int searchZ=startZ; searchZ != endZ; searchZ+=incZ) {
        if (!blockedColumns[searchX][searchZ]) {
          int bx=box.xMin + searchX + 1, by=searchY, bz=box.zMin + searchZ + 1;
          if (!BlockUtil.canChangeBlock(worldObj,bx,by,bz)) {
            blockedColumns[searchX][searchZ]=true;
          }
 else           if (!BlockUtil.isSoftBlock(worldObj,bx,by,bz)) {
            if (doSet) {
              setTarget(bx,by + 1,bz);
            }
            return true;
          }
        }
      }
    }
  }
  return false;
}
Program: 157009
Project: 157009
Buggy source:
public void positionReached(){
  inProcess=false;
  if (worldObj.isRemote) {
    return;
  }
  int i=targetX;
  int j=targetY - 1;
  int k=targetZ;
  int blockId=worldObj.getBlockId(i,j,k);
  if (isQuarriableBlock(blockId,i,j,k)) {
    powerProvider.getTimeTracker().markTime(worldObj);
    ArrayList<ItemStack> stacks=BlockUtil.getItemStackFromBlock(worldObj,i,j,k);
    if (stacks != null) {
      for (      ItemStack s : stacks) {
        if (s != null) {
          mineStack(s);
        }
      }
    }
    worldObj.playAuxSFXAtEntity(null,2001,i,j,k,blockId + (worldObj.getBlockMetadata(i,j,k) << 12));
    worldObj.setBlockWithNotify(i,j,k,0);
  }
  double[] head=getHead();
  AxisAlignedBB axis=AxisAlignedBB.getBoundingBox(head[0] - 1.5,head[1],head[2] - 1.5,head[0] + 2.5,head[1] + 2.5,head[2] + 2.5);
  List result=worldObj.getEntitiesWithinAABB(EntityItem.class,axis);
  for (int ii=0; ii < result.size(); ii++) {
    if (result.get(ii) instanceof EntityItem) {
      EntityItem entity=(EntityItem)result.get(ii);
      if (entity.isDead)       continue;
      if (entity.item.stackSize <= 0)       continue;
      CoreProxy.proxy.removeEntity(entity);
      mineStack(entity.item);
    }
  }
}

Fixed version (ground truth):
public void positionReached(){
  inProcess=false;
  if (worldObj.isRemote) {
    return;
  }
  int i=targetX;
  int j=targetY - 1;
  int k=targetZ;
  int blockId=worldObj.getBlockId(i,j,k);
  if (isQuarriableBlock(i,j,k)) {
    powerProvider.getTimeTracker().markTime(worldObj);
    ArrayList<ItemStack> stacks=BlockUtil.getItemStackFromBlock(worldObj,i,j,k);
    if (stacks != null) {
      for (      ItemStack s : stacks) {
        if (s != null) {
          mineStack(s);
        }
      }
    }
    worldObj.playAuxSFXAtEntity(null,2001,i,j,k,blockId + (worldObj.getBlockMetadata(i,j,k) << 12));
    worldObj.setBlockWithNotify(i,j,k,0);
  }
  double[] head=getHead();
  AxisAlignedBB axis=AxisAlignedBB.getBoundingBox(head[0] - 1.5,head[1],head[2] - 1.5,head[0] + 2.5,head[1] + 2.5,head[2] + 2.5);
  List result=worldObj.getEntitiesWithinAABB(EntityItem.class,axis);
  for (int ii=0; ii < result.size(); ii++) {
    if (result.get(ii) instanceof EntityItem) {
      EntityItem entity=(EntityItem)result.get(ii);
      if (entity.isDead)       continue;
      if (entity.item.stackSize <= 0)       continue;
      CoreProxy.proxy.removeEntity(entity);
      mineStack(entity.item);
    }
  }
}
Program: 157010
Project: 157010
Buggy source:
private boolean isQuarriableBlock(int blockID,int bx,int by,int bz){
  return BlockUtil.canChangeBlock(worldObj,bx,by,bz) && !BlockUtil.isSoftBlock(worldObj,bx,by,bz);
}

Fixed version (ground truth):
private boolean isQuarriableBlock(int bx,int by,int bz){
  return BlockUtil.canChangeBlock(worldObj,bx,by,bz) && !BlockUtil.isSoftBlock(worldObj,bx,by,bz);
}
Program: 157011
Project: 157011
Buggy source:
private void handleTileReached(EntityData data,TileEntity tile){
  if (tile instanceof IPipeEntry)   ((IPipeEntry)tile).entityEntering(data.item,data.output);
 else   if (tile instanceof TileGenericPipe && ((TileGenericPipe)tile).pipe.transport instanceof PipeTransportItems) {
    TileGenericPipe pipe=(TileGenericPipe)tile;
    ((PipeTransportItems)pipe.pipe.transport).entityEntering(data.item,data.output);
  }
 else   if (tile instanceof IInventory) {
    if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
      ItemStack added=Transactor.getTransactorFor(tile).add(data.item.getItemStack(),data.output.reverse(),true);
      data.item.getItemStack().stackSize-=added.stackSize;
      if (data.item.getItemStack().stackSize > 0) {
        data.toCenter=true;
        data.input=data.output.reverse();
        unscheduleRemoval(data.item);
        entityEntering(data.item,data.output.reverse());
      }
    }
  }
 else {
    if (travelHook != null)     travelHook.drop(this,data);
    EntityItem dropped=data.item.toEntityItem(data.output);
    if (dropped != null)     onDropped(dropped);
  }
}

Fixed version (ground truth):
private void handleTileReached(EntityData data,TileEntity tile){
  if (tile instanceof IPipeEntry)   ((IPipeEntry)tile).entityEntering(data.item,data.output);
 else   if (tile instanceof TileGenericPipe && ((TileGenericPipe)tile).pipe.transport instanceof PipeTransportItems) {
    TileGenericPipe pipe=(TileGenericPipe)tile;
    ((PipeTransportItems)pipe.pipe.transport).entityEntering(data.item,data.output);
  }
 else   if (tile instanceof IInventory) {
    if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
      ItemStack added=Transactor.getTransactorFor(tile).add(data.item.getItemStack(),data.output.reverse(),true);
      data.item.getItemStack().stackSize-=added.stackSize;
      if (data.item.getItemStack().stackSize > 0) {
        unscheduleRemoval(data.item);
        reverseItem(data);
      }
    }
  }
 else {
    if (travelHook != null)     travelHook.drop(this,data);
    EntityItem dropped=data.item.toEntityItem(data.output);
    if (dropped != null)     onDropped(dropped);
  }
}
Program: 157012
Project: 157012
Buggy source:
/** 
 * Constructor for outgoing packets
 * @param x, y, z - the coordinates the tile to sync
 */
public PacketTileState(int x,int y,int z){
  super(PacketIds.STATE_UPDATE,x,y,z);
}

Fixed version (ground truth):
/** 
 * Constructor for outgoing packets
 * @param x, y, z - the coordinates the tile to sync
 */
public PacketTileState(int x,int y,int z){
  super(PacketIds.STATE_UPDATE,x,y,z);
  isChunkDataPacket=true;
}