nus-yam/ex-repair huggingface dataset:
Program: 169746
Project: 169746
Buggy source:
@Override public void getSubBlocks(int id,CreativeTabs creativeTab,List list){
  for (  Class<? extends Turret> sentry : TurretRegistry.getSentryMap().values())   list.add(TurretRegistry.getItemStack(sentry));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void getSubBlocks(int id,CreativeTabs creativeTab,List list){
  for (  Class<? extends Turret> sentry : TurretRegistry.getSentryMap().values())   list.add(TurretRegistry.getItemStack(sentry));
}
Program: 169747
Project: 169747
Buggy source:
@Override public ArrayList<ItemStack> getBlockDropped(World world,int x,int y,int z,int metadata,int fortune){
  ArrayList<ItemStack> ret=new ArrayList<ItemStack>();
  ret.add(ItemBlockSaved.getItemStackWithNBT(this,world,x,y,z));
  return ret;
}

Fixed version (ground truth):
@Override public ArrayList<ItemStack> getBlockDropped(World world,int x,int y,int z,int metadata,int fortune){
  ArrayList<ItemStack> ret=new ArrayList<ItemStack>();
  ItemStack turret=getPickBlock(null,world,x,y,z);
  if (turret.getTagCompound().hasKey(ITurret.SENTRY_TYPE_SAVE_ID)) {
    ret.add(turret);
  }
  return ret;
}
Program: 169748
Project: 169748
Buggy source:
@Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
  return ItemBlockSaved.getItemStackWithNBT(this,world,x,y,z);
}

Fixed version (ground truth):
@Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
  TileEntity tile=world.getBlockTileEntity(x,y,z);
  if (isHarvesting) {
    tile=harvestedTile;
  }
  if (tile == null && target != null && target.typeOfHit == EnumMovingObjectType.TILE) {
    tile=world.getBlockTileEntity(target.blockX,target.blockY,target.blockZ);
  }
  if (tile instanceof TileTurret && ((TileTurret)tile).getTurret() != null) {
    return TurretRegistry.getItemStack(((TileTurret)tile).getTurret().getClass());
  }
  return ItemBlockSaved.getItemStackWithNBT(this,world,x,y,z);
}
Program: 169749
Project: 169749
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void getSubBlocks(int id,CreativeTabs creativeTab,List list){
  for (  Class<? extends Turret> sentry : TurretRegistry.getSentryMap().values())   list.add(TurretRegistry.getItemStack(sentry));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void getSubBlocks(int id,CreativeTabs creativeTab,List list){
  for (  Class<? extends ITurret> sentry : TurretRegistry.getSentryMap().values())   list.add(TurretRegistry.getItemStack(sentry));
}
Program: 169750
Project: 169750
Buggy source:
@Override public ArrayList<ItemStack> getBlockDropped(World world,int x,int y,int z,int metadata,int fortune){
  ArrayList<ItemStack> ret=new ArrayList<ItemStack>();
  ItemStack turret=getPickBlock(null,world,x,y,z);
  if (turret.getTagCompound().hasKey(ITurret.SENTRY_TYPE_SAVE_ID)) {
    ret.add(turret);
  }
  return ret;
}

Fixed version (ground truth):
@Override public ArrayList<ItemStack> getBlockDropped(World world,int x,int y,int z,int metadata,int fortune){
  ArrayList<ItemStack> ret=new ArrayList<ItemStack>();
  ItemStack turret=getItemStack(world,x,y,z);
  if (isHarvesting && turret == null) {
    turret=getItemStack(harvestedTile);
    harvestedTile=null;
    isHarvesting=false;
  }
  if (turret != null)   ret.add(turret);
  harvestedTile=null;
  return ret;
}
Program: 169751
Project: 169751
Buggy source:
@Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
  TileEntity tile=world.getBlockTileEntity(x,y,z);
  if (isHarvesting) {
    tile=harvestedTile;
  }
  if (tile == null && target != null && target.typeOfHit == EnumMovingObjectType.TILE) {
    tile=world.getBlockTileEntity(target.blockX,target.blockY,target.blockZ);
  }
  if (tile instanceof TileTurret && ((TileTurret)tile).getTurret() != null) {
    return TurretRegistry.getItemStack(((TileTurret)tile).getTurret().getClass());
  }
  return ItemBlockSaved.getItemStackWithNBT(this,world,x,y,z);
}

Fixed version (ground truth):
@Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
  return getItemStack(world,x,y,z);
}
Program: 169752
Project: 169752
Buggy source:
@Override public void onPowerOn(){
  if (this.getEnergyHandler().isFull()) {
    if (inCurrentCooldown()) {
switch (this.empMode) {
default :
        new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectBlocks().setEffectEntities().explode();
      break;
case 1:
    new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectEntities().explode();
  break;
case 2:
new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectBlocks().explode();
break;
}
this.cooldownTicks=120;
}
}
}

Fixed version (ground truth):
@Override public void onPowerOn(){
  if (this.getEnergyHandler().isFull()) {
    if (!inCurrentCooldown()) {
switch (this.empMode) {
default :
        new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectBlocks().setEffectEntities().explode();
      break;
case 1:
    new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectEntities().explode();
  break;
case 2:
new BlastEMP(this.worldObj,null,this.xCoord,this.yCoord,this.zCoord,this.empRadius).setEffectBlocks().explode();
break;
}
this.cooldownTicks=120;
}
}
}
Program: 169753
Project: 169753
Buggy source:
public void updateLoadChunk(int newChunkX,int newChunkZ){
  if (!this.worldObj.isRemote && Settings.LOAD_CHUNKS && this.chunkTicket != null) {
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.unforceChunk(chunkTicket,chunk);
    loadedChunks.clear();
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ) - 1);
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.forceChunk(chunkTicket,chunk);
  }
}

Fixed version (ground truth):
public void updateLoadChunk(int newChunkX,int newChunkZ){
  if (!this.worldObj.isRemote && Settings.LOAD_CHUNKS && this.chunkTicket != null) {
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.unforceChunk(chunkTicket,chunk);
    loadedChunks.clear();
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ - 1));
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.forceChunk(chunkTicket,chunk);
  }
}
Program: 169754
Project: 169754
Buggy source:
public AmmoHandler(ItemStack stack,int capacity){
  this.weaponStack=stack;
  if (weaponStack.stackTagCompound == null) {
    weaponStack.stackTagCompound=new NBTTagCompound();
  }
  weaponStack.stackTagCompound.setInteger("String_Node_Str",capacity);
  weaponStack.stackTagCompound.setInteger("String_Node_Str",0);
}

Fixed version (ground truth):
public AmmoHandler(ItemStack stack,int capacity){
  this.weaponStack=stack;
}
Program: 169755
Project: 169755
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (player.isSneaking()) {
    onSneakClick(itemstack,world,player);
    return itemstack;
  }
  onPreWeaponFired(itemstack,world,player);
  if (isLoaded()) {
    onWeaponFired(itemstack,world,player);
    onPostWeaponFired(itemstack,world,player);
  }
  return itemstack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (player.isSneaking()) {
    onSneakClick(itemstack,world,player);
    return itemstack;
  }
  onPreWeaponFired(itemstack,world,player);
  if (!isEmpty(itemstack)) {
    onWeaponFired(itemstack,world,player);
    onPostWeaponFired(itemstack,world,player);
  }
  return itemstack;
}
Program: 169756
Project: 169756
Buggy source:
@Override public void onPostWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (!world.isRemote) {
    if (ammoHandler != null && !ammoHandler.isEmpty()) {
      ammoHandler.consume(1);
      stack.setItemDamage(stack.getItemDamage() - 1);
    }
  }
}

Fixed version (ground truth):
@Override public void onPostWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (!world.isRemote) {
    if (!isEmpty(stack)) {
      consume(stack,1);
      shooter.getHeldItem().setItemDamage(shooter.getHeldItem().getItemDamage() - 1);
    }
  }
}
Program: 169757
Project: 169757
Buggy source:
@Override public void onPreWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
}

Fixed version (ground truth):
@Override public void onPreWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  System.out.println(getCurrentAmmo(stack));
}
Program: 169758
Project: 169758
Buggy source:
@Override public void addInformation(ItemStack itemStack,EntityPlayer entityPlayer,List list,boolean par4){
  list.add("String_Node_Str" + ammoHandler.getCurrentAmmo() + "String_Node_Str"+ capacity);
  super.addInformation(itemStack,entityPlayer,list,par4);
}

Fixed version (ground truth):
@Override public void addInformation(ItemStack itemStack,EntityPlayer entityPlayer,List list,boolean par4){
  list.add("String_Node_Str" + getCurrentAmmo(itemStack) + "String_Node_Str"+ capacity);
  super.addInformation(itemStack,entityPlayer,list,par4);
}
Program: 169759
Project: 169759
Buggy source:
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      if (!world.isRemote)       ammoHandler=new AmmoHandler(stack,capacity);
      searchInventoryForAmmo(shooter,true);
    }
 else {
      return;
    }
  }
  if (ammoHandler.isEmpty()) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      if (!world.isRemote)       ammoHandler.reload();
    }
  }
}

Fixed version (ground truth):
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      if (!world.isRemote)       ammoHandler=new AmmoHandler(shooter.getHeldItem(),capacity);
      searchInventoryForAmmo(shooter,true);
    }
 else {
      return;
    }
  }
  if (isEmpty(stack)) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      if (!world.isRemote)       reload(stack);
    }
  }
}
Program: 169760
Project: 169760
Buggy source:
public void reload(ItemStack weaponStack){
  if (weaponStack.stackTagCompound == null) {
    weaponStack.stackTagCompound=new NBTTagCompound();
  }
  weaponStack.stackTagCompound.setInteger("String_Node_Str",weaponStack.stackTagCompound.getInteger("String_Node_Str"));
}

Fixed version (ground truth):
public void reload(ItemStack weaponStack){
  weaponStack.stackTagCompound.setInteger("String_Node_Str",capacity);
}
Program: 169761
Project: 169761
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (itemstack.stackTagCompound == null) {
    itemstack.stackTagCompound=new NBTTagCompound();
  }
  itemstack.stackTagCompound.setInteger("String_Node_Str",capacity);
  itemstack.stackTagCompound.setInteger("String_Node_Str",0);
  return super.onItemRightClick(itemstack,world,player);
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (itemstack.stackTagCompound == null) {
    itemstack.stackTagCompound=new NBTTagCompound();
    itemstack.stackTagCompound.setInteger("String_Node_Str",capacity);
    itemstack.stackTagCompound.setInteger("String_Node_Str",0);
  }
  return super.onItemRightClick(itemstack,world,player);
}
Program: 169762
Project: 169762
Buggy source:
public void consume(ItemStack weaponStack,int amt){
  if (weaponStack.stackTagCompound == null) {
    weaponStack.stackTagCompound=new NBTTagCompound();
  }
  if (amt < 0) {
    return;
  }
  if (amt > weaponStack.stackTagCompound.getInteger("String_Node_Str")) {
    weaponStack.stackTagCompound.setInteger("String_Node_Str",0);
    return;
  }
  weaponStack.stackTagCompound.setInteger("String_Node_Str",weaponStack.stackTagCompound.getInteger("String_Node_Str") - amt);
}

Fixed version (ground truth):
public void consume(ItemStack weaponStack,int amt){
  if (amt < 0) {
    return;
  }
  if (amt > weaponStack.stackTagCompound.getInteger("String_Node_Str")) {
    weaponStack.stackTagCompound.setInteger("String_Node_Str",0);
    return;
  }
  weaponStack.stackTagCompound.setInteger("String_Node_Str",weaponStack.stackTagCompound.getInteger("String_Node_Str") - amt);
}
Program: 169763
Project: 169763
Buggy source:
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (isEmpty(stack)) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      if (!world.isRemote)       reload(stack);
    }
  }
}

Fixed version (ground truth):
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (isEmpty(stack)) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      if (!world.isRemote) {
        System.out.println(searchInventoryForAmmo(shooter,false));
        reload(stack);
      }
    }
  }
}
Program: 169764
Project: 169764
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (pairedGate == null) {
    Vector3 thisVector=new Vector3(this);
    Vector3 foundVector=null;
    for (int i=0; i < 4; i+=90) {
      MovingObjectPosition mop=thisVector.rayTraceBlocks(worldObj,i,0,true,10);
switch (i) {
case 90:
        foundVector=new Vector3(mop).translate(1,0,0);
      break;
case 180:
    foundVector=new Vector3(mop).translate(0,0,1);
  break;
case 270:
foundVector=new Vector3(mop).translate(-1,0,0);
break;
case 360:
foundVector=new Vector3(mop).translate(0,0,-1);
break;
}
TileEntity tile=worldObj.getBlockTileEntity(foundVector.intX(),foundVector.intY(),foundVector.intZ());
if (tile != null) {
this.pairedGate=(TileLaserGate)tile;
this.pairedGate.pairedGate=this;
}
}
}
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!worldObj.isRemote) {
    if (pairedGate == null) {
      Vector3 thisVector=new Vector3(this);
      Vector3 foundVector=null;
      for (int i=0; i < 4; i=i + 90) {
        MovingObjectPosition mop=thisVector.rayTraceBlocks(worldObj,i,0,false,10);
        foundVector=new Vector3(mop);
        TileEntity tile=worldObj.getBlockTileEntity(foundVector.intX(),foundVector.intY(),foundVector.intZ());
        if (tile != null) {
          this.pairedGate=(TileLaserGate)tile;
          this.pairedGate.pairedGate=this;
        }
      }
    }
  }
}
Program: 169765
Project: 169765
Buggy source:
@Override public void onPowerOn(){
  System.out.println("String_Node_Str" + pairedGate + "String_Node_Str"+ pairedGate.xCoord+ "String_Node_Str"+ pairedGate.yCoord+ "String_Node_Str"+ pairedGate.zCoord+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onPowerOn(){
  if (!worldObj.isRemote) {
    if (pairedGate == null) {
      System.out.println("String_Node_Str" + "String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str" + pairedGate + "String_Node_Str"+ pairedGate.xCoord+ "String_Node_Str"+ pairedGate.yCoord+ "String_Node_Str"+ pairedGate.zCoord+ "String_Node_Str");
    }
  }
}
Program: 169766
Project: 169766
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (weaponSystem == null) {
    weaponSystem=new WeaponConventional(player,5F);
  }
  MovingObjectPosition mop=player.rayTrace(100,1f);
  if (mop != null) {
    System.out.println(mop.blockX + "String_Node_Str" + mop.blockY+ "String_Node_Str"+ mop.blockZ);
    if (mop.typeOfHit == EnumMovingObjectType.ENTITY) {
      weaponSystem.fire(Vector3.fromCenter(mop.entityHit));
    }
 else {
      weaponSystem.fire(new Vector3(mop.hitVec));
    }
  }
  return itemstack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (weaponSystem == null) {
    weaponSystem=new WeaponConventional(player,5F);
  }
  MovingObjectPosition mop=player.rayTrace(100,1f);
  if (mop != null) {
    if (world.isRemote)     System.out.println(mop.blockX + "String_Node_Str" + mop.blockY+ "String_Node_Str"+ mop.blockZ);
    if (mop.typeOfHit == EnumMovingObjectType.ENTITY) {
      weaponSystem.fire(Vector3.fromCenter(mop.entityHit));
    }
 else {
      weaponSystem.fire(new Vector3(mop.hitVec));
    }
  }
  return itemstack;
}
Program: 169767
Project: 169767
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (!worldObj.isRemote) {
    if (ticks % 10 == 0) {
      if (pairedGate == null)       findLaserPair();
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!worldObj.isRemote) {
    if (ticks % 10 == 0) {
      if (pairedGate == null)       findLaserPair();
    }
  }
  if (renderLaser) {
    ICBMSentry.proxy.renderBeam(worldObj,new Vector3(this),new Vector3(getLaserPair()),Color.RED.getRed(),Color.RED.getGreen(),Color.RED.getBlue(),1);
  }
}
Program: 169768
Project: 169768
Buggy source:
@Override public void onPowerOn(){
  if (!worldObj.isRemote) {
  }
}

Fixed version (ground truth):
@Override public void onPowerOn(){
  if (pairedGate != null) {
    this.renderLaser=true;
    this.getLaserPair().renderLaser=true;
  }
}
Program: 169769
Project: 169769
Buggy source:
@Override public void invalidate(){
  if (this.pairedGate != null)   this.pairedGate.setLaserPair(null);
  setLaserPair(null);
  super.invalidate();
}

Fixed version (ground truth):
@Override public void invalidate(){
  if (this.pairedGate != null)   this.pairedGate.setLaserPair(null);
  setLaserPair(null);
  this.renderLaser=false;
  super.invalidate();
}
Program: 169770
Project: 169770
Buggy source:
@Override public void onPowerOff(){
}

Fixed version (ground truth):
@Override public void onPowerOff(){
  if (pairedGate != null) {
    this.renderLaser=false;
    this.getLaserPair().renderLaser=false;
  }
}
Program: 169771
Project: 169771
Buggy source:
@Override public void onPostWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler != null && !ammoHandler.isEmpty()) {
    ammoHandler.consume(1);
    stack.setItemDamage(stack.getItemDamage() - 1);
  }
}

Fixed version (ground truth):
@Override public void onPostWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (!world.isRemote) {
    if (ammoHandler != null && !ammoHandler.isEmpty()) {
      ammoHandler.consume(1);
      stack.setItemDamage(stack.getItemDamage() - 1);
    }
  }
}
Program: 169772
Project: 169772
Buggy source:
@Override public void onPreWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      ammoHandler=new AmmoHandler(stack,capacity);
      searchInventoryForAmmo(shooter,true);
    }
  }
}

Fixed version (ground truth):
@Override public void onPreWeaponFired(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      if (!world.isRemote)       ammoHandler=new AmmoHandler(stack,capacity);
    }
  }
}
Program: 169773
Project: 169773
Buggy source:
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      ammoHandler=new AmmoHandler(stack,capacity);
      searchInventoryForAmmo(shooter,true);
    }
 else {
      return;
    }
  }
  if (ammoHandler.isEmpty()) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      ammoHandler.reload();
    }
  }
}

Fixed version (ground truth):
@Override public void onSneakClick(ItemStack stack,World world,EntityPlayer shooter){
  if (ammoHandler == null) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      if (!world.isRemote)       ammoHandler=new AmmoHandler(stack,capacity);
      searchInventoryForAmmo(shooter,true);
    }
 else {
      return;
    }
  }
  if (ammoHandler.isEmpty()) {
    if (searchInventoryForAmmo(shooter,false) != null) {
      searchInventoryForAmmo(shooter,true);
      if (!world.isRemote)       ammoHandler.reload();
    }
  }
}
Program: 169774
Project: 169774
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (weaponSystem == null) {
    weaponSystem=new WeaponConventional(player,5F);
  }
  MovingObjectPosition mop=player.rayTrace(100,1f);
  if (mop != null) {
    if (world.isRemote)     System.out.println(mop.blockX + "String_Node_Str" + mop.blockY+ "String_Node_Str"+ mop.blockZ);
    if (mop.typeOfHit == EnumMovingObjectType.ENTITY) {
      weaponSystem.fire(Vector3.fromCenter(mop.entityHit));
    }
 else {
      weaponSystem.fire(new Vector3(mop.hitVec));
    }
  }
  return itemstack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack itemstack,World world,EntityPlayer player){
  if (weaponSystem == null) {
    weaponSystem=new WeaponConventional(player,10F);
    weaponSystem.aimOffset=new Vector3(1);
  }
  MovingObjectPosition mop=player.rayTrace(100,1f);
  if (mop != null) {
    if (world.isRemote)     System.out.println(mop.blockX + "String_Node_Str" + mop.blockY+ "String_Node_Str"+ mop.blockZ);
    if (mop.typeOfHit == EnumMovingObjectType.ENTITY) {
      weaponSystem.fire(Vector3.fromCenter(mop.entityHit));
    }
 else {
      weaponSystem.fire(new Vector3(mop.hitVec));
    }
  }
  return itemstack;
}
Program: 169775
Project: 169775
Buggy source:
@Override public void onHitEntity(Entity entity){
  if (entity != null) {
    entity.attackEntityFrom(damageSource,damage);
  }
}

Fixed version (ground truth):
@Override public void onHitEntity(Entity entity){
  if (entity != null) {
    System.out.println("String_Node_Str" + entity + "String_Node_Str"+ damage+ "String_Node_Str");
    entity.attackEntityFrom(damageSource,damage);
  }
}
Program: 169776
Project: 169776
Buggy source:
public WeaponInaccuracy(EntityPlayer player,int ammoAmount,float damage){
  super(player,DamageSource.causePlayerDamage(player),damage);
  this.itemsConsumedPerShot=ammoAmount;
}

Fixed version (ground truth):
public WeaponInaccuracy(EntityPlayer player,int ammoAmount,float damage){
  super(player,DamageSource.anvil,damage);
  this.itemsConsumedPerShot=ammoAmount;
}
Program: 169777
Project: 169777
Buggy source:
@Override public void load(NBTTagCompound nbt){
  if (nbt.hasKey("String_Node_Str")) {
    this.targetting.clear();
    NBTTagList list=nbt.getTagList("String_Node_Str");
    for (    Object o : list.tagList) {
      if (o instanceof NBTTagCompound) {
        this.targetting.put(((NBTTagCompound)o).getString("String_Node_Str"),((NBTTagCompound)o).getBoolean("String_Node_Str"));
      }
    }
  }
}

Fixed version (ground truth):
@Override public void load(NBTTagCompound nbt){
  if (nbt.hasKey("String_Node_Str")) {
    NBTTagList list=nbt.getTagList("String_Node_Str");
    for (    Object o : list.tagList) {
      if (o instanceof NBTTagCompound) {
        this.targetting.put(((NBTTagCompound)o).getString("String_Node_Str"),((NBTTagCompound)o).getBoolean("String_Node_Str"));
      }
    }
  }
}
Program: 169778
Project: 169778
Buggy source:
public void updateLoadChunk(int newChunkX,int newChunkZ){
  if (!this.worldObj.isRemote && Settings.LOAD_CHUNKS && this.chunkTicket != null) {
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.unforceChunk(chunkTicket,chunk);
    loadedChunks.clear();
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ + 1));
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.forceChunk(chunkTicket,chunk);
  }
}

Fixed version (ground truth):
public void updateLoadChunk(int newChunkX,int newChunkZ){
  if (!this.worldObj.isRemote && Settings.LOAD_CHUNKS && this.chunkTicket != null) {
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.unforceChunk(chunkTicket,chunk);
    loadedChunks.clear();
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ - 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ + 1));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1,newChunkZ));
    loadedChunks.add(new ChunkCoordIntPair(newChunkX,newChunkZ) - 1);
    for (    ChunkCoordIntPair chunk : loadedChunks)     ForgeChunkManager.forceChunk(chunkTicket,chunk);
  }
}
Program: 169779
Project: 169779
Buggy source:
@EventHandler public void preInit(FMLPreInitializationEvent event){
  NetworkRegistry.instance().registerGuiHandler(INSTANCE,proxy);
  MinecraftForge.EVENT_BUS.register(this);
  TurretType.load();
  blockTurret=ICBMCore.contentRegistry.createBlock(BlockTurret.class,ItemBlockTurret.class,TileTurret.class);
  blockPlatform=ICBMCore.contentRegistry.createBlock(BlockTurretPlatform.class);
  itemAmmo=ICBMCore.contentRegistry.createItem("String_Node_Str",ItemAmmo.class,false);
  itemUpgrade=ICBMCore.contentRegistry.createItem("String_Node_Str",ItemSentryUpgrade.class,false);
  bulletShell=new ItemStack(itemAmmo,1,0);
  conventionalBullet=new ItemStack(itemAmmo,1,1);
  railgunBullet=new ItemStack(itemAmmo,1,2);
  antimatterBullet=new ItemStack(itemAmmo,1,3);
  EntityRegistry.registerGlobalEntityID(EntityMountableDummy.class,"String_Node_Str",EntityRegistry.findGlobalUniqueEntityId());
  EntityRegistry.registerModEntity(EntityMountableDummy.class,"String_Node_Str",ENTITY_ID_PREFIX + 7,INSTANCE,50,5,true);
  TabICBM.itemStack=TurretRegistry.getItemStack(TurretAntiAir.class);
  TurretEntitySelector.configTurretTargeting();
  proxy.preInit();
  CommandRegistry.register(new TerminalAccessCMD(),"String_Node_Str");
}

Fixed version (ground truth):
@EventHandler public void preInit(FMLPreInitializationEvent event){
  NetworkRegistry.instance().registerGuiHandler(INSTANCE,proxy);
  MinecraftForge.EVENT_BUS.register(this);
  TurretType.load();
  blockTurret=ICBMCore.contentRegistry.createBlock(BlockTurret.class,ItemBlockTurret.class,TileTurret.class);
  blockPlatform=ICBMCore.contentRegistry.createBlock(BlockTurretPlatform.class);
  itemAmmo=ICBMCore.contentRegistry.createItem("String_Node_Str",ItemAmmo.class,false);
  itemUpgrade=ICBMCore.contentRegistry.createItem("String_Node_Str",ItemSentryUpgrade.class,false);
  bulletShell=new ItemStack(itemAmmo,1,0);
  conventionalBullet=new ItemStack(itemAmmo,1,1);
  railgunBullet=new ItemStack(itemAmmo,1,2);
  antimatterBullet=new ItemStack(itemAmmo,1,3);
  EntityRegistry.registerGlobalEntityID(EntityMountableDummy.class,"String_Node_Str",EntityRegistry.findGlobalUniqueEntityId());
  EntityRegistry.registerModEntity(EntityMountableDummy.class,"String_Node_Str",ENTITY_ID_PREFIX + 7,INSTANCE,50,5,true);
  TabICBM.itemStack=TurretRegistry.getItemStack(TurretAntiAir.class);
  proxy.preInit();
  CommandRegistry.register(new TerminalAccessCMD(),"String_Node_Str");
}
Program: 169780
Project: 169780
Buggy source:
public TurretAntiAirSelector(ITurret turret){
  super(turret);
  this.target_mobs=false;
  this.target_players=false;
}

Fixed version (ground truth):
public TurretAntiAirSelector(ITurret turret){
  super(turret);
}
Program: 169781
Project: 169781
Buggy source:
@Override public void load(NBTTagCompound nbt){
  target_mobs=nbt.getBoolean("String_Node_Str");
  target_animals=nbt.getBoolean("String_Node_Str");
  target_npcs=nbt.getBoolean("String_Node_Str");
  target_players=nbt.getBoolean("String_Node_Str");
  target_flying=nbt.getBoolean("String_Node_Str");
  target_boss=nbt.getBoolean("String_Node_Str");
}

Fixed version (ground truth):
@Override public void load(NBTTagCompound nbt){
}
Program: 169782
Project: 169782
Buggy source:
@Override public boolean isEntityApplicable(Entity entity){
  boolean re=false;
  if (!isFriendly(entity) && isValid(entity)) {
    if (entity instanceof EntityFlying) {
      return target_flying_global && target_flying;
    }
 else     if (entity instanceof IBossDisplayData) {
      return target_boss_global && target_boss;
    }
 else     if (entity instanceof EntityPlayer) {
      return target_players_global && target_players;
    }
 else     if (isMob(entity)) {
      return target_mobs_global && target_mobs;
    }
 else     if (entity instanceof IAnimals) {
      return target_animals_global & target_animals;
    }
 else     if (entity instanceof INpc) {
      return target_npcs_global & target_npcs;
    }
  }
  return re;
}

Fixed version (ground truth):
@Override public boolean isEntityApplicable(Entity entity){
  boolean re=false;
  if (!isFriendly(entity) && isValid(entity)) {
    if (entity instanceof EntityFlying) {
      return target_flying_global;
    }
 else     if (entity instanceof IBossDisplayData) {
      return target_boss_global;
    }
 else     if (entity instanceof EntityPlayer) {
      return target_players_global;
    }
 else     if (isMob(entity)) {
      return target_mobs_global;
    }
 else     if (entity instanceof IAnimals) {
      return target_animals_global;
    }
 else     if (entity instanceof INpc) {
      return target_npcs_global;
    }
  }
  return re;
}
Program: 169783
Project: 169783
Buggy source:
@Override public void save(NBTTagCompound nbt){
  nbt.setBoolean("String_Node_Str",target_mobs);
  nbt.setBoolean("String_Node_Str",target_animals);
  nbt.setBoolean("String_Node_Str",target_npcs);
  nbt.setBoolean("String_Node_Str",target_players);
  nbt.setBoolean("String_Node_Str",target_flying);
  nbt.setBoolean("String_Node_Str",target_boss);
}

Fixed version (ground truth):
@Override public void save(NBTTagCompound nbt){
}
Program: 169784
Project: 169784
Buggy source:
@SideOnly(Side.CLIENT) @Override public IModelCustom getMissileModel(){
  if (this.model == null)   model=AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + this.modelName);
  return model;
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public IModelCustom getMissileModel(){
  try {
    if (this.model == null)     model=AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + this.modelName);
  }
 catch (  ModelFormatException e) {
    System.out.println("String_Node_Str" + this.modelName);
    e.printStackTrace();
  }
  return model;
}
Program: 169785
Project: 169785
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (!this.worldObj.isRemote) {
    for (int i=0; i < this.getSizeInventory(); i++) {
      if (this.getStackInSlot(i) != null && CompatibilityModule.isHandler(this.getStackInSlot(i).getClass())) {
        long charge=CompatibilityModule.dischargeItem(this.getStackInSlot(i),Integer.MAX_VALUE,false);
        CompatibilityModule.dischargeItem(this.getStackInSlot(i),this.onReceiveEnergy(ForgeDirection.UNKNOWN,charge,true),true);
      }
    }
  }
  turrets=new TileTurret[6];
  for (int i=0; i < 6; i++) {
    TileEntity checkTile=new Vector3(this).translate(ForgeDirection.getOrientation(i)).getTileEntity(worldObj);
    if (checkTile instanceof TileTurret)     turrets[i]=(TileTurret)checkTile;
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!this.worldObj.isRemote) {
    for (int i=0; i < this.getSizeInventory(); i++) {
      if (this.getStackInSlot(i) != null && CompatibilityModule.isHandler(this.getStackInSlot(i).getClass())) {
        long charge=CompatibilityModule.dischargeItem(this.getStackInSlot(i),Integer.MAX_VALUE,false);
        CompatibilityModule.dischargeItem(this.getStackInSlot(i),this.onReceiveEnergy(ForgeDirection.UNKNOWN,charge,true),true);
      }
    }
  }
  turrets=new TileTurret[6];
  for (  ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity checkTile=new Vector3(this).translate(dir).getTileEntity(worldObj);
    if (checkTile instanceof TileTurret)     turrets[dir.ordinal()]=(TileTurret)checkTile;
  }
}
Program: 169786
Project: 169786
Buggy source:
@Override public long onReceiveEnergy(ForgeDirection from,long receive,boolean doReceive){
  long used=0;
  long remain=receive;
  for (int i=0; i < 6; i++) {
    TileTurret turret=this.turrets[i];
    if (turret != null && turret.getTurret() != null) {
      long added=turret.getTurret().battery.receiveEnergy(remain,doReceive);
      used+=added;
      remain-=added;
    }
  }
  return used;
}

Fixed version (ground truth):
@Override public long onReceiveEnergy(ForgeDirection from,long receive,boolean doReceive){
  long used=0;
  long remain=receive;
  for (int i=0; i < 6; i++) {
    TileTurret turret=this.turrets[i];
    if (turret != null && turret.getTurret() instanceof IEnergyContainer) {
      long added=turret.getTurret().battery.receiveEnergy(remain,doReceive);
      used+=added;
      remain-=added;
    }
  }
  return used;
}
Program: 169787
Project: 169787
Buggy source:
@Override public long getMaxExtract(){
  if (Turret.this.getWeaponSystem() instanceof IEnergyWeapon) {
    return ((IEnergyWeapon)Turret.this.getWeaponSystem()).getEnergyPerShot();
  }
  return this.getEnergyCapacity();
}

Fixed version (ground truth):
@Override public long getMaxExtract(){
  return this.getEnergyCapacity();
}
Program: 169788
Project: 169788
Buggy source:
public Turret(ITurretProvider host){
  this.host=host;
  this.ai=new TurretAI(this);
  this.battery=new EnergyStorageHandler(){
    @Override public long getEnergyCapacity(){
      return SentryTrait.asLong(Turret.this.getTrait(ITurret.ENERGY_STORAGE_TRAIT),this.capacity);
    }
    @Override public long getMaxExtract(){
      if (Turret.this.getWeaponSystem() instanceof IEnergyWeapon) {
        return ((IEnergyWeapon)Turret.this.getWeaponSystem()).getEnergyPerShot();
      }
      return this.getEnergyCapacity();
    }
  }
;
  newTrait(new SentryTraitLong(ITurret.ENERGY_STORAGE_TRAIT,IUpgrade.ENERGY_STORAGE,100000));
  newTrait(new SentryTraitLong(ITurret.ENERGY_RUNNING_TRAIT,IUpgrade.ENERGY_EFFICIENCY,10));
  newTrait(new SentryTraitDouble(ITurret.MAX_HEALTH_TRAIT,50.0));
  newTrait(new SentryTraitDouble(ITurret.SEARCH_RANGE_TRAIT,IUpgrade.TARGET_RANGE,20.0));
  newTrait(new SentryTraitDouble(ITurret.ROTATION_SPEED_TRAIT,5));
  newTrait(new SentryTraitDouble(ITurret.ROTATION_SPEED_WITH_TARGET_TRAIT,7));
  newTrait(new SentryTraitInteger(ITurret.AMMO_RELOAD_TIME_TRAIT,20));
}

Fixed version (ground truth):
public Turret(ITurretProvider host){
  this.host=host;
  this.ai=new TurretAI(this);
  this.battery=new EnergyStorageHandler(){
    @Override public long getEnergyCapacity(){
      return SentryTrait.asLong(Turret.this.getTrait(ITurret.ENERGY_STORAGE_TRAIT),this.capacity);
    }
    @Override public long getMaxReceive(){
      return this.getEnergyCapacity();
    }
    @Override public long getMaxExtract(){
      return this.getEnergyCapacity();
    }
  }
;
  newTrait(new SentryTraitLong(ITurret.ENERGY_STORAGE_TRAIT,IUpgrade.ENERGY_STORAGE,100000));
  newTrait(new SentryTraitLong(ITurret.ENERGY_RUNNING_TRAIT,IUpgrade.ENERGY_EFFICIENCY,10));
  newTrait(new SentryTraitDouble(ITurret.MAX_HEALTH_TRAIT,50.0));
  newTrait(new SentryTraitDouble(ITurret.SEARCH_RANGE_TRAIT,IUpgrade.TARGET_RANGE,20.0));
  newTrait(new SentryTraitDouble(ITurret.ROTATION_SPEED_TRAIT,5));
  newTrait(new SentryTraitDouble(ITurret.ROTATION_SPEED_WITH_TARGET_TRAIT,7));
  newTrait(new SentryTraitInteger(ITurret.AMMO_RELOAD_TIME_TRAIT,20));
}
Program: 169790
Project: 169790
Buggy source:
@Override public void invalidate(){
  FrequencyGrid.instance().unregister(this);
  super.invalidate();
}

Fixed version (ground truth):
@Override public void invalidate(){
  FrequencyGrid.instance().unregister((IBlockFrequency)this);
  super.invalidate();
}
Program: 169792
Project: 169792
Buggy source:
/** 
 * Builds a new sentry instance from the given sentry ID and argument. Sentry ID must be registered to a class, and the args must match a constructor in the registered class.
 * @param sentryID the key of the Sentry class used in SentryRegistry.registerSentry()
 * @param args arguments the Sentry's class constructor requires
 * @return the Sentry object for the given id and tile, or null it failed to create the sentry
 */
public static Turret constructSentry(String sentryID,Object... args){
  Object candidate=null;
  Turret sentryModule=null;
  try {
    Class clazz=SaveManager.getClass(sentryID);
    if (clazz != null) {
      Constructor<?> con=ReflectionHelper.getConstructorWithArgs(clazz,args);
      if (con != null) {
        candidate=con.newInstance(args);
      }
      if (candidate instanceof Turret) {
        sentryModule=(Turret)candidate;
      }
 else {
        ICBMCore.LOGGER.severe("String_Node_Str" + sentryID + "String_Node_Str"+ con+ "String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return sentryModule;
}

Fixed version (ground truth):
/** 
 * Builds a new sentry instance from the given sentry ID and argument. Sentry ID must be registered to a class, and the args must match a constructor in the registered class.
 * @param sentryID the key of the Sentry class used in SentryRegistry.registerSentry()
 * @param args arguments the Sentry's class constructor requires
 * @return the Sentry object for the given id and tile, or null it failed to create the sentry
 */
public static Turret constructSentry(String sentryID,Object... args){
  Object candidate=null;
  Turret sentryModule=null;
  try {
    Class clazz=SaveManager.getClass(sentryID);
    if (clazz != null) {
      Constructor<?> con=ReflectionUtility.getConstructorWithArgs(clazz,args);
      if (con != null) {
        candidate=con.newInstance(args);
      }
      if (candidate instanceof Turret) {
        sentryModule=(Turret)candidate;
      }
 else {
        ICBMCore.LOGGER.severe("String_Node_Str" + sentryID + "String_Node_Str"+ con+ "String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return sentryModule;
}
Program: 169793
Project: 169793
Buggy source:
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack itemStack,EntityPlayer par2EntityPlayer,List par3List,boolean par4){
  super.addInformation(itemStack,par2EntityPlayer,par3List,par4);
  Entity trackingEntity=getTrackingEntity(FMLClientHandler.instance().getClient().theWorld,itemStack);
  if (trackingEntity != null) {
    par3List.add(LanguageUtility.getLocal("String_Node_Str") + "String_Node_Str" + trackingEntity.getEntityName());
  }
  if (par2EntityPlayer.username.equalsIgnoreCase("String_Node_Str") || par2EntityPlayer.username.equalsIgnoreCase("String_Node_Str")) {
    par3List.add("String_Node_Str");
    par3List.add("String_Node_Str");
    par3List.add("String_Node_Str");
    par3List.add("String_Node_Str");
  }
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack itemStack,EntityPlayer par2EntityPlayer,List par3List,boolean par4){
  super.addInformation(itemStack,par2EntityPlayer,par3List,par4);
  Entity trackingEntity=getTrackingEntity(FMLClientHandler.instance().getClient().theWorld,itemStack);
  if (trackingEntity != null) {
    par3List.add(LanguageUtility.getLocal("String_Node_Str") + "String_Node_Str" + trackingEntity.getEntityName());
  }
  par3List.add(LanguageUtility.getLocal("String_Node_Str"));
  if (par2EntityPlayer.username.equalsIgnoreCase("String_Node_Str")) {
    par3List.add("String_Node_Str");
    par3List.add("String_Node_Str");
  }
}
Program: 169794
Project: 169794
Buggy source:
@Override public double getRange(){
  return this.default_target_range;
}

Fixed version (ground truth):
@Override public double getRange(){
  return this.target_range;
}
Program: 169795
Project: 169795
Buggy source:
public void updateUpgrades(){
  IInventory inv=this.getHost().getInventory();
  this.upgrade_count.clear();
  for (int slot=0; slot < inv.getSizeInventory(); slot++) {
    if (inv.getStackInSlot(slot) != null && inv.getStackInSlot(slot).getItem() instanceof ITurretUpgrade) {
      List<String> id_list=new ArrayList<String>();
      ((ITurretUpgrade)inv.getStackInSlot(slot).getItem()).getTypes(id_list,inv.getStackInSlot(slot));
      for (      String id : id_list) {
        if (!this.upgrade_count.containsKey(id)) {
          this.upgrade_count.put(id,0.0);
        }
        this.upgrade_count.put(id,this.upgrade_count.get(id) + ((ITurretUpgrade)inv.getStackInSlot(slot).getItem()).getUpgradeEfficiance(inv.getStackInSlot(slot),id));
      }
    }
  }
  if (this.upgrade_count.containsKey(ITurretUpgrade.TARGET_RANGE)) {
    this.target_range=this.default_target_range + (this.default_target_range * this.upgrade_count.get(ITurretUpgrade.TARGET_RANGE));
  }
}

Fixed version (ground truth):
public void updateUpgrades(){
  IInventory inv=this.getHost().getInventory();
  this.upgrade_count.clear();
  this.target_range=this.default_target_range;
  for (int slot=0; slot < inv.getSizeInventory(); slot++) {
    if (inv.getStackInSlot(slot) != null && inv.getStackInSlot(slot).getItem() instanceof ITurretUpgrade) {
      final List<String> id_list=new ArrayList<String>();
      ((ITurretUpgrade)inv.getStackInSlot(slot).getItem()).getTypes(id_list,inv.getStackInSlot(slot));
      for (      String id : id_list) {
        if (!this.upgrade_count.containsKey(id)) {
          this.upgrade_count.put(id,0.0D);
        }
        this.upgrade_count.put(id,this.upgrade_count.get(id) + ((ITurretUpgrade)inv.getStackInSlot(slot).getItem()).getUpgradeEfficiance(inv.getStackInSlot(slot),id));
      }
    }
  }
  if (this.upgrade_count.containsKey(ITurretUpgrade.TARGET_RANGE)) {
    this.target_range=this.default_target_range + (this.default_target_range * this.upgrade_count.get(ITurretUpgrade.TARGET_RANGE));
  }
}
Program: 169796
Project: 169796
Buggy source:
public int compare(Entity entityA,Entity entityB){
  double distanceA=this.location.distance(entityA);
  double distanceB=this.location.distance(entityB);
  if (Math.abs(distanceA - distanceB) < 1.5) {
    float healthA=entityA instanceof EntityLivingBase ? ((EntityLivingBase)entityA).getHealth() : 0;
    float healthB=entityB instanceof EntityLivingBase ? ((EntityLivingBase)entityB).getHealth() : 0;
    return healthA < healthB ? -1 : (healthA > healthB ? 1 : 0);
  }
  return distanceA < distanceB ? -1 : (distanceA > distanceB ? 1 : 0);
}

Fixed version (ground truth):
public int compare(Entity entityA,Entity entityB){
  double distanceA=this.location.distance(entityA);
  double distanceB=this.location.distance(entityB);
  if (Math.abs(distanceA - distanceB) < 1.5) {
    float healthA=entityA instanceof EntityLivingBase ? ((EntityLivingBase)entityA).getHealth() : 0;
    float healthB=entityB instanceof EntityLivingBase ? ((EntityLivingBase)entityB).getHealth() : 0;
    return healthA < healthB ? -1 : (healthA != healthB ? 1 : 0);
  }
  return distanceA < distanceB ? -1 : (distanceA != distanceB ? 1 : 0);
}
Program: 169797
Project: 169797
Buggy source:
private void TurretUpgradeType(String name,String upgradeName,double bonus,int maxDamage,String de){
  this.iconName=name;
  this.maxUses=maxDamage;
  this.details=de;
  this.upgradeName=upgradeName;
  this.bonus=bonus;
}

Fixed version (ground truth):
private void TurretUpgradeType(String name,String upgradeName,double bonus,String de){
  this.iconName=name;
  this.details=de;
  this.upgradeName=upgradeName;
  this.bonus=bonus;
}
Program: 169798
Project: 169798
Buggy source:
@Override public void addInformation(ItemStack itemStack,EntityPlayer par2EntityPlayer,List par3List,boolean par4){
  if (itemStack != null) {
    if (itemStack.getTagCompound() == null) {
      itemStack.setTagCompound(new NBTTagCompound());
    }
    par3List.addAll(LanguageUtility.splitStringPerWord(TurretUpgradeType.getDescription(itemStack.getItemDamage()),4));
    par3List.add("String_Node_Str" + (UnitDisplay.roundDecimals((itemStack.getTagCompound().getInteger("String_Node_Str") / TurretUpgradeType.getMaxUses(itemStack.getItemDamage()))) + "String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void addInformation(ItemStack itemStack,EntityPlayer par2EntityPlayer,List par3List,boolean par4){
  if (itemStack != null) {
    if (itemStack.getTagCompound() == null) {
      itemStack.setTagCompound(new NBTTagCompound());
    }
    par3List.addAll(LanguageUtility.splitStringPerWord(TurretUpgradeType.getDescription(itemStack.getItemDamage()),4));
  }
}
Program: 169799
Project: 169799
Buggy source:
public EulerServo getServo(){
  return servo;
}

Fixed version (ground truth):
public EulerServo getServo(){
  if (servo == null) {
    servo=new EulerServo(5);
  }
  return servo;
}
Program: 169800
Project: 169800
Buggy source:
public Turret(ITurretProvider host){
  this.host=host;
  energy=new EnergyStorageHandler(10000);
  servo=new EulerServo(5);
  ai=new TurretAI(this);
}

Fixed version (ground truth):
public Turret(ITurretProvider host){
  this.host=host;
  energy=new EnergyStorageHandler(10000);
  ai=new TurretAI(this);
}
Program: 169801
Project: 169801
Buggy source:
public ResourceLocation getTexture(EntityPlayer player,TileTurret tile){
  if (tile != null && player != null) {
    if (tile.getAccessProfile().getOwnerGroup().isMemeber(player.username))     return this.textureFriendly;
    if (tile.canUse(Nodes.GROUP_USER_NODE,player)) {
      return textureNeutral;
    }
  }
  return textureHostile;
}

Fixed version (ground truth):
public ResourceLocation getTexture(EntityPlayer player,TileTurret tile){
  if (tile != null && player != null) {
    if (tile.canUse(Nodes.GROUP_ADMIN_NODE,player) || tile.canUse(Nodes.GROUP_OWNER_NODE,player))     return this.textureFriendly;
    if (tile.canAccess(player.username)) {
      return textureNeutral;
    }
  }
  return textureHostile;
}
Program: 169802
Project: 169802
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity,ItemStack itemstack){
  TileEntity te=world.getBlockTileEntity(x,y,z);
  if (te instanceof TileTurret && entity instanceof EntityPlayer) {
    ((TileTurret)te).getAccessProfile().getOwnerGroup().addMemeber(new AccessUser(((EntityPlayer)entity).username));
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity,ItemStack itemstack){
  if (!world.isRemote) {
    TileEntity te=world.getBlockTileEntity(x,y,z);
    if (te instanceof TileTurret && entity instanceof EntityPlayer) {
      ((TileTurret)te).getAccessProfile().setUserAccess(((EntityPlayer)entity).username,((TileTurret)te).getAccessProfile().getOwnerGroup(),false);
      ((TileTurret)te).onProfileChange();
    }
  }
}