nus-yam/ex-repair huggingface dataset:
Program: 169480
Project: 169480
Buggy source:
@Override public void init(FMLInitializationEvent ev){
}

Fixed version (ground truth):
@Override public void init(FMLInitializationEvent ev){
  RedstoneApi.getInstance().registerRedstoneProvider(new RedstoneProviderCC());
  RedstoneApi.getInstance().registerBundledUpdateHandler(new BundledUpdateHandlerCC());
}
Program: 169481
Project: 169481
Buggy source:
@Override public void preInit(FMLPreInitializationEvent ev){
  ComputerCraftAPI.registerPeripheralProvider(PeripheralProvider.INSTANCE);
}

Fixed version (ground truth):
@Override public void preInit(FMLPreInitializationEvent ev){
  ComputerCraftAPI.registerPeripheralProvider(PeripheralProvider.INSTANCE);
  ComputerCraftAPI.registerBundledRedstoneProvider(new BundledRedstoneProviderCC());
}
Program: 169482
Project: 169482
Buggy source:
@Override @SideOnly(Side.CLIENT) protected IIcon getSideIcon(ForgeDirection side){
  return getPartCache(side) instanceof MagTube ? IconSupplier.magTubeSide : IconSupplier.pneumaticTubeSide;
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) protected IIcon getSideIcon(){
  return null;
}
Program: 169483
Project: 169483
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  Block block=world.getBlock(x,y,z);
  if (player.isSneaking()) {
    ITilePartHolder itph=MultipartCompatibility.getPartHolder(world,new Vec3i(x,y,z));
    if (itph != null) {
      QMovingObjectPosition mop=itph.rayTrace(RayTracer.instance().getStartVector(player),RayTracer.instance().getEndVector(player));
      if (mop == null)       return false;
      IPart p=mop.getPart();
      if (p instanceof BPPartFaceRotate) {
        ((BPPartFaceRotate)p).setRotation((((BPPartFaceRotate)p).getRotation() + 1) % 4);
      }
    }
  }
  if (block instanceof BlockContainerBase) {
    if (((BlockContainerBase)block).getGuiID() != GuiIDs.INVALID) {
      if (player.isSneaking()) {
        block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
        if (!player.capabilities.isCreativeMode) {
          stack.setItemDamage(stack.getItemDamage() + 1);
        }
      }
    }
 else     if (block.getValidRotations(world,x,y,z).length > 1) {
      block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
      if (!player.capabilities.isCreativeMode) {
        stack.setItemDamage(stack.getItemDamage() + 1);
      }
    }
  }
 else   if (block.getValidRotations(world,x,y,z).length > 1) {
    block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
    if (!player.capabilities.isCreativeMode) {
      stack.setItemDamage(stack.getItemDamage() + 1);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  Block block=world.getBlock(x,y,z);
  if (player.isSneaking()) {
    ITilePartHolder itph=MultipartCompatibility.getPartHolder(world,new Vec3i(x,y,z));
    if (itph != null) {
      QMovingObjectPosition mop=itph.rayTrace(RayTracer.instance().getStartVector(player),RayTracer.instance().getEndVector(player));
      if (mop == null)       return false;
      IPart p=mop.getPart();
      if (p instanceof BPPartFaceRotate) {
        ((BPPartFaceRotate)p).setRotation((((BPPartFaceRotate)p).getRotation() + 1) % 4);
      }
    }
  }
  if (block instanceof BlockContainerBase) {
    if (((BlockContainerBase)block).getGuiID() != GuiIDs.INVALID) {
      if (player.isSneaking()) {
        block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
        if (!player.capabilities.isCreativeMode)         stack.damageItem(1,player);
      }
    }
 else {
      if (block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side)) && !player.capabilities.isCreativeMode)       stack.damageItem(1,player);
    }
  }
 else {
    if (block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side)) && !player.capabilities.isCreativeMode)     stack.damageItem(1,player);
  }
  return false;
}
Program: 169484
Project: 169484
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  Block block=world.getBlock(x,y,z);
  if (player.isSneaking()) {
    ITilePartHolder itph=MultipartCompatibility.getPartHolder(world,new Vec3i(x,y,z));
    if (itph != null) {
      QMovingObjectPosition mop=itph.rayTrace(RayTracer.instance().getStartVector(player),RayTracer.instance().getEndVector(player));
      if (mop == null)       return false;
      IPart p=mop.getPart();
      if (p instanceof BPPartFaceRotate) {
        ((BPPartFaceRotate)p).setRotation((((BPPartFaceRotate)p).getRotation() + 1) % 4);
      }
    }
  }
  if (block instanceof BlockContainerBase) {
    if (((BlockContainerBase)block).getGuiID() != GuiIDs.INVALID) {
      if (player.isSneaking()) {
        block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
        if (!player.capabilities.isCreativeMode) {
          stack.setItemDamage(stack.getItemDamage() + 1);
        }
      }
    }
 else {
      block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
      if (!player.capabilities.isCreativeMode) {
        stack.setItemDamage(stack.getItemDamage() + 1);
      }
    }
  }
 else {
    block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
    if (!player.capabilities.isCreativeMode) {
      stack.setItemDamage(stack.getItemDamage() + 1);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  Block block=world.getBlock(x,y,z);
  if (player.isSneaking()) {
    ITilePartHolder itph=MultipartCompatibility.getPartHolder(world,new Vec3i(x,y,z));
    if (itph != null) {
      QMovingObjectPosition mop=itph.rayTrace(RayTracer.instance().getStartVector(player),RayTracer.instance().getEndVector(player));
      if (mop == null)       return false;
      IPart p=mop.getPart();
      if (p instanceof BPPartFaceRotate) {
        ((BPPartFaceRotate)p).setRotation((((BPPartFaceRotate)p).getRotation() + 1) % 4);
      }
    }
  }
  if (block instanceof BlockContainerBase) {
    if (((BlockContainerBase)block).getGuiID() != GuiIDs.INVALID) {
      if (player.isSneaking()) {
        block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
        if (!player.capabilities.isCreativeMode) {
          stack.setItemDamage(stack.getItemDamage() + 1);
        }
      }
    }
 else     if (block.getValidRotations(world,x,y,z).length > 1) {
      block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
      if (!player.capabilities.isCreativeMode) {
        stack.setItemDamage(stack.getItemDamage() + 1);
      }
    }
  }
 else   if (block.getValidRotations(world,x,y,z).length > 1) {
    block.rotateBlock(world,x,y,z,ForgeDirection.getOrientation(side));
    if (!player.capabilities.isCreativeMode) {
      stack.setItemDamage(stack.getItemDamage() + 1);
    }
  }
  return false;
}
Program: 169485
Project: 169485
Buggy source:
@Override public boolean renderStatic(Vec3i translation,RenderHelper renderer,RenderBlocks renderBlocks,int pass){
switch (getFace()) {
case DOWN:
    break;
case UP:
  renderer.addTransformation(new Rotation(180,180,0,Vec3d.center));
break;
case NORTH:
renderer.addTransformation(new Rotation(90,0,0,Vec3d.center));
break;
case SOUTH:
renderer.addTransformation(new Rotation(-90,0,0,Vec3d.center));
break;
case WEST:
renderer.addTransformation(new Rotation(0,0,-90,Vec3d.center));
break;
case EAST:
renderer.addTransformation(new Rotation(0,0,90,Vec3d.center));
break;
default :
break;
}
int rotation=getRotation();
renderer.addTransformation(new Rotation(0,90 * -rotation,0));
if (rendering == null) rendering=this;
renderer.renderBox(BOX.clone().expand(-0.001),getIcon(ForgeDirection.DOWN),getIcon(ForgeDirection.UP),getIcon(ForgeDirection.WEST),getIcon(ForgeDirection.EAST),getIcon(ForgeDirection.NORTH),getIcon(ForgeDirection.SOUTH));
rendering=null;
return true;
}

Fixed version (ground truth):
@Override public boolean renderStatic(Vec3i translation,RenderHelper renderer,RenderBlocks renderBlocks,int pass){
switch (getFace()) {
case DOWN:
    break;
case UP:
  renderer.addTransformation(new Rotation(180,180,0,Vec3d.center));
break;
case NORTH:
renderer.addTransformation(new Rotation(90,0,0,Vec3d.center));
break;
case SOUTH:
renderer.addTransformation(new Rotation(-90,0,0,Vec3d.center));
break;
case WEST:
renderer.addTransformation(new Rotation(0,0,-90,Vec3d.center));
break;
case EAST:
renderer.addTransformation(new Rotation(0,0,90,Vec3d.center));
break;
default :
break;
}
int rotation=getRotation();
renderer.addTransformation(new Rotation(0,90 * -rotation,0));
if (rendering == null) rendering=this;
renderer.renderBox(BOX.clone().expand(-0.001),getIcon(ForgeDirection.DOWN),getIcon(ForgeDirection.UP),getIcon(ForgeDirection.WEST),getIcon(ForgeDirection.EAST),getIcon(ForgeDirection.NORTH),getIcon(ForgeDirection.SOUTH));
rendering=null;
renderer.resetTransformations();
return true;
}
Program: 169486
Project: 169486
Buggy source:
public RedstoneConnection getConnection(ForgeDirection direction){
  try {
    return connections[Dir.getDirection(direction,getFace(),getRotation()).ordinal()];
  }
 catch (  Exception ex) {
  }
  return null;
}

Fixed version (ground truth):
public RedstoneConnection getConnection(ForgeDirection direction){
  for (  RedstoneConnection c : connections)   if (c.getDirection().toForgeDirection(getFace(),getRotation()) == direction)   return c;
  return null;
}
Program: 169488
Project: 169488
Buggy source:
@Override public int[] getAccessibleSlotsFromSide(int var1){
  ForgeDirection access=ForgeDirection.getOrientation(var1);
  ForgeDirection dir=ForgeDirection.getOrientation(getBlockMetadata());
  if (access == dir) {
    int[] allSlots=new int[allInventories.length];
    for (int i=0; i < allSlots.length; i++)     allSlots[i]=i;
    return allSlots;
  }
  if (var1 > dir.getOpposite().ordinal())   var1--;
  int[] slots=new int[4];
  for (int i=0; i < 4; i++) {
    slots[i]=var1 + i * 5;
  }
  return slots;
}

Fixed version (ground truth):
@Override public int[] getAccessibleSlotsFromSide(int var1){
  ForgeDirection access=ForgeDirection.getOrientation(var1);
  ForgeDirection dir=getFacingDirection();
  if (access == dir) {
    int[] allSlots=new int[allInventories.length];
    for (int i=0; i < allSlots.length; i++)     allSlots[i]=i;
    return allSlots;
  }
  if (var1 > dir.getOpposite().ordinal())   var1--;
  int[] slots=new int[4];
  for (int i=0; i < 4; i++) {
    slots[i]=var1 + i * 5;
  }
  return slots;
}
Program: 169489
Project: 169489
Buggy source:
@Override public void onNeighborBlockChange(World world,int x,int y,int z,Block block){
  super.onNeighborBlockChange(world,x,y,z,block);
  if ((world.getBlockMetadata(x,y,z) == 7) && (world.getBlock(x,y + 1,z) == Blocks.air)) {
    world.setBlockMetadataWithNotify(x,y,z,5,2);
  }
  this.checkAndDropBlock(world,x,y,z);
}

Fixed version (ground truth):
@Override public void onNeighborBlockChange(World world,int x,int y,int z,Block block){
  super.onNeighborBlockChange(world,x,y,z,block);
  if ((world.getBlockMetadata(x,y,z) == 7) && (world.getBlock(x,y + 1,z) == Blocks.air)) {
    world.setBlockMetadataWithNotify(x,y,z,5,2);
  }
  if ((world.getBlockMetadata(x,y,z) == 8) && (world.getBlockMetadata(x,y - 1,z) != 7)) {
    world.setBlockToAir(x,y,z);
  }
  if ((world.getBlockMetadata(x,y,z) < 8) && (world.getBlock(x,y - 1,z) instanceof BlockCrop)) {
    world.setBlockToAir(x,y,z);
  }
  this.checkAndDropBlock(world,x,y,z);
}
Program: 169490
Project: 169490
Buggy source:
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase entity,EntityLivingBase player){
  this.damageDealt=athameMaterial.getDamageVsEntity();
  if ((entity instanceof EntityEnderman) || (entity instanceof EntityDragon)) {
    this.damageDealt+=25.0F;
  }
  entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)player),this.damageDealt);
  return super.hitEntity(stack,entity,player);
}

Fixed version (ground truth):
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase entity,EntityLivingBase player){
  this.damageDealt=athameMaterial.getDamageVsEntity();
  if ((entity instanceof EntityEnderman) || (entity instanceof EntityDragon)) {
    this.damageDealt+=18.0F;
  }
  entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)player),this.damageDealt);
  return super.hitEntity(stack,entity,player);
}
Program: 169491
Project: 169491
Buggy source:
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  return (world.getBlock(x,y - 1,z) instanceof BlockFarmland) || (world.getBlock(x,y - 1,z) instanceof BlockCrop);
}

Fixed version (ground truth):
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  return (world.getBlock(x,y - 1,z) instanceof BlockFarmland) || ((world.getBlock(x,y - 1,z) instanceof BlockCrop) && (world.getBlockMetadata(x,y - 1,z) != 7));
}
Program: 169492
Project: 169492
Buggy source:
/** 
 * Ticks the block if it's been scheduled
 */
@Override public void updateTick(World world,int x,int y,int z,Random random){
  super.updateTick(world,x,y,z,random);
  if (world.getBlockLightValue(x,y + 1,z) >= 9) {
    int meta=world.getBlockMetadata(x,y,z);
    if ((meta == 4) || (meta == 5)) {
      return;
    }
    if (!(world.getBlock(x,y - 1,z) instanceof BlockFarmland) || (world.getBlock(x,y - 1,z) == BPBlocks.flax_crop) || (!world.isAirBlock(x,y + 1,z))) {
      return;
    }
    if (random.nextInt(45) == 0) {
      world.setBlockMetadataWithNotify(x,y,z,meta + 1,2);
    }
    if ((meta > 6) && (world.getBlock(x,y - 1,z) instanceof BlockFarmland) && (world.getBlock(x,y + 1,z) instanceof BlockAir)) {
      if (meta == 7) {
        world.setBlock(x,y + 1,z,BPBlocks.flax_crop,8,2);
      }
      world.setBlockMetadataWithNotify(x,y,z,7,2);
    }
    if ((meta > 7) && (world.getBlock(x,y - 1,z) instanceof BlockFarmland)) {
      world.setBlockMetadataWithNotify(x,y,z,7,2);
      world.setBlock(x,y + 1,z,BPBlocks.flax_crop,8,2);
    }
    if ((meta < 8) && ((world.getBlock(x,y - 1,z) instanceof BlockCrop))) {
      world.setBlockToAir(x,y,z);
    }
  }
}

Fixed version (ground truth):
/** 
 * Ticks the block if it's been scheduled
 */
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (world.getBlockLightValue(x,y + 1,z) >= 9) {
    int meta=world.getBlockMetadata(x,y,z);
    if (!(world.getBlock(x,y - 1,z) instanceof BlockFarmland) || (world.getBlock(x,y - 1,z) == BPBlocks.flax_crop) || (!world.isAirBlock(x,y + 1,z))) {
      return;
    }
    if ((meta > 6) && (world.getBlock(x,y - 1,z) instanceof BlockFarmland) && (world.getBlock(x,y + 1,z) instanceof BlockAir)) {
      if (meta == 7) {
        world.setBlock(x,y + 1,z,BPBlocks.flax_crop,8,2);
      }
      world.setBlockMetadataWithNotify(x,y,z,7,2);
    }
    if ((meta > 7) && (world.getBlock(x,y - 1,z) instanceof BlockFarmland)) {
      world.setBlockMetadataWithNotify(x,y,z,7,2);
      world.setBlock(x,y + 1,z,BPBlocks.flax_crop,8,2);
    }
    if (random.nextInt(30) == 0) {
      world.setBlockMetadataWithNotify(x,y,z,meta + 1,2);
    }
  }
}
Program: 169493
Project: 169493
Buggy source:
public ContainerSortingMachine(InventoryPlayer invPlayer,TileSortingMachine sortingMachine){
  this.sortingMachine=sortingMachine;
  for (int i=0; i < 5; i++) {
    for (int j=0; j < 8; j++) {
      addSlotToContainer(new SlotPhantom(sortingMachine,i * 8 + j,26 + j * 18,18 + i * 18));
    }
  }
  bindPlayerInventory(invPlayer);
}

Fixed version (ground truth):
public ContainerSortingMachine(InventoryPlayer invPlayer,TileSortingMachine sortingMachine){
  this.sortingMachine=sortingMachine;
  for (int i=0; i < 5; i++) {
    for (int j=0; j < 8; j++) {
      addSlotToContainer(new SlotPhantom(sortingMachine,i * 8 + j,26 + j * 18,18 + i * 18));
    }
  }
  bindPlayerInventory(invPlayer);
  Arrays.fill(colors,-1);
  Arrays.fill(fuzzySettings,-1);
}
Program: 169494
Project: 169494
Buggy source:
private void generateLavaColumn(World world,int x,int topY,int z,Random rand){
  if (rand.nextDouble() < Config.volcanoActiveToInactiveRatio) {
    world.setBlock(x,topY,z,BPBlocks.cracked_basalt_lava);
  }
 else {
    world.setBlock(x,topY + 1,z,Blocks.lava);
    world.setBlock(x,topY,z,Blocks.lava);
  }
  for (int y=topY - 1; y >= 10; y--) {
    world.setBlock(x + 1,y,z,BPBlocks.basalt,0,0);
    world.setBlock(x - 1,y,z,BPBlocks.basalt,0,0);
    world.setBlock(x,y,z + 1,BPBlocks.basalt,0,0);
    world.setBlock(x,y,z - 1,BPBlocks.basalt,0,0);
    world.setBlock(x,y,z,Blocks.lava,0,0);
  }
}

Fixed version (ground truth):
private void generateLavaColumn(World world,int x,int topY,int z,Random rand){
  if (rand.nextDouble() < Config.volcanoActiveToInactiveRatio) {
    world.setBlock(x,topY,z,BPBlocks.cracked_basalt_lava);
  }
 else {
    world.setBlock(x,topY + 1,z,Blocks.lava);
    world.setBlock(x,topY,z,Blocks.lava);
  }
  for (int y=topY - 1; y >= 10; y--) {
    world.setBlock(x + 1,y,z,BPBlocks.basalt,0,2);
    world.setBlock(x - 1,y,z,BPBlocks.basalt,0,2);
    world.setBlock(x,y,z + 1,BPBlocks.basalt,0,2);
    world.setBlock(x,y,z - 1,BPBlocks.basalt,0,2);
    world.setBlock(x,y,z,Blocks.lava,0,2);
  }
}
Program: 169495
Project: 169495
Buggy source:
public void generate(World world,Random rand,int middleX,int vulcanoHeight,int middleZ){
  List<Pos>[] distMap=calculateDistMap();
  boolean first=true;
  for (int dist=0; dist < distMap.length; dist++) {
    List<Pos> distList=distMap[dist];
    boolean isFinished=true;
    for (    Pos p : distList) {
      int worldHeight=world.getHeightValue(p.x + middleX,p.z + middleZ) - 1;
      int posHeight=first ? vulcanoHeight : getNewVulcanoHeight(worldHeight,p,rand,dist);
      if (posHeight >= 0 && (posHeight > worldHeight || canReplace(world,p.x + middleX,posHeight,p.z + middleZ))) {
        vulcanoMap.put(p,posHeight);
        if (!first) {
          for (int i=posHeight; i > 0 && (i > worldHeight || canReplace(world,p.x + middleX,i,p.z + middleZ)); i--) {
            world.setBlock(p.x + middleX,i,p.z + middleZ,BPBlocks.basalt,0,0);
          }
          for (int i=posHeight + 1; i < vulcanoHeight; i++) {
            if (canReplace(world,p.x + middleX,i,p.z + middleZ) && world.getBlock(p.x + middleX,i,p.z + middleZ).getMaterial() != Material.water)             world.setBlock(p.x + middleX,i,p.z + middleZ,Blocks.air,0,0);
          }
        }
        isFinished=false;
      }
      first=false;
    }
    if (isFinished)     break;
  }
  generateLavaColumn(world,middleX,vulcanoHeight,middleZ,rand);
}

Fixed version (ground truth):
public void generate(World world,Random rand,int middleX,int vulcanoHeight,int middleZ){
  List<Pos>[] distMap=calculateDistMap();
  boolean first=true;
  for (int dist=0; dist < distMap.length; dist++) {
    List<Pos> distList=distMap[dist];
    boolean isFinished=true;
    for (    Pos p : distList) {
      int worldHeight=world.getHeightValue(p.x + middleX,p.z + middleZ) - 1;
      int posHeight=first ? vulcanoHeight : getNewVulcanoHeight(worldHeight,p,rand,dist);
      if (posHeight >= 0 && (posHeight > worldHeight || canReplace(world,p.x + middleX,posHeight,p.z + middleZ))) {
        vulcanoMap.put(p,posHeight);
        if (!first) {
          for (int i=posHeight; i > 0 && (i > worldHeight || canReplace(world,p.x + middleX,i,p.z + middleZ)); i--) {
            world.setBlock(p.x + middleX,i,p.z + middleZ,BPBlocks.basalt,0,2);
          }
          for (int i=posHeight + 1; i < vulcanoHeight; i++) {
            if (canReplace(world,p.x + middleX,i,p.z + middleZ) && world.getBlock(p.x + middleX,i,p.z + middleZ).getMaterial() != Material.water)             world.setBlock(p.x + middleX,i,p.z + middleZ,Blocks.air,0,2);
          }
        }
        isFinished=false;
      }
      first=false;
    }
    if (isFinished)     break;
  }
  generateLavaColumn(world,middleX,vulcanoHeight,middleZ,rand);
}
Program: 169496
Project: 169496
Buggy source:
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  return (world.getBlock(x,y - 1,z) instanceof BlockFarmland) || ((world.getBlock(x,y - 1,z) instanceof BlockCrop) && (world.getBlockMetadata(x,y - 1,z) != 7));
}

Fixed version (ground truth):
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  if ((world.getBlock(x,y - 1,z) instanceof BlockFarmland) && (world.getBlock(x,y - 1,z).isFertile(world,x,y - 1,z))) {
    return true;
  }
  if ((world.getBlock(x,y - 1,z) instanceof BlockCrop) && (world.getBlockMetadata(x,y - 1,z) == 7)) {
    return true;
  }
  return false;
}
Program: 169497
Project: 169497
Buggy source:
@Override public TubeStack acceptItemFromTube(TubeStack stack,ForgeDirection from,boolean simulate){
  if (from == getOutputDirection()) {
    return super.acceptItemFromTube(stack,from,simulate);
  }
 else {
    boolean success=tryProcessItem(stack.stack,simulate);
    if (success) {
      if (stack.stack.stackSize <= 0) {
        return null;
      }
 else {
        return stack;
      }
    }
 else {
      return stack;
    }
  }
}

Fixed version (ground truth):
@Override public TubeStack acceptItemFromTube(TubeStack stack,ForgeDirection from,boolean simulate){
  if (from == getOutputDirection()) {
    return super.acceptItemFromTube(stack,from,simulate);
  }
 else {
    boolean success=!ItemStack.areItemStacksEqual(stack.stack,nonAcceptedStack) && tryProcessItem(stack.stack,simulate);
    if (success) {
      nonAcceptedStack=stack.stack;
      if (stack.stack.stackSize <= 0) {
        return null;
      }
 else {
        return stack;
      }
    }
 else {
      return stack;
    }
  }
}
Program: 169498
Project: 169498
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (!sweepTriggered && savedPulses > 0) {
    savedPulses--;
    sweepTriggered=true;
  }
  if (!worldObj.isRemote && worldObj.getWorldTime() % TileMachineBase.BUFFER_EMPTY_INTERVAL == 0 && (pullMode == PullMode.SINGLE_SWEEP && sweepTriggered || pullMode == PullMode.AUTOMATIC)) {
    triggerSorting();
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  nonAcceptedStack=null;
  super.updateEntity();
  if (!sweepTriggered && savedPulses > 0) {
    savedPulses--;
    sweepTriggered=true;
  }
  if (!worldObj.isRemote && worldObj.getWorldTime() % TileMachineBase.BUFFER_EMPTY_INTERVAL == 0 && (pullMode == PullMode.SINGLE_SWEEP && sweepTriggered || pullMode == PullMode.AUTOMATIC)) {
    triggerSorting();
  }
}
Program: 169499
Project: 169499
Buggy source:
public static void registerParts(){
  PartRegistry.registerFactory(new PartFactory());
  registerPart(GateAnd.class);
}

Fixed version (ground truth):
public static void registerParts(){
  PartRegistry.registerFactory(new PartFactory());
  registerPart(GateAnd.class);
  registerPart(GateNot.class);
}
Program: 169500
Project: 169500
Buggy source:
@Override public void registerIcons(IIconRegister reg){
  iconBottom=reg.registerIcon(Refs.MODID + "String_Node_Str");
  iconSide=reg.registerIcon(Refs.MODID + "String_Node_Str");
  iconTop=reg.registerIcon(Refs.MODID + "String_Node_Str" + getId()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void registerIcons(IIconRegister reg){
  if (iconBottom == null)   iconBottom=reg.registerIcon(Refs.MODID + "String_Node_Str");
  if (iconSide == null)   iconSide=reg.registerIcon(Refs.MODID + "String_Node_Str");
  iconTop=reg.registerIcon(Refs.MODID + "String_Node_Str" + getId()+ "String_Node_Str");
}
Program: 169501
Project: 169501
Buggy source:
@Override public IIcon getIcon(IBlockAccess w,int x,int y,int z,int face){
  ForgeDirection f=ForgeDirection.getOrientation(face);
  if (f == rendering.getFace())   return iconBottom;
  if (f == rendering.getFace().getOpposite())   return iconTop;
  return iconSide;
}

Fixed version (ground truth):
@Override public IIcon getIcon(IBlockAccess w,int x,int y,int z,int face){
  ForgeDirection f=ForgeDirection.getOrientation(face);
  if (f == rendering.getFace())   return iconBottom;
  if (f == rendering.getFace().getOpposite())   return ((GateBase)PartManager.getExample(rendering.getType())).iconTop;
  return iconSide;
}
Program: 169502
Project: 169502
Buggy source:
@Override public String getSavePath(){
  String mcDataLocation=Minecraft.getMinecraft().mcDataDir.getAbsolutePath();
  return mcDataLocation.substring(0,mcDataLocation.length() - 2);
}

Fixed version (ground truth):
@Override public String getSavePath(){
  return Minecraft.getMinecraft().mcDataDir.getAbsolutePath();
}
Program: 169503
Project: 169503
Buggy source:
public String getSavePath(){
  String mcDataLocation=FMLServerHandler.instance().getSavesDirectory().getAbsolutePath();
  return mcDataLocation.substring(0,mcDataLocation.length() - 2);
}

Fixed version (ground truth):
public String getSavePath(){
  return FMLServerHandler.instance().getSavesDirectory().getAbsolutePath();
}
Program: 169504
Project: 169504
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void propagate(List<Entry<WireBluestone,Integer>> wires,int[] power,int colorId){
  if (!isBundled)   recalculatePower();
  wires.add(new AbstractMap.SimpleEntry(this,isBundled ? colorId : this.colorId));
  power[0]=Math.max(power[0],powerSelf);
  for (int i=0; i < 6; i++)   if (connections[i] != null)   if (connections[i] instanceof WireBluestone)   if (((WireBluestone)connections[i]).colorId == colorId || colorId == -1 || ((WireBluestone)connections[i]).colorId == -1)   if (!isInList(wires,(WireBluestone)connections[i]))   ((WireBluestone)connections[i]).propagate(wires,power,isBundled ? colorId : this.colorId);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void propagate(List<Entry<WireBluestone,Integer>> wires,int[] power,int colorId){
  if (!isBundled)   recalculatePower();
  wires.add(new AbstractMap.SimpleEntry(this,isBundled ? colorId : this.colorId));
  power[0]=Math.max(power[0],powerSelf);
  for (int i=0; i < 6; i++)   if (connections[i] != null)   if (connections[i] instanceof WireBluestone)   if (((WireBluestone)connections[i]).colorId == this.colorId || this.colorId == -1 || ((WireBluestone)connections[i]).colorId == -1)   if (!isInList(wires,(WireBluestone)connections[i]))   ((WireBluestone)connections[i]).propagate(wires,power,isBundled ? colorId : this.colorId);
}
Program: 169505
Project: 169505
Buggy source:
private void suckEntity(){
  ForgeDirection direction=getFacingDirection();
  AxisAlignedBB box=AxisAlignedBB.getBoundingBox(xCoord + direction.offsetX,yCoord + direction.offsetY,zCoord + direction.offsetZ,xCoord + direction.offsetX + 1,yCoord + direction.offsetY + 1,zCoord + direction.offsetZ + 1);
  for (  EntityItem entity : (List<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class,box)) {
    ItemStack stack=entity.getEntityItem();
    if (isItemAccepted(stack)) {
      addItemToOutputBuffer(stack,getAcceptedItemColor(stack));
      entity.setDead();
    }
  }
}

Fixed version (ground truth):
private void suckEntity(){
  ForgeDirection direction=getFacingDirection();
  AxisAlignedBB box=AxisAlignedBB.getBoundingBox(xCoord + direction.offsetX,yCoord + direction.offsetY,zCoord + direction.offsetZ,xCoord + direction.offsetX + 1,yCoord + direction.offsetY + 1,zCoord + direction.offsetZ + 1);
  for (  EntityItem entity : (List<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class,box)) {
    ItemStack stack=entity.getEntityItem();
    if (isItemAccepted(stack) && !entity.isDead) {
      addItemToOutputBuffer(stack,getAcceptedItemColor(stack));
      entity.setDead();
    }
  }
}
Program: 169506
Project: 169506
Buggy source:
@EventHandler public void preInit(FMLPreInitializationEvent event){
  event.getModMetadata().version=Refs.fullVersionString();
  log=event.getModLog();
  config=new Configuration(event.getSuggestedConfigurationFile());
  BPApi.init(new BluePowerAPI());
  Config.syncConfig(config);
  BPBlocks.init();
  BPItems.init();
  TileEntities.init();
  OreDictionarySetup.init();
  GameRegistry.registerWorldGenerator(new WorldGenerationHandler(),0);
  BPEnchantments.init();
  CompatibilityUtils.preInit(event);
  FMLCommonHandler.instance().bus().register(new Config());
  BPEventHandler eventHandler=new BPEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  FMLCommonHandler.instance().bus().register(eventHandler);
  PartRegister.registerParts();
  BPApi.getInstance().getBluestoneApi();
}

Fixed version (ground truth):
@EventHandler public void preInit(FMLPreInitializationEvent event){
  event.getModMetadata().version=Refs.fullVersionString();
  log=event.getModLog();
  config=new Configuration(event.getSuggestedConfigurationFile());
  BPApi.init(new BluePowerAPI());
  Config.syncConfig(config);
  PartRegister.registerParts();
  BPBlocks.init();
  BPItems.init();
  TileEntities.init();
  OreDictionarySetup.init();
  GameRegistry.registerWorldGenerator(new WorldGenerationHandler(),0);
  BPEnchantments.init();
  CompatibilityUtils.preInit(event);
  FMLCommonHandler.instance().bus().register(new Config());
  BPEventHandler eventHandler=new BPEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  FMLCommonHandler.instance().bus().register(eventHandler);
  BPApi.getInstance().getBluestoneApi();
}
Program: 169507
Project: 169507
Buggy source:
public static void init(){
  OreDictionary.registerOre("String_Node_Str",BPBlocks.copper_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.zinc_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.silver_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.tungsten_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.marble);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.basalt);
  OreDictionary.registerOre("String_Node_Str",BPItems.ruby_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.amethyst_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.sapphire_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.teslatite_dust);
  OreDictionary.registerOre("String_Node_Str",BPItems.copper_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.zinc_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.silver_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.brass_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.tungsten_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.indigo_dye);
  OreDictionary.registerOre("String_Node_Str",BPItems.blue_alloy_ingot);
}

Fixed version (ground truth):
public static void init(){
  OreDictionary.registerOre("String_Node_Str",BPBlocks.copper_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.zinc_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.silver_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.tungsten_ore);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.marble);
  OreDictionary.registerOre("String_Node_Str",BPBlocks.basalt);
  OreDictionary.registerOre("String_Node_Str",BPItems.ruby_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.amethyst_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.sapphire_gem);
  OreDictionary.registerOre("String_Node_Str",BPItems.teslatite_dust);
  OreDictionary.registerOre("String_Node_Str",BPItems.copper_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.zinc_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.silver_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.brass_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.tungsten_ingot);
  OreDictionary.registerOre("String_Node_Str",BPItems.indigo_dye);
  OreDictionary.registerOre("String_Node_Str",BPItems.blue_alloy_ingot);
  for (int i=0; i < 16; i++) {
    OreDictionary.registerOre("String_Node_Str",PartRegistry.getInstance().getItemForPart("String_Node_Str" + ItemDye.field_150921_b[i]));
  }
}
Program: 169508
Project: 169508
Buggy source:
@Override protected void pullItem(){
  if (isBufferEmpty()) {
    TileEntity extractingInventory=getTileCache()[getFacingDirection().ordinal()].getTileEntity();
    IMultipartCompat compat=(IMultipartCompat)CompatibilityUtils.getModule(Dependencies.FMP);
    PneumaticTube tube=compat.getBPPart(extractingInventory,PneumaticTube.class);
    if (tube != null) {
      boolean everythingNull=true;
      for (int i=0; i < inventory.length; i++) {
        if (mode == 1 || slotIndex == i) {
          ItemStack stack=inventory[i];
          if (stack != null) {
            if (tube.getLogic().retrieveStack(this,getFacingDirection(),stack)) {
              if (mode == 0) {
                slotIndex++;
                while (slotIndex != i) {
                  if (inventory[slotIndex] != null)                   break;
                  if (++slotIndex >= inventory.length)                   slotIndex=0;
                }
              }
              return;
            }
            everythingNull=false;
          }
        }
      }
      if (everythingNull) {
        tube.getLogic().retrieveStack(this,getFacingDirection(),null);
        slotIndex=0;
      }
    }
 else {
      super.pullItem();
    }
  }
}

Fixed version (ground truth):
@Override protected void pullItem(){
  if (isBufferEmpty()) {
    TileEntity extractingInventory=getTileCache()[getFacingDirection().ordinal()].getTileEntity();
    IMultipartCompat compat=(IMultipartCompat)CompatibilityUtils.getModule(Dependencies.FMP);
    PneumaticTube tube=compat.getBPPart(extractingInventory,PneumaticTube.class);
    if (tube != null) {
      boolean everythingNull=true;
      for (int i=0; i < inventory.length; i++) {
        if (mode == 1 || slotIndex == i) {
          ItemStack stack=inventory[i];
          if (stack != null) {
            if (tube.getLogic().retrieveStack(this,getFacingDirection(),stack)) {
              if (mode == 0) {
                if (++slotIndex >= inventory.length)                 slotIndex=0;
                while (slotIndex != i) {
                  if (inventory[slotIndex] != null)                   break;
                  if (++slotIndex >= inventory.length)                   slotIndex=0;
                }
              }
              return;
            }
            everythingNull=false;
          }
        }
      }
      if (everythingNull) {
        tube.getLogic().retrieveStack(this,getFacingDirection(),null);
        slotIndex=0;
      }
    }
 else {
      super.pullItem();
    }
  }
}
Program: 169510
Project: 169510
Buggy source:
public static int getItemCount(ItemStack type,TileEntity inv,ForgeDirection side,int fuzzySetting){
  IInventory inventory=getInventoryForTE(inv);
  int[] slots=getAccessibleSlotsForInventory(inventory,side);
  int count=0;
  for (  int slot : slots) {
    ItemStack invStack=inventory.getStackInSlot(slot);
    if (invStack != null) {
      if (WidgetFuzzySetting.areStacksEqual(invStack,type,fuzzySetting)) {
        count+=invStack.stackSize;
      }
    }
  }
  return count;
}

Fixed version (ground truth):
public static int getItemCount(ItemStack type,TileEntity inv,ForgeDirection side,int fuzzySetting){
  IInventory inventory=getInventoryForTE(inv);
  int[] slots=getAccessibleSlotsForInventory(inventory,side);
  int count=0;
  for (  int slot : slots) {
    ItemStack invStack=inventory.getStackInSlot(slot);
    if (invStack != null) {
      if (ItemStackHelper.areStacksEqual(invStack,type,fuzzySetting)) {
        count+=invStack.stackSize;
      }
    }
  }
  return count;
}
Program: 169511
Project: 169511
Buggy source:
/** 
 * compares ItemStack argument to the instance ItemStack; returns true if both ItemStacks are equal
 */
public static boolean areItemStacksEqual(ItemStack itemStack1,ItemStack itemStack2){
  return itemStack1 == null && itemStack2 == null || (!(itemStack1 == null || itemStack2 == null) && (itemStack1.getItem() == itemStack2.getItem() && (itemStack1.getItemDamage() == itemStack2.getItemDamage() && (!(itemStack1.stackTagCompound == null && itemStack2.stackTagCompound != null) && (itemStack1.stackTagCompound == null || itemStack1.stackTagCompound.equals(itemStack2.stackTagCompound))))));
}

Fixed version (ground truth):
/** 
 * compares ItemStack argument to the instance ItemStack; returns true if both ItemStacks are equal
 */
public static boolean areItemStacksEqual(ItemStack itemStack1,ItemStack itemStack2){
  return itemStack1 == null && itemStack2 == null || !(itemStack1 == null || itemStack2 == null) && itemStack1.getItem() == itemStack2.getItem() && itemStack1.getItemDamage() == itemStack2.getItemDamage() && !(itemStack1.stackTagCompound == null && itemStack2.stackTagCompound != null) && (itemStack1.stackTagCompound == null || itemStack1.stackTagCompound.equals(itemStack2.stackTagCompound));
}
Program: 169512
Project: 169512
Buggy source:
@Override protected boolean isItemAccepted(ItemStack item){
  boolean everythingNull=true;
  for (  ItemStack invStack : inventory) {
    if (invStack != null) {
      if (WidgetFuzzySetting.areStacksEqual(invStack,item,fuzzySetting)) {
        return true;
      }
      everythingNull=false;
    }
  }
  return everythingNull;
}

Fixed version (ground truth):
@Override protected boolean isItemAccepted(ItemStack item){
  boolean everythingNull=true;
  for (  ItemStack invStack : inventory) {
    if (invStack != null) {
      if (ItemStackHelper.areStacksEqual(invStack,item,fuzzySetting)) {
        return true;
      }
      everythingNull=false;
    }
  }
  return everythingNull;
}
Program: 169513
Project: 169513
Buggy source:
private boolean isItemAccepted(ItemStack item){
  boolean everythingNull=true;
  for (  ItemStack invStack : inventory) {
    if (invStack != null) {
      if (WidgetFuzzySetting.areStacksEqual(invStack,item,fuzzySetting)) {
        return true;
      }
      everythingNull=false;
    }
  }
  return everythingNull;
}

Fixed version (ground truth):
private boolean isItemAccepted(ItemStack item){
  boolean everythingNull=true;
  for (  ItemStack invStack : inventory) {
    if (invStack != null) {
      if (ItemStackHelper.areStacksEqual(invStack,item,fuzzySetting)) {
        return true;
      }
      everythingNull=false;
    }
  }
  return everythingNull;
}
Program: 169514
Project: 169514
Buggy source:
private int getItemsInSection(ItemStack type,EnumSection section){
  int count=0;
  for (int i=section.ordinal() * 9; i < section.ordinal() * 9 + 9; i++) {
    if (inventory[i] != null && WidgetFuzzySetting.areStacksEqual(type,inventory[i],fuzzySetting))     count+=inventory[i].stackSize;
  }
  return count;
}

Fixed version (ground truth):
private int getItemsInSection(ItemStack type,EnumSection section){
  int count=0;
  for (int i=section.ordinal() * 9; i < section.ordinal() * 9 + 9; i++) {
    if (inventory[i] != null && ItemStackHelper.areStacksEqual(type,inventory[i],fuzzySetting))     count+=inventory[i].stackSize;
  }
  return count;
}
Program: 169516
Project: 169516
Buggy source:
/** 
 * Returns true if the supplying inventory has the items stated in the output filter.
 * @return
 */
private boolean isSatisfied(){
  IInventory inv=IOHelper.getInventoryForTE(getTileCache()[getOutputDirection().ordinal()].getTileEntity());
  if (inv != null) {
    int[] accessibleSlots;
    if (inv instanceof ISidedInventory) {
      accessibleSlots=((ISidedInventory)inv).getAccessibleSlotsFromSide(getFacingDirection().ordinal());
    }
 else {
      accessibleSlots=new int[inv.getSizeInventory()];
      for (int i=0; i < accessibleSlots.length; i++)       accessibleSlots[i]=i;
    }
    boolean everythingNull=true;
    for (int i=18; i < 27; i++) {
      if (inventory[i] != null) {
        everythingNull=false;
        int outputFilterItems=getItemsInSection(inventory[i],EnumSection.OUTPUT_FILTER);
        int supplyingInvCount=0;
        for (        int slot : accessibleSlots) {
          ItemStack stackInSlot=inv.getStackInSlot(slot);
          if (stackInSlot != null && WidgetFuzzySetting.areStacksEqual(stackInSlot,inventory[i],fuzzySetting) && IOHelper.canInsertItemToInventory(inv,inventory[i],slot,getFacingDirection().ordinal())) {
            supplyingInvCount+=stackInSlot.stackSize;
          }
        }
        if (supplyingInvCount < outputFilterItems)         return false;
      }
    }
    return !everythingNull;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if the supplying inventory has the items stated in the output filter.
 * @return
 */
private boolean isSatisfied(){
  IInventory inv=IOHelper.getInventoryForTE(getTileCache()[getOutputDirection().ordinal()].getTileEntity());
  if (inv != null) {
    int[] accessibleSlots;
    if (inv instanceof ISidedInventory) {
      accessibleSlots=((ISidedInventory)inv).getAccessibleSlotsFromSide(getFacingDirection().ordinal());
    }
 else {
      accessibleSlots=new int[inv.getSizeInventory()];
      for (int i=0; i < accessibleSlots.length; i++)       accessibleSlots[i]=i;
    }
    boolean everythingNull=true;
    for (int i=18; i < 27; i++) {
      if (inventory[i] != null) {
        everythingNull=false;
        int outputFilterItems=getItemsInSection(inventory[i],EnumSection.OUTPUT_FILTER);
        int supplyingInvCount=0;
        for (        int slot : accessibleSlots) {
          ItemStack stackInSlot=inv.getStackInSlot(slot);
          if (stackInSlot != null && ItemStackHelper.areStacksEqual(stackInSlot,inventory[i],fuzzySetting) && IOHelper.canInsertItemToInventory(inv,inventory[i],slot,getFacingDirection().ordinal())) {
            supplyingInvCount+=stackInSlot.stackSize;
          }
        }
        if (supplyingInvCount < outputFilterItems)         return false;
      }
    }
    return !everythingNull;
  }
  return false;
}
Program: 169517
Project: 169517
Buggy source:
private boolean tryProcessItem(ItemStack stack,boolean simulate){
switch (sortMode) {
case ANYSTACK_SEQUENTIAL:
    break;
case ALLSTACK_SEQUENTIAL:
  break;
case RANDOM_ALLSTACKS:
break;
case ANY_ITEM:
case ANY_ITEM_DEFAULT:
for (int i=0; i < inventory.length; i++) {
ItemStack filter=inventory[i];
if (filter != null && WidgetFuzzySetting.areStacksEqual(filter,stack,fuzzySettings[i % 8]) && stack.stackSize >= filter.stackSize) {
  if (!simulate) {
    addItemToOutputBuffer(filter.copy(),colors[i % 8]);
    stack.stackSize-=filter.stackSize;
  }
  return true;
}
}
if (sortMode == SortMode.ANY_ITEM_DEFAULT) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[8]);
stack.stackSize=0;
}
return true;
}
break;
case ANY_STACK:
case ANY_STACK_DEFAULT:
for (int i=0; i < inventory.length; i++) {
ItemStack filter=inventory[i];
if (filter != null && WidgetFuzzySetting.areStacksEqual(filter,stack,fuzzySettings[i % 8])) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[i % 8]);
stack.stackSize=0;
}
return true;
}
}
if (sortMode == SortMode.ANY_STACK_DEFAULT) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[8]);
stack.stackSize=0;
}
return true;
}
break;
}
return false;
}

Fixed version (ground truth):
private boolean tryProcessItem(ItemStack stack,boolean simulate){
switch (sortMode) {
case ANYSTACK_SEQUENTIAL:
    break;
case ALLSTACK_SEQUENTIAL:
  break;
case RANDOM_ALLSTACKS:
break;
case ANY_ITEM:
case ANY_ITEM_DEFAULT:
for (int i=0; i < inventory.length; i++) {
ItemStack filter=inventory[i];
if (filter != null && ItemStackHelper.areStacksEqual(filter,stack,fuzzySettings[i % 8]) && stack.stackSize >= filter.stackSize) {
  if (!simulate) {
    addItemToOutputBuffer(filter.copy(),colors[i % 8]);
    stack.stackSize-=filter.stackSize;
  }
  return true;
}
}
if (sortMode == SortMode.ANY_ITEM_DEFAULT) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[8]);
stack.stackSize=0;
}
return true;
}
break;
case ANY_STACK:
case ANY_STACK_DEFAULT:
for (int i=0; i < inventory.length; i++) {
ItemStack filter=inventory[i];
if (filter != null && ItemStackHelper.areStacksEqual(filter,stack,fuzzySettings[i % 8])) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[i % 8]);
stack.stackSize=0;
}
return true;
}
}
if (sortMode == SortMode.ANY_STACK_DEFAULT) {
if (!simulate) {
addItemToOutputBuffer(stack.copy(),colors[8]);
stack.stackSize=0;
}
return true;
}
break;
}
return false;
}
Program: 169519
Project: 169519
Buggy source:
@EventHandler public void preInit(FMLPreInitializationEvent event){
  event.getModMetadata().version=Refs.fullVersionString();
  log=event.getModLog();
  config=new Configuration(event.getSuggestedConfigurationFile());
  BPApi.init(new BluePowerAPI());
  CustomTabs.init();
  Config.syncConfig(config);
  BPBlocks.init();
  BPItems.init();
  TileEntities.init();
  OreDictionarySetup.init();
  GameRegistry.registerWorldGenerator(new WorldGenerationHandler(),0);
  BPEnchantments.init();
  CompatibilityUtils.preInit(event);
  FMLCommonHandler.instance().bus().register(new Config());
  BPEventHandler eventHandler=new BPEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  FMLCommonHandler.instance().bus().register(eventHandler);
  PartRegister.registerParts();
  BPApi.getInstance().getBluestoneApi();
}

Fixed version (ground truth):
@EventHandler public void preInit(FMLPreInitializationEvent event){
  event.getModMetadata().version=Refs.fullVersionString();
  log=event.getModLog();
  config=new Configuration(event.getSuggestedConfigurationFile());
  BPApi.init(new BluePowerAPI());
  Config.syncConfig(config);
  BPBlocks.init();
  BPItems.init();
  TileEntities.init();
  OreDictionarySetup.init();
  GameRegistry.registerWorldGenerator(new WorldGenerationHandler(),0);
  BPEnchantments.init();
  CompatibilityUtils.preInit(event);
  FMLCommonHandler.instance().bus().register(new Config());
  BPEventHandler eventHandler=new BPEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  FMLCommonHandler.instance().bus().register(eventHandler);
  PartRegister.registerParts();
  BPApi.getInstance().getBluestoneApi();
}