nus-yam/ex-repair huggingface dataset:
Program: 8277
Project: 8277
Buggy source:
/** 
 * Carves in an AOE. Charge affects the breadth and/or depth of the AOE. Optional per-block EMC cost.
 */
protected void digAOE(ItemStack stack,World world,EntityPlayer player,boolean affectDepth,int emcCost){
  if (world.isRemote || this.getCharge(stack) == 0) {
    return;
  }
  MovingObjectPosition mop=this.getMovingObjectPositionFromPlayer(world,player,false);
  if (mop == null || mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) {
    return;
  }
  AxisAlignedBB box=affectDepth ? WorldHelper.getBroadDeepBox(new Coordinates(mop.blockX,mop.blockY,mop.blockZ),ForgeDirection.getOrientation(mop.sideHit),this.getCharge(stack)) : WorldHelper.getFlatYBox(new Coordinates(mop.blockX,mop.blockY,mop.blockZ),this.getCharge(stack));
  List<ItemStack> drops=Lists.newArrayList();
  for (int i=(int)box.minX; i <= box.maxX; i++)   for (int j=(int)box.minY; j <= box.maxY; j++)   for (int k=(int)box.minZ; k <= box.maxZ; k++) {
    Block b=world.getBlock(i,j,k);
    if (PlayerHelper.hasBreakPermission(world,((EntityPlayerMP)player),i,j,k) && b != Blocks.air && b.getBlockHardness(world,i,j,k) != -1 && canHarvestBlock(b,stack) && consumeFuel(player,stack,emcCost,true)) {
      drops.addAll(WorldHelper.getBlockDrops(world,player,b,stack,i,j,k));
      world.setBlockToAir(i,j,k);
    }
  }
  WorldHelper.createLootDrop(drops,world,mop.blockX,mop.blockY,mop.blockZ);
  PlayerHelper.swingItem(player);
  if (!drops.isEmpty()) {
    world.playSoundAtEntity(player,"String_Node_Str",1.0F,1.0F);
  }
}

Fixed version (ground truth):
/** 
 * Carves in an AOE. Charge affects the breadth and/or depth of the AOE. Optional per-block EMC cost.
 */
protected void digAOE(ItemStack stack,World world,EntityPlayer player,boolean affectDepth,int emcCost){
  if (world.isRemote || this.getCharge(stack) == 0) {
    return;
  }
  MovingObjectPosition mop=this.getMovingObjectPositionFromPlayer(world,player,false);
  if (mop == null || mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) {
    return;
  }
  AxisAlignedBB box=affectDepth ? WorldHelper.getBroadDeepBox(new Coordinates(mop.blockX,mop.blockY,mop.blockZ),ForgeDirection.getOrientation(mop.sideHit),this.getCharge(stack)) : WorldHelper.getFlatYBox(new Coordinates(mop.blockX,mop.blockY,mop.blockZ),this.getCharge(stack));
  List<ItemStack> drops=Lists.newArrayList();
  for (int i=(int)box.minX; i <= box.maxX; i++)   for (int j=(int)box.minY; j <= box.maxY; j++)   for (int k=(int)box.minZ; k <= box.maxZ; k++) {
    Block b=world.getBlock(i,j,k);
    if (b != Blocks.air && b.getBlockHardness(world,i,j,k) != -1 && canHarvestBlock(b,stack) && PlayerHelper.hasBreakPermission(((EntityPlayerMP)player),i,j,k) && consumeFuel(player,stack,emcCost,true)) {
      drops.addAll(WorldHelper.getBlockDrops(world,player,b,stack,i,j,k));
      world.setBlockToAir(i,j,k);
    }
  }
  WorldHelper.createLootDrop(drops,world,mop.blockX,mop.blockY,mop.blockZ);
  PlayerHelper.swingItem(player);
  if (!drops.isEmpty()) {
    world.playSoundAtEntity(player,"String_Node_Str",1.0F,1.0F);
  }
}
Program: 8278
Project: 8278
Buggy source:
/** 
 * Called when tools that act as shears start breaking a block. Free operation.
 */
protected void shearBlock(ItemStack stack,int x,int y,int z,EntityPlayer player){
  if (player.worldObj.isRemote) {
    return;
  }
  Block block=player.worldObj.getBlock(x,y,z);
  if (block instanceof IShearable) {
    IShearable target=(IShearable)block;
    if (target.isShearable(stack,player.worldObj,x,y,z) && PlayerHelper.hasBreakPermission(player.worldObj,((EntityPlayerMP)player),x,y,z)) {
      ArrayList<ItemStack> drops=target.onSheared(stack,player.worldObj,x,y,z,EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId,stack));
      Random rand=new Random();
      for (      ItemStack drop : drops) {
        float f=0.7F;
        double d=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem=new EntityItem(player.worldObj,(double)x + d,(double)y + d1,(double)z + d2,drop);
        entityitem.delayBeforeCanPickup=10;
        player.worldObj.spawnEntityInWorld(entityitem);
      }
      stack.damageItem(1,player);
      player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)],1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when tools that act as shears start breaking a block. Free operation.
 */
protected void shearBlock(ItemStack stack,int x,int y,int z,EntityPlayer player){
  if (player.worldObj.isRemote) {
    return;
  }
  Block block=player.worldObj.getBlock(x,y,z);
  if (block instanceof IShearable) {
    IShearable target=(IShearable)block;
    if (target.isShearable(stack,player.worldObj,x,y,z) && PlayerHelper.hasBreakPermission(((EntityPlayerMP)player),x,y,z)) {
      ArrayList<ItemStack> drops=target.onSheared(stack,player.worldObj,x,y,z,EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId,stack));
      Random rand=new Random();
      for (      ItemStack drop : drops) {
        float f=0.7F;
        double d=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2=(double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem=new EntityItem(player.worldObj,(double)x + d,(double)y + d1,(double)z + d2,drop);
        entityitem.delayBeforeCanPickup=10;
        player.worldObj.spawnEntityInWorld(entityitem);
      }
      stack.damageItem(1,player);
      player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)],1);
    }
  }
}
Program: 8279
Project: 8279
Buggy source:
/** 
 * Deforests in an AOE. Charge affects the AOE. Optional per-block EMC cost.
 */
protected void deforestAOE(World world,ItemStack stack,EntityPlayer player,int emcCost){
  byte charge=getCharge(stack);
  if (charge == 0 || world.isRemote) {
    return;
  }
  List<ItemStack> drops=Lists.newArrayList();
  for (int x=(int)player.posX - (5 * charge); x <= player.posX + (5 * charge); x++)   for (int y=(int)player.posY - (10 * charge); y <= player.posY + (10 * charge); y++)   for (int z=(int)player.posZ - (5 * charge); z <= player.posZ + (5 * charge); z++) {
    Block block=world.getBlock(x,y,z);
    if (block == Blocks.air) {
      continue;
    }
    ItemStack s=new ItemStack(block);
    int[] oreIds=OreDictionary.getOreIDs(s);
    if (oreIds.length == 0) {
      continue;
    }
    String oreName=OreDictionary.getOreName(oreIds[0]);
    if (oreName.equals("String_Node_Str") || oreName.equals("String_Node_Str")) {
      ArrayList<ItemStack> blockDrops=WorldHelper.getBlockDrops(world,player,block,stack,x,y,z);
      if (!blockDrops.isEmpty() && PlayerHelper.hasBreakPermission(world,((EntityPlayerMP)player),x,y,z) && consumeFuel(player,stack,emcCost,true)) {
        drops.addAll(blockDrops);
        world.setBlockToAir(x,y,z);
      }
    }
  }
  WorldHelper.createLootDrop(drops,world,player.posX,player.posY,player.posZ);
  PlayerHelper.swingItem(player);
}

Fixed version (ground truth):
/** 
 * Deforests in an AOE. Charge affects the AOE. Optional per-block EMC cost.
 */
protected void deforestAOE(World world,ItemStack stack,EntityPlayer player,int emcCost){
  byte charge=getCharge(stack);
  if (charge == 0 || world.isRemote) {
    return;
  }
  List<ItemStack> drops=Lists.newArrayList();
  for (int x=(int)player.posX - (5 * charge); x <= player.posX + (5 * charge); x++)   for (int y=(int)player.posY - (10 * charge); y <= player.posY + (10 * charge); y++)   for (int z=(int)player.posZ - (5 * charge); z <= player.posZ + (5 * charge); z++) {
    Block block=world.getBlock(x,y,z);
    if (block == Blocks.air) {
      continue;
    }
    ItemStack s=new ItemStack(block);
    int[] oreIds=OreDictionary.getOreIDs(s);
    if (oreIds.length == 0) {
      continue;
    }
    String oreName=OreDictionary.getOreName(oreIds[0]);
    if (oreName.equals("String_Node_Str") || oreName.equals("String_Node_Str")) {
      ArrayList<ItemStack> blockDrops=WorldHelper.getBlockDrops(world,player,block,stack,x,y,z);
      if (!blockDrops.isEmpty() && PlayerHelper.hasBreakPermission(((EntityPlayerMP)player),x,y,z) && consumeFuel(player,stack,emcCost,true)) {
        drops.addAll(blockDrops);
        world.setBlockToAir(x,y,z);
      }
    }
  }
  WorldHelper.createLootDrop(drops,world,player.posX,player.posY,player.posZ);
  PlayerHelper.swingItem(player);
}
Program: 8281
Project: 8281
Buggy source:
/** 
 * Recursively mines out a vein of the given Block, starting from the provided coordinates
 */
public static void harvestVein(World world,EntityPlayer player,ItemStack stack,Coordinates coords,Block target,List<ItemStack> currentDrops,int numMined){
  if (numMined >= Constants.MAX_VEIN_SIZE) {
    return;
  }
  AxisAlignedBB b=AxisAlignedBB.getBoundingBox(coords.x - 1,coords.y - 1,coords.z - 1,coords.x + 1,coords.y + 1,coords.z + 1);
  for (int x=(int)b.minX; x <= b.maxX; x++)   for (int y=(int)b.minY; y <= b.maxY; y++)   for (int z=(int)b.minZ; z <= b.maxZ; z++) {
    Block block=world.getBlock(x,y,z);
    if (block == target || (target == Blocks.lit_redstone_ore && block == Blocks.redstone_ore)) {
      if (PlayerHelper.hasBreakPermission(world,((EntityPlayerMP)player),x,y,z)) {
        currentDrops.addAll(getBlockDrops(world,player,block,stack,x,y,z));
        world.setBlockToAir(x,y,z);
      }
      numMined++;
      harvestVein(world,player,stack,new Coordinates(x,y,z),target,currentDrops,numMined);
    }
  }
}

Fixed version (ground truth):
/** 
 * Recursively mines out a vein of the given Block, starting from the provided coordinates
 */
public static void harvestVein(World world,EntityPlayer player,ItemStack stack,Coordinates coords,Block target,List<ItemStack> currentDrops,int numMined){
  if (numMined >= Constants.MAX_VEIN_SIZE) {
    return;
  }
  AxisAlignedBB b=AxisAlignedBB.getBoundingBox(coords.x - 1,coords.y - 1,coords.z - 1,coords.x + 1,coords.y + 1,coords.z + 1);
  for (int x=(int)b.minX; x <= b.maxX; x++)   for (int y=(int)b.minY; y <= b.maxY; y++)   for (int z=(int)b.minZ; z <= b.maxZ; z++) {
    Block block=world.getBlock(x,y,z);
    if (block == target || (target == Blocks.lit_redstone_ore && block == Blocks.redstone_ore)) {
      if (PlayerHelper.hasBreakPermission(((EntityPlayerMP)player),x,y,z)) {
        currentDrops.addAll(getBlockDrops(world,player,block,stack,x,y,z));
        world.setBlockToAir(x,y,z);
      }
      numMined++;
      harvestVein(world,player,stack,new Coordinates(x,y,z),target,currentDrops,numMined);
    }
  }
}
Program: 8282
Project: 8282
Buggy source:
public static void extinguishNearby(World world,EntityPlayer player){
  for (int x=(int)(player.posX - 1); x <= player.posX + 1; x++)   for (int y=(int)(player.posY - 1); y <= player.posY + 1; y++)   for (int z=(int)(player.posZ - 1); z <= player.posZ + 1; z++)   if (world.getBlock(x,y,z) == Blocks.fire && PlayerHelper.hasBreakPermission(world,((EntityPlayerMP)player),x,y,z)) {
    world.setBlockToAir(x,y,z);
  }
}

Fixed version (ground truth):
public static void extinguishNearby(World world,EntityPlayer player){
  for (int x=(int)(player.posX - 1); x <= player.posX + 1; x++)   for (int y=(int)(player.posY - 1); y <= player.posY + 1; y++)   for (int z=(int)(player.posZ - 1); z <= player.posZ + 1; z++)   if (world.getBlock(x,y,z) == Blocks.fire && PlayerHelper.hasBreakPermission(((EntityPlayerMP)player),x,y,z)) {
    world.setBlockToAir(x,y,z);
  }
}
Program: 8283
Project: 8283
Buggy source:
public static void freezeInBoundingBox(World world,AxisAlignedBB box,EntityPlayer player,boolean random){
  for (int x=(int)box.minX; x <= box.maxX; x++) {
    for (int y=(int)box.minY; y <= box.maxY; y++) {
      for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block b=world.getBlock(x,y,z);
        if ((b == Blocks.water || b == Blocks.flowing_water) && (!random || world.rand.nextInt(128) == 0)) {
          if (player != null) {
            PlayerHelper.checkedPlaceBlock(((EntityPlayerMP)player),x,y,z,Blocks.ice,0);
          }
 else {
            world.setBlock(x,y,z,Blocks.ice);
          }
        }
 else         if (b.isSideSolid(world,x,y,z,ForgeDirection.UP)) {
          Block b2=world.getBlock(x,y + 1,z);
          if (b2 == Blocks.air && (!random || world.rand.nextInt(128) == 0)) {
            if (player != null) {
              PlayerHelper.checkedPlaceBlock(((EntityPlayerMP)player),x,y + 1,z,Blocks.snow_layer,0);
            }
 else {
              world.setBlock(x,y + 1,z,Blocks.snow_layer);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public static void freezeInBoundingBox(World world,AxisAlignedBB box,EntityPlayer player,boolean random){
  for (int x=(int)box.minX; x <= box.maxX; x++) {
    for (int y=(int)box.minY; y <= box.maxY; y++) {
      for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block b=world.getBlock(x,y,z);
        if ((b == Blocks.water || b == Blocks.flowing_water) && (!random || world.rand.nextInt(128) == 0)) {
          if (player != null) {
            PlayerHelper.checkedReplaceBlock(((EntityPlayerMP)player),x,y,z,Blocks.ice,0);
          }
 else {
            world.setBlock(x,y,z,Blocks.ice);
          }
        }
 else         if (b.isSideSolid(world,x,y,z,ForgeDirection.UP)) {
          Block b2=world.getBlock(x,y + 1,z);
          if (b2 == Blocks.air && (!random || world.rand.nextInt(128) == 0)) {
            if (player != null) {
              PlayerHelper.checkedReplaceBlock(((EntityPlayerMP)player),x,y + 1,z,Blocks.snow_layer,0);
            }
 else {
              world.setBlock(x,y + 1,z,Blocks.snow_layer);
            }
          }
        }
      }
    }
  }
}
Program: 8285
Project: 8285
Buggy source:
@Override public FixedValues deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  FixedValues fixed=new FixedValues();
  JsonObject o=json.getAsJsonObject();
  fixed.setValueBefore=parseSetValueMapFromObject(o,"String_Node_Str");
  fixed.setValueAfter=parseSetValueMapFromObject(o,"String_Node_Str");
  fixed.conversion=context.deserialize(o.getAsJsonArray("String_Node_Str"),new TypeToken<List<CustomConversion>>(){
  }
.getType());
  return fixed;
}

Fixed version (ground truth):
@Override public FixedValues deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  FixedValues fixed=new FixedValues();
  JsonObject o=json.getAsJsonObject();
  for (  Map.Entry<String,JsonElement> entry : o.entrySet()) {
    if (entry.getKey().equals("String_Node_Str")) {
      fixed.setValueBefore=parseSetValueMap(entry.getValue().getAsJsonObject());
    }
 else     if (entry.getKey().equals("String_Node_Str")) {
      fixed.setValueAfter=parseSetValueMap(entry.getValue().getAsJsonObject());
    }
 else     if (entry.getKey().equals("String_Node_Str")) {
      fixed.conversion=context.deserialize(entry.getValue().getAsJsonArray(),new TypeToken<List<CustomConversion>>(){
      }
.getType());
    }
 else {
      throw new JsonParseException(String.format("String_Node_Str",entry.getKey(),entry.getValue()));
    }
  }
  return fixed;
}
Program: 8286
Project: 8286
Buggy source:
@Override public void updateEntity(){
  centeredX=xCoord + 0.5;
  centeredY=yCoord + 0.5;
  centeredZ=zCoord + 0.5;
  if (effectBounds == null) {
    effectBounds=AxisAlignedBB.getBoundingBox(centeredX - 4.5,centeredY - 4.5,centeredZ - 4.5,centeredX + 4.5,centeredY + 4.5,centeredZ + 4.5);
  }
  if (getActive()) {
    if (getItemStack() != null) {
      Item item=getItemStack().getItem();
      if (item instanceof IPedestalItem) {
        ((IPedestalItem)item).updateInPedestal(worldObj,xCoord,yCoord,zCoord);
      }
      if (particleCooldown <= 0) {
        spawnParticles();
        particleCooldown=10;
      }
 else {
        particleCooldown--;
      }
    }
 else {
      setActive(false);
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  if (worldObj.isRemote) {
    if (worldObj.getChunkFromBlockCoords(xCoord,zCoord) instanceof EmptyChunk) {
      return;
    }
  }
  centeredX=xCoord + 0.5;
  centeredY=yCoord + 0.5;
  centeredZ=zCoord + 0.5;
  if (effectBounds == null) {
    effectBounds=AxisAlignedBB.getBoundingBox(centeredX - 4.5,centeredY - 4.5,centeredZ - 4.5,centeredX + 4.5,centeredY + 4.5,centeredZ + 4.5);
  }
  if (getActive()) {
    if (getItemStack() != null) {
      Item item=getItemStack().getItem();
      if (item instanceof IPedestalItem) {
        ((IPedestalItem)item).updateInPedestal(worldObj,xCoord,yCoord,zCoord);
      }
      if (particleCooldown <= 0) {
        spawnParticles();
        particleCooldown=10;
      }
 else {
        particleCooldown--;
      }
    }
 else {
      setActive(false);
    }
  }
}
Program: 8287
Project: 8287
Buggy source:
@Override public List<ItemStack> getKnowledge(UUID playerUUID){
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
    Preconditions.checkState(PECore.proxy.getClientPlayer() != null,"String_Node_Str");
    return Transmutation.getKnowledge(PECore.proxy.getClientPlayer());
  }
 else {
    Preconditions.checkState(Loader.instance().hasReachedState(LoaderState.SERVER_STARTED),"String_Node_Str");
    EntityPlayer player=findOnlinePlayer(playerUUID);
    if (player != null) {
      return Transmutation.getKnowledge(player);
    }
 else {
      return TransmutationOffline.getKnowledge(playerUUID);
    }
  }
}

Fixed version (ground truth):
@Override public List<ItemStack> getKnowledge(@Nonnull UUID playerUUID){
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
    Preconditions.checkState(PECore.proxy.getClientPlayer() != null,"String_Node_Str");
    return Transmutation.getKnowledge(PECore.proxy.getClientPlayer());
  }
 else {
    Preconditions.checkState(Loader.instance().hasReachedState(LoaderState.SERVER_STARTED),"String_Node_Str");
    EntityPlayer player=findOnlinePlayer(playerUUID);
    if (player != null) {
      return Transmutation.getKnowledge(player);
    }
 else {
      return TransmutationOffline.getKnowledge(playerUUID);
    }
  }
}
Program: 8288
Project: 8288
Buggy source:
@Override public void drawButton(Minecraft mc,int mouseX,int mouseY){
  if (this.visible) {
    boolean hover=mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
    mc.getTextureManager().bindTexture(bookGui);
    int u=0;
    int v=192;
    if (hover) {
      u+=bWidth;
    }
    if (!pointsRight) {
      v+=bHeight;
    }
    this.drawTexturedModalRect(this.xPosition,this.yPosition,u,v,bWidth,bHeight);
  }
}

Fixed version (ground truth):
@Override public void drawButton(Minecraft mc,int mouseX,int mouseY){
  if (this.visible) {
    boolean hover=mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
    mc.getTextureManager().bindTexture(bookGui);
    int u=0;
    int v=192;
    if (hover) {
      u+=bWidth;
    }
    if (!pointsRight) {
      v+=bHeight;
    }
    GL11.glEnable(GL11.GL_BLEND);
    this.drawTexturedModalRect(this.xPosition,this.yPosition,u,v,bWidth,bHeight);
    GL11.glDisable(GL11.GL_BLEND);
  }
}
Program: 8289
Project: 8289
Buggy source:
@Override public void loadNBTData(NBTTagCompound compound){
  NBTTagCompound properties=compound.getCompoundTag(PROP_NAME);
  NBTTagList listOfInventoies=properties.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  hasMigrated=properties.getBoolean("String_Node_Str");
  if (!hasMigrated && !player.worldObj.isRemote) {
    listOfInventoies=AlchemicalBags.migratePlayerData(player);
    PELogger.logInfo("String_Node_Str" + player.getCommandSenderName());
    hasMigrated=true;
  }
  for (int i=0; i < listOfInventoies.tagCount(); i++) {
    NBTTagCompound inventory=listOfInventoies.getCompoundTagAt(i);
    bagData.put(inventory.getInteger("String_Node_Str"),copyNBTToArray(inventory.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND)));
  }
}

Fixed version (ground truth):
@Override public void loadNBTData(NBTTagCompound compound){
  NBTTagCompound properties=compound.getCompoundTag(PROP_NAME);
  NBTTagList listOfInventoies=properties.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  hasMigrated=properties.getBoolean("String_Node_Str");
  if (!hasMigrated && !player.worldObj.isRemote) {
    if (AlchemicalBags.hasLegacyData(player)) {
      listOfInventoies=AlchemicalBags.migratePlayerData(player);
      PELogger.logInfo("String_Node_Str" + player.getCommandSenderName());
    }
    hasMigrated=true;
  }
  for (int i=0; i < listOfInventoies.tagCount(); i++) {
    NBTTagCompound inventory=listOfInventoies.getCompoundTagAt(i);
    bagData.put(inventory.getInteger("String_Node_Str"),copyNBTToArray(inventory.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND)));
  }
}
Program: 8290
Project: 8290
Buggy source:
@Override public void loadNBTData(NBTTagCompound compound){
  NBTTagCompound properties=compound.getCompoundTag(PROP_NAME);
  hasMigrated=properties.getBoolean("String_Node_Str");
  if (!hasMigrated && !player.worldObj.isRemote) {
    properties=Transmutation.migratePlayerData(player);
    PELogger.logInfo("String_Node_Str" + player.getCommandSenderName());
    hasMigrated=true;
  }
  transmutationEmc=properties.getDouble("String_Node_Str");
  hasFullKnowledge=properties.getBoolean("String_Node_Str");
  NBTTagList list=properties.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  knowledge.clear();
  for (int i=0; i < list.tagCount(); i++) {
    ItemStack item=ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
    if (item != null) {
      knowledge.add(item);
    }
  }
}

Fixed version (ground truth):
@Override public void loadNBTData(NBTTagCompound compound){
  NBTTagCompound properties=compound.getCompoundTag(PROP_NAME);
  hasMigrated=properties.getBoolean("String_Node_Str");
  if (!hasMigrated && !player.worldObj.isRemote) {
    if (Transmutation.hasLegacyData(player)) {
      properties=Transmutation.migratePlayerData(player);
      PELogger.logInfo("String_Node_Str" + player.getCommandSenderName());
    }
    hasMigrated=true;
  }
  transmutationEmc=properties.getDouble("String_Node_Str");
  hasFullKnowledge=properties.getBoolean("String_Node_Str");
  NBTTagList list=properties.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  knowledge.clear();
  for (int i=0; i < list.tagCount(); i++) {
    ItemStack item=ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
    if (item != null) {
      knowledge.add(item);
    }
  }
}
Program: 8291
Project: 8291
Buggy source:
public int getFuelProgressScaled(int i){
  if (inventory[0] == null || !FuelMapper.isStackFuel(inventory[0])) {
    return 0;
  }
  int reqEmc=0;
  if (inventory[lockSlot] != null) {
    reqEmc=EMCHelper.getEmcValue(inventory[lockSlot]) - EMCHelper.getEmcValue(inventory[0]);
    if (reqEmc < 0) {
      return 0;
    }
  }
 else {
    reqEmc=EMCHelper.getEmcValue(FuelMapper.getFuelUpgrade(inventory[0])) - EMCHelper.getEmcValue(inventory[0]);
  }
  if (this.getStoredEmc() >= reqEmc) {
    return i;
  }
  return displayEmc * i / reqEmc;
}

Fixed version (ground truth):
public int getFuelProgressScaled(int i){
  if (inventory[0] == null || !FuelMapper.isStackFuel(inventory[0])) {
    return 0;
  }
  int reqEmc=0;
  if (inventory[lockSlot] != null) {
    reqEmc=EMCHelper.getEmcValue(inventory[lockSlot]) - EMCHelper.getEmcValue(inventory[0]);
    if (reqEmc < 0) {
      return 0;
    }
  }
 else {
    if (FuelMapper.getFuelUpgrade(inventory[0]) == null) {
      this.setInventorySlotContents(0,null);
      return 0;
    }
 else {
      reqEmc=EMCHelper.getEmcValue(FuelMapper.getFuelUpgrade(inventory[0])) - EMCHelper.getEmcValue(inventory[0]);
    }
  }
  if (this.getStoredEmc() >= reqEmc) {
    return i;
  }
  return displayEmc * i / reqEmc;
}
Program: 8293
Project: 8293
Buggy source:
public int getFuelProgressScaled(int i){
  if (inventory[0] == null || !FuelMapper.isStackFuel(inventory[0])) {
    return 0;
  }
  int reqEmc=0;
  if (inventory[lockSlot] != null) {
    reqEmc=Utils.getEmcValue(inventory[lockSlot]) - Utils.getEmcValue(inventory[0]);
    if (reqEmc < 0) {
      return 0;
    }
  }
 else {
    reqEmc=Utils.getEmcValue(FuelMapper.getFuelUpgrade(inventory[0])) - Utils.getEmcValue(inventory[0]);
  }
  if (this.getStoredEmc() >= reqEmc) {
    return i;
  }
  return displayEmc * i / reqEmc;
}

Fixed version (ground truth):
public int getFuelProgressScaled(int i){
  if (inventory[0] == null || !FuelMapper.isStackFuel(inventory[0])) {
    return 0;
  }
  int reqEmc=0;
  if (inventory[lockSlot] != null) {
    reqEmc=Utils.getEmcValue(inventory[lockSlot]) - Utils.getEmcValue(inventory[0]);
    if (reqEmc < 0) {
      return 0;
    }
  }
 else {
    reqEmc=Utils.getEmcValue(FuelMapper.getFuelUpgrade(inventory[0])) - Utils.getEmcValue(inventory[0]);
  }
  if (displayEmc >= reqEmc) {
    return i;
  }
  return displayEmc * i / reqEmc;
}
Program: 8294
Project: 8294
Buggy source:
public CataliticLens(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public CataliticLens(){
  super("String_Node_Str",(byte)7);
  this.setNoRepair();
}
Program: 8296
Project: 8296
Buggy source:
public DestructionCatalyst(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public DestructionCatalyst(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8297
Project: 8297
Buggy source:
public HyperkineticLens(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public HyperkineticLens(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8298
Project: 8298
Buggy source:
public TimeWatch(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public TimeWatch(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8299
Project: 8299
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    CoordinateBox box=new CoordinateBox(player.boundingBox);
    int offset=4 + this.getCharge(stack);
    box.expand(offset,offset,offset);
    for (int x=(int)box.minX; x <= box.maxX; x++)     for (int y=(int)box.minY; y <= box.maxY; y++)     for (int z=(int)box.minZ; z <= box.maxZ; z++) {
      Block b=world.getBlock(x,y,z);
      if (b == Blocks.water || b == Blocks.flowing_water) {
        world.setBlock(x,y,z,Blocks.ice);
      }
 else       if (b.isSideSolid(world,x,y,z,ForgeDirection.UP)) {
        Block b2=world.getBlock(x,y + 1,z);
        if (b2 == Blocks.air) {
          world.setBlock(x,y + 1,z,Blocks.snow_layer);
        }
      }
    }
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    CoordinateBox box=new CoordinateBox(player.boundingBox);
    int offset=3 + this.getCharge(stack);
    box.expand(offset,offset,offset);
    for (int x=(int)box.minX; x <= box.maxX; x++)     for (int y=(int)box.minY; y <= box.maxY; y++)     for (int z=(int)box.minZ; z <= box.maxZ; z++) {
      Block b=world.getBlock(x,y,z);
      if (b == Blocks.water || b == Blocks.flowing_water) {
        world.setBlock(x,y,z,Blocks.ice);
      }
 else       if (b.isSideSolid(world,x,y,z,ForgeDirection.UP)) {
        Block b2=world.getBlock(x,y + 1,z);
        if (b2 == Blocks.air) {
          world.setBlock(x,y + 1,z,Blocks.snow_layer);
        }
      }
    }
  }
  return stack;
}
Program: 8300
Project: 8300
Buggy source:
public DarkAxe(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkAxe(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8301
Project: 8301
Buggy source:
public DarkHammer(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkHammer(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8302
Project: 8302
Buggy source:
public DarkHoe(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkHoe(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8303
Project: 8303
Buggy source:
public DarkPickaxe(){
  super("String_Node_Str",(byte)3,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkPickaxe(){
  super("String_Node_Str",(byte)2,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  this.setNoRepair();
}
Program: 8304
Project: 8304
Buggy source:
public DarkShears(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkShears(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8305
Project: 8305
Buggy source:
public DarkShovel(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkShovel(){
  super("String_Node_Str",(byte)1);
  this.setNoRepair();
}
Program: 8306
Project: 8306
Buggy source:
public DarkSword(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}

Fixed version (ground truth):
public DarkSword(){
  super("String_Node_Str",(byte)2);
  this.setNoRepair();
}
Program: 8307
Project: 8307
Buggy source:
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase damaged,EntityLivingBase damager){
  if (!(damager instanceof EntityPlayer)) {
    return false;
  }
  DamageSource dmg=DamageSource.causePlayerDamage((EntityPlayer)damager);
  byte charge=this.getCharge(stack);
  float totalDmg=10.0f;
  if (charge > 0) {
    dmg.setDamageBypassesArmor();
    totalDmg+=charge;
  }
  damaged.attackEntityFrom(dmg,totalDmg);
  return true;
}

Fixed version (ground truth):
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase damaged,EntityLivingBase damager){
  if (!(damager instanceof EntityPlayer)) {
    return false;
  }
  DamageSource dmg=DamageSource.causePlayerDamage((EntityPlayer)damager);
  byte charge=this.getCharge(stack);
  float totalDmg=12.0f;
  if (charge > 0) {
    dmg.setDamageBypassesArmor();
    totalDmg+=charge;
  }
  damaged.attackEntityFrom(dmg,totalDmg);
  return true;
}
Program: 8308
Project: 8308
Buggy source:
public RedAxe(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedAxe(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8309
Project: 8309
Buggy source:
public RedHammer(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedHammer(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8310
Project: 8310
Buggy source:
public RedHoe(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedHoe(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8311
Project: 8311
Buggy source:
private void shear(World world,ItemStack stack,EntityPlayer player,byte charge){
  int offset=0;
switch (charge) {
case 0:
    offset=4;
  break;
case 1:
offset=8;
break;
case 2:
offset=16;
break;
case 3:
offset=32;
break;
}
AxisAlignedBB bBox=player.boundingBox.expand(offset,offset / 2,offset);
List<Entity> list=world.getEntitiesWithinAABB(IShearable.class,bBox);
if (list.isEmpty()) {
return;
}
List<ItemStack> drops=new ArrayList<ItemStack>();
for (Entity ent : list) {
IShearable target=(IShearable)ent;
if (target.isShearable(stack,ent.worldObj,(int)ent.posX,(int)ent.posY,(int)ent.posZ)) {
ArrayList<ItemStack> entDrops=target.onSheared(stack,ent.worldObj,(int)ent.posX,(int)ent.posY,(int)ent.posZ,EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId,stack));
if (entDrops.isEmpty()) {
continue;
}
for (ItemStack drop : entDrops) {
drop.stackSize+=Utils.randomIntInRange(6,3);
}
drops.addAll(entDrops);
}
}
if (!drops.isEmpty()) {
world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
}
}

Fixed version (ground truth):
private void shear(World world,ItemStack stack,EntityPlayer player,byte charge){
  int offset=0;
switch (charge) {
case 0:
    offset=4;
  break;
case 1:
offset=8;
break;
case 2:
offset=16;
break;
case 3:
offset=32;
break;
case 4:
offset=40;
break;
}
AxisAlignedBB bBox=player.boundingBox.expand(offset,offset / 2,offset);
List<Entity> list=world.getEntitiesWithinAABB(IShearable.class,bBox);
if (list.isEmpty()) {
return;
}
List<ItemStack> drops=new ArrayList<ItemStack>();
for (Entity ent : list) {
IShearable target=(IShearable)ent;
if (target.isShearable(stack,ent.worldObj,(int)ent.posX,(int)ent.posY,(int)ent.posZ)) {
ArrayList<ItemStack> entDrops=target.onSheared(stack,ent.worldObj,(int)ent.posX,(int)ent.posY,(int)ent.posZ,EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId,stack));
if (entDrops.isEmpty()) {
continue;
}
for (ItemStack drop : entDrops) {
drop.stackSize+=Utils.randomIntInRange(6,3);
}
drops.addAll(entDrops);
}
}
if (!drops.isEmpty()) {
world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
}
}
Program: 8312
Project: 8312
Buggy source:
private void attackNearby(World world,ItemStack stack,EntityPlayer player,byte charge){
  int offset=0;
switch (charge) {
case 0:
    offset=4;
  break;
case 1:
offset=5;
break;
case 2:
offset=6;
break;
case 3:
offset=7;
break;
}
AxisAlignedBB bBox=player.boundingBox.expand(offset,offset / 2,offset);
List<EntityLiving> list=world.getEntitiesWithinAABB(EntityLiving.class,bBox);
if (list.isEmpty()) {
return;
}
List<ItemStack> drops=new ArrayList<ItemStack>();
for (EntityLiving ent : list) {
if (ent.getHealth() <= 0) {
continue;
}
DamageSource dmg=DamageSource.causePlayerDamage(player);
float totalDmg=15.0f;
if (charge > 0) {
dmg.setDamageBypassesArmor();
totalDmg+=charge;
}
ent.attackEntityFrom(dmg,totalDmg);
List<EntityItem> entDrops=ent.capturedDrops;
if (entDrops.isEmpty()) {
continue;
}
for (EntityItem item : entDrops) {
drops.add(item.getEntityItem());
item.setDead();
}
}
PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
if (!drops.isEmpty()) {
world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
}
}

Fixed version (ground truth):
private void attackNearby(World world,ItemStack stack,EntityPlayer player,byte charge){
  int offset=0;
switch (charge) {
case 0:
    offset=4;
  break;
case 1:
offset=5;
break;
case 2:
offset=6;
break;
case 3:
offset=7;
break;
case 4:
offset=8;
break;
}
AxisAlignedBB bBox=player.boundingBox.expand(offset,offset / 2,offset);
List<EntityLiving> list=world.getEntitiesWithinAABB(EntityLiving.class,bBox);
if (list.isEmpty()) {
return;
}
List<ItemStack> drops=new ArrayList<ItemStack>();
for (EntityLiving ent : list) {
if (ent.getHealth() <= 0) {
continue;
}
DamageSource dmg=DamageSource.causePlayerDamage(player);
float totalDmg=15.0f;
if (charge > 0) {
dmg.setDamageBypassesArmor();
totalDmg+=charge;
}
ent.attackEntityFrom(dmg,totalDmg);
List<EntityItem> entDrops=ent.capturedDrops;
if (entDrops.isEmpty()) {
continue;
}
for (EntityItem item : entDrops) {
drops.add(item.getEntityItem());
item.setDead();
}
}
PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
if (!drops.isEmpty()) {
world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
}
}
Program: 8313
Project: 8313
Buggy source:
public RedPick(){
  super("String_Node_Str",(byte)4,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  this.setNoRepair();
}

Fixed version (ground truth):
public RedPick(){
  super("String_Node_Str",(byte)3,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  this.setNoRepair();
}
Program: 8314
Project: 8314
Buggy source:
public RedShears(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedShears(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8315
Project: 8315
Buggy source:
public RedShovel(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedShovel(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8317
Project: 8317
Buggy source:
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase damaged,EntityLivingBase damager){
  if (!(damager instanceof EntityPlayer)) {
    return false;
  }
  DamageSource dmg=DamageSource.causePlayerDamage((EntityPlayer)damager);
  byte charge=this.getCharge(stack);
  float totalDmg=15.0f;
  if (charge > 0) {
    dmg.setDamageBypassesArmor();
    totalDmg+=charge;
  }
  damaged.attackEntityFrom(dmg,totalDmg);
  return true;
}

Fixed version (ground truth):
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase damaged,EntityLivingBase damager){
  if (!(damager instanceof EntityPlayer)) {
    return false;
  }
  DamageSource dmg=DamageSource.causePlayerDamage((EntityPlayer)damager);
  byte charge=this.getCharge(stack);
  float totalDmg=14.0f;
  if (charge > 0) {
    dmg.setDamageBypassesArmor();
    totalDmg+=charge;
  }
  damaged.attackEntityFrom(dmg,totalDmg);
  return true;
}
Program: 8318
Project: 8318
Buggy source:
public RedSword(){
  super("String_Node_Str",(byte)4);
  this.setNoRepair();
}

Fixed version (ground truth):
public RedSword(){
  super("String_Node_Str",(byte)3);
  this.setNoRepair();
}
Program: 8319
Project: 8319
Buggy source:
public static void map(){
  loadEmcFromIMC();
  lazyInit();
  loadEmcFromOD();
  mapFromSmelting();
  mapFromRecipes(2);
  lateEmcMapping();
  FluidMapper.map();
  mapFromRecipes(1);
  assertMinEmcValues();
  Transmutation.loadCompleteKnowledge();
  FuelMapper.loadMap();
}

Fixed version (ground truth):
public static void map(){
  List<IEMCMapper<NormalizedSimpleStack>> emcMappers=Arrays.asList(new LazyMapper(),new OreDictionaryMapper(),new CraftingMapper(),new SmeltingMapper());
  GraphMapper<NormalizedSimpleStack> graphMapper=new GraphMapper<NormalizedSimpleStack>();
  for (  IEMCMapper<NormalizedSimpleStack> emcMapper : emcMappers) {
    emcMapper.addMappings(graphMapper);
  }
  Map<NormalizedSimpleStack,Double> graphMapperValues=graphMapper.generateValues();
  loadEmcFromIMC();
  lazyInit();
  loadEmcFromOD();
  mapFromSmelting();
  mapFromRecipes(2);
  lateEmcMapping();
  FluidMapper.map();
  mapFromRecipes(1);
  assertMinEmcValues();
  Transmutation.loadCompleteKnowledge();
  FuelMapper.loadMap();
  Set<NormalizedSimpleStack> allItems=new HashSet<NormalizedSimpleStack>();
  allItems.addAll(graphMapperValues.keySet());
  Map<NormalizedSimpleStack,Integer> left=new HashMap<NormalizedSimpleStack,Integer>();
  Map<NormalizedSimpleStack,Integer> right=new HashMap<NormalizedSimpleStack,Integer>();
  for (  SimpleStack stack : emc.keySet()) {
    allItems.add(new NormalizedSimpleStack(stack.toItemStack()));
    left.put(new NormalizedSimpleStack(stack.toItemStack()),emc.get(stack));
  }
  for (  Entry<NormalizedSimpleStack,Double> entry : graphMapperValues.entrySet())   right.put(entry.getKey(),(int)(double)entry.getValue());
  for (  NormalizedSimpleStack stack : allItems) {
    int leftValue=left.containsKey(stack) ? left.get(stack) : 0;
    char leftChar=left.containsKey(stack) ? '!' : ' ';
    int rightValue=right.containsKey(stack) ? right.get(stack) : 0;
    ;
    char rightChar=right.containsKey(stack) ? '!' : ' ';
    if (leftValue != rightValue) {
      System.out.format("String_Node_Str",stack.toString(),leftChar,leftValue,rightValue,rightChar);
    }
  }
}
Program: 8320
Project: 8320
Buggy source:
@Override public int hashCode(){
  return id + 255 * damage;
}

Fixed version (ground truth):
@Override public int hashCode(){
  return id;
}
Program: 8322
Project: 8322
Buggy source:
private void removeXP(EntityPlayer player,int amount){
  player.experienceTotal-=amount;
  player.experienceLevel=getLvlForXP(player.experienceTotal);
  player.experience=(player.experienceTotal - getXPForLvl(player.experienceLevel)) / (float)player.xpBarCap();
  if (player.experienceTotal < 0) {
    player.experienceTotal=0;
    player.experienceLevel=0;
    player.experience=0;
  }
}

Fixed version (ground truth):
private void removeXP(EntityPlayer player,int amount){
  int experiencetotal=getXP(player) - amount;
  if (experiencetotal < 0) {
    player.experienceTotal=0;
    player.experienceLevel=0;
    player.experience=0;
  }
 else {
    player.experienceTotal=experiencetotal;
    player.experienceLevel=getLvlForXP(experiencetotal);
    player.experience=(float)(experiencetotal - getXPForLvl(player.experienceLevel)) / (float)player.xpBarCap();
  }
}
Program: 8323
Project: 8323
Buggy source:
@Override public void onUpdate(ItemStack stack,World world,Entity entity,int par4,boolean par5){
  if (world.isRemote || par4 > 8 || !(entity instanceof EntityPlayer)) {
    return;
  }
  super.onUpdate(stack,world,entity,par4,par5);
  EntityPlayer player=(EntityPlayer)entity;
  if (stack.getItemDamage() != 0) {
    if (!canStore(stack)) {
      this.changeMode(player,stack);
      return;
    }
    if (player.experienceTotal > 0) {
      int toAdd=player.experienceTotal >= TRANSFER_RATE ? TRANSFER_RATE : player.experienceTotal;
      addStoredXP(stack,toAdd);
      removeXP(player,TRANSFER_RATE);
    }
  }
}

Fixed version (ground truth):
@Override public void onUpdate(ItemStack stack,World world,Entity entity,int par4,boolean par5){
  if (world.isRemote || par4 > 8 || !(entity instanceof EntityPlayer)) {
    return;
  }
  super.onUpdate(stack,world,entity,par4,par5);
  EntityPlayer player=(EntityPlayer)entity;
  if (stack.getItemDamage() != 0) {
    if (!canStore(stack)) {
      this.changeMode(player,stack);
      return;
    }
    if (getXP(player) > 0) {
      int toAdd=getXP(player) >= TRANSFER_RATE ? TRANSFER_RATE : getXP(player);
      addStoredXP(stack,toAdd);
      removeXP(player,TRANSFER_RATE);
    }
  }
}
Program: 8324
Project: 8324
Buggy source:
@Override public boolean onItemUse(ItemStack stack,EntityPlayer player,World world,int par4,int par5,int par6,int par7,float par8,float par9,float par10){
  if (!world.isRemote && stack.getItemDamage() == 0 && getStoredXP(stack) != 0) {
    int toAdd=removeStoredXP(stack,TRANSFER_RATE);
    if (toAdd > 0) {
      player.addExperience(toAdd);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onItemUse(ItemStack stack,EntityPlayer player,World world,int par4,int par5,int par6,int par7,float par8,float par9,float par10){
  if (!world.isRemote && stack.getItemDamage() == 0 && getStoredXP(stack) != 0) {
    int toAdd=removeStoredXP(stack,TRANSFER_RATE);
    if (toAdd > 0) {
      addXP(player,toAdd);
      return true;
    }
  }
  return false;
}
Program: 8325
Project: 8325
Buggy source:
@org.junit.Test public void testGenerateValuesSimpleMultiRecipe() throws Exception {
  GraphMapper<String> graphMapper=new GraphMapper<String>();
  graphMapper.setValue("String_Node_Str",1,GraphMapper.FixedValue.FixAndInherit);
  graphMapper.addConversion(1,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  graphMapper.addConversion(2,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"));
  graphMapper.addConversion(1,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"));
  Map<String,Double> values=graphMapper.generateValues();
  assertEquals(1,getValue(values,"String_Node_Str"));
  assertEquals(2,getValue(values,"String_Node_Str"));
  assertEquals(4,getValue(values,"String_Node_Str"));
}

Fixed version (ground truth):
@org.junit.Test public void testGenerateValuesSimpleMultiRecipe() throws Exception {
  GraphMapper<String> graphMapper=new GraphMapper<String>();
  graphMapper.setValue("String_Node_Str",1,GraphMapper.FixedValue.FixAndInherit);
  graphMapper.addConversion(1,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  graphMapper.addConversion(2,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"));
  graphMapper.addConversion(1,"String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"));
  Map<String,Double> values=graphMapper.generateValues();
  assertEquals(1,getValue(values,"String_Node_Str"));
  assertEquals(2,getValue(values,"String_Node_Str"));
  assertEquals(2,getValue(values,"String_Node_Str"));
}
Program: 8326
Project: 8326
Buggy source:
@Override public boolean showNodes(ItemStack stack,EntityLivingBase player){
  return true;
}

Fixed version (ground truth):
@Override public boolean showNodes(ItemStack itemstack,EntityLivingBase player){
  if (itemstack != null && itemstack.getItem() == ObjHandler.gemHelmet)   return true;
  return false;
}
Program: 8327
Project: 8327
Buggy source:
@Override public boolean showIngamePopups(ItemStack stack,EntityLivingBase player){
  return true;
}

Fixed version (ground truth):
@Override public boolean showIngamePopups(ItemStack itemstack,EntityLivingBase player){
  if (itemstack != null && itemstack.getItem() == ObjHandler.gemHelmet)   return true;
  return false;
}
Program: 8328
Project: 8328
Buggy source:
private void doRequest(long n){
  if (!done.get()) {
    request(n);
  }
}

Fixed version (ground truth):
private void doRequest(long n){
  if (!done.get()) {
    BackpressureUtils.getAndAddRequest(childRequested,n);
    request(n);
  }
}
Program: 8329
Project: 8329
Buggy source:
@Override public void request(long n){
  if (n < 1) {
    unsubscribe();
    onError(new IllegalArgumentException("String_Node_Str"));
  }
  requested.set(true);
  doRequest(n);
}

Fixed version (ground truth):
@Override public void request(long n){
  if (n < 1) {
    unsubscribe();
    onError(new IllegalArgumentException("String_Node_Str"));
    return;
  }
  requested.set(true);
  doRequest(n);
}
Program: 8330
Project: 8330
Buggy source:
@Override public void onStart(){
  final AtomicBoolean requested=new AtomicBoolean();
  s.onSubscribe(new Subscription(){
    @Override public void request(    long n){
      if (n < 1) {
        unsubscribe();
        onError(new IllegalArgumentException("String_Node_Str"));
      }
      requested.set(true);
      doRequest(n);
    }
    @Override public void cancel(){
      unsubscribe();
      fireDone();
    }
  }
);
  if (!requested.get()) {
    request(0);
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  final AtomicBoolean requested=new AtomicBoolean();
  s.onSubscribe(new Subscription(){
    @Override public void request(    long n){
      if (n < 1) {
        unsubscribe();
        onError(new IllegalArgumentException("String_Node_Str"));
        return;
      }
      requested.set(true);
      doRequest(n);
    }
    @Override public void cancel(){
      unsubscribe();
      fireDone();
    }
  }
);
  if (!requested.get()) {
    request(0);
  }
}
Program: 8332
Project: 8332
Buggy source:
@Override public void onNext(T t){
  if (!done.get()) {
    s.onNext(t);
  }
}

Fixed version (ground truth):
@Override public void onNext(T t){
  if (!done.get()) {
    if (childRequested.get() > 0) {
      s.onNext(t);
      childRequested.decrementAndGet();
    }
 else {
      try {
        onError(new IllegalStateException("String_Node_Str"));
      }
  finally {
        unsubscribe();
      }
    }
  }
}