nus-yam/ex-repair huggingface dataset:
Program: 156648
Project: 156648
Buggy source:
@Override public Object getClientGuiElement(int id,EntityPlayer player,World world,BlockPos pos){
  if (!world.blockExists(pos)) {
    return null;
  }
  TileEntity tile=world.getTileEntity(pos);
switch (id) {
case GuiIds.AUTO_CRAFTING_TABLE:
    if (!(tile instanceof TileAutoWorkbench)) {
      return null;
    }
 else {
      return new GuiAutoCrafting(player.inventory,world,(TileAutoWorkbench)tile);
    }
case GuiIds.REFINERY:
  if (!(tile instanceof TileRefinery)) {
    return null;
  }
 else {
    return new GuiRefinery(player.inventory,(TileRefinery)tile);
  }
case GuiIds.HOPPER:
if (!(tile instanceof TileHopper)) {
  return null;
}
 else {
  return new GuiHopper(player.inventory,(TileHopper)tile);
}
default :
return null;
}
}

Fixed version (ground truth):
@Override public Object getClientGuiElement(int id,EntityPlayer player,World world,int x,int y,int z){
  BlockPos pos=new BlockPos(x,y,z);
  if (world.isAirBlock(pos)) {
    return null;
  }
  TileEntity tile=world.getTileEntity(pos);
switch (id) {
case GuiIds.AUTO_CRAFTING_TABLE:
    if (!(tile instanceof TileAutoWorkbench)) {
      return null;
    }
 else {
      return new GuiAutoCrafting(player.inventory,world,(TileAutoWorkbench)tile);
    }
case GuiIds.REFINERY:
  if (!(tile instanceof TileRefinery)) {
    return null;
  }
 else {
    return new GuiRefinery(player.inventory,(TileRefinery)tile);
  }
case GuiIds.HOPPER:
if (!(tile instanceof TileChute)) {
  return null;
}
 else {
  return new GuiChute(player.inventory,(TileChute)tile);
}
default :
return null;
}
}
Program: 156649
Project: 156649
Buggy source:
@Override public void initializeTileEntities(){
  super.initializeTileEntities();
  if (BuildCraftFactory.tankBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class,new RenderTank());
  }
  if (BuildCraftFactory.refineryBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class,new RenderRefinery());
    RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock,0),new RenderRefinery());
  }
  if (BuildCraftFactory.hopperBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileHopper.class,new RenderHopper());
    RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock,0),new RenderHopper());
  }
}

Fixed version (ground truth):
@Override public void initializeTileEntities(){
  super.initializeTileEntities();
  if (BuildCraftFactory.tankBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class,new RenderTank());
  }
  if (BuildCraftFactory.refineryBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class,new RenderRefinery());
  }
  if (BuildCraftFactory.chuteBlock != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileChute.class,new RenderChute());
  }
}
Program: 156650
Project: 156650
Buggy source:
@Override public boolean onBlockActivated(World world,BlockPos pos,EntityPlayer entityplayer,int par6,float par7,float par8,float par9){
  if (super.onBlockActivated(world,pos,entityplayer,par6,par7,par8,par9)) {
    return true;
  }
  if (entityplayer.isSneaking()) {
    return false;
  }
  if (entityplayer.getCurrentEquippedItem() != null) {
    if (entityplayer.getCurrentEquippedItem().getItem() instanceof IItemPipe) {
      return false;
    }
  }
  if (!world.isRemote) {
    entityplayer.openGui(BuildCraftFactory.instance,GuiIds.AUTO_CRAFTING_TABLE,world,pos);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer entityplayer,EnumFacing face,float par7,float par8,float par9){
  if (super.onBlockActivated(world,pos,state,entityplayer,face,par7,par8,par9)) {
    return true;
  }
  if (entityplayer.isSneaking()) {
    return false;
  }
  if (entityplayer.getCurrentEquippedItem() != null) {
    if (entityplayer.getCurrentEquippedItem().getItem() instanceof IItemPipe) {
      return false;
    }
  }
  if (!world.isRemote) {
    entityplayer.openGui(BuildCraftFactory.instance,GuiIds.AUTO_CRAFTING_TABLE,world,pos.getX(),pos.getY(),pos.getZ());
  }
  return true;
}
Program: 156651
Project: 156651
Buggy source:
@Override public ConnectOverride overridePipeConnection(IPipeTile.PipeType type,EnumFacing with){
  if (with.ordinal() == worldObj.getBlockMetadata(xCoord,yCoord,zCoord)) {
    return ConnectOverride.DISCONNECT;
  }
  return type == IPipeTile.PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
}

Fixed version (ground truth):
@Override public ConnectOverride overridePipeConnection(IPipeTile.PipeType type,EnumFacing with){
  if (BuildCraftProperties.BLOCK_FACING.getValue(worldObj.getBlockState(pos)) == with) {
    return ConnectOverride.DISCONNECT;
  }
  return type == IPipeTile.PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
}
Program: 156652
Project: 156652
Buggy source:
@Override public void readData(ByteBuf stream){
  super.readData(stream);
  int newLedState=stream.readUnsignedByte();
  if (newLedState != ledState) {
    ledState=newLedState;
    worldObj.markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
  }
}

Fixed version (ground truth):
@Override public void readData(ByteBuf stream){
  super.readData(stream);
  int newLedState=stream.readUnsignedByte();
  if (newLedState != ledState) {
    ledState=newLedState;
    worldObj.markBlockRangeForRenderUpdate(pos,pos);
  }
}
Program: 156654
Project: 156654
Buggy source:
@Override public void invalidate(){
  super.invalidate();
  if (miner != null) {
    miner.invalidate();
  }
  if (worldObj != null && yCoord > 2) {
    BuildCraftFactory.miningWellBlock.removePipes(worldObj,xCoord,yCoord,zCoord);
  }
}

Fixed version (ground truth):
@Override public void invalidate(){
  super.invalidate();
  if (miner != null) {
    miner.invalidate();
  }
  if (worldObj != null && pos.getY() > 2) {
    BuildCraftFactory.miningWellBlock.removePipes(worldObj,pos);
  }
}
Program: 156655
Project: 156655
Buggy source:
void EFrameConnection(AxisAlignedBB bb){
  boundingBox=bb;
}

Fixed version (ground truth):
void EFrameConnection(EnumFacing... facings){
  this.facings=facings;
  AxisAlignedBB bb=new AxisAlignedBB(0.25,0.25,0.25,0.75,0.75,0.75);
  for (  EnumFacing face : facings) {
    bb=bb.addCoord(face.getFrontOffsetX() * 0.25,face.getFrontOffsetY() * 0.25,face.getFrontOffsetZ() * 0.25);
  }
  boundingBox=bb;
  connectionMap.put(facings,this);
}
Program: 156656
Project: 156656
Buggy source:
public BlockFrame(){
  super(Material.glass,CONNECTIONS);
  setHardness(0.5F);
}

Fixed version (ground truth):
public BlockFrame(){
  super(Material.glass,CONNECTIONS);
  setHardness(0.5F);
  setLightOpacity(0);
}
Program: 156657
Project: 156657
Buggy source:
private void initializeBlueprintBuilder(){
  Blueprint bpt=((FillerPattern)FillerManager.registry.getPattern("String_Node_Str")).getBlueprint(box,worldObj,new IStatementParameter[0],BuildCraftBuilders.frameBlock.getDefaultState());
  if (bpt != null) {
    builder=new BptBuilderBlueprint(bpt,worldObj,new BlockPos(box.xMin,pos.getY(),box.zMin));
    stage=Stage.BUILDING;
  }
}

Fixed version (ground truth):
private void initializeBlueprintBuilder(){
  PatternQuarryFrame pqf=PatternQuarryFrame.INSTANCE;
  Blueprint bpt=((FillerPattern)FillerManager.registry.getPattern("String_Node_Str")).getBlueprint(box,worldObj,new IStatementParameter[0],BuildCraftBuilders.frameBlock.getDefaultState());
  if (bpt != null) {
    builder=new BptBuilderBlueprint(bpt,worldObj,new BlockPos(box.xMin,pos.getY(),box.zMin));
    stage=Stage.BUILDING;
  }
}
Program: 156660
Project: 156660
Buggy source:
@Mod.EventHandler public void postInit(FMLPostInitializationEvent evt){
  facadeItem.initialize();
  if (debugPrintFacadeList) {
    try {
      PrintWriter writer=new PrintWriter("String_Node_Str","String_Node_Str");
      writer.println("String_Node_Str");
      for (      ItemStack stack : ItemFacade.allFacades) {
        if (facadeItem.getBlocksForFacade(stack).length > 0) {
          writer.println(Block.blockRegistry.getNameForObject(facadeItem.getBlocksForFacade(stack)[0]) + "String_Node_Str" + facadeItem.getMetaValuesForFacade(stack)[0]);
        }
      }
      writer.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Mod.EventHandler public void postInit(FMLPostInitializationEvent evt){
  facadeItem.initialize();
  if (debugPrintFacadeList) {
    try {
      PrintWriter writer=new PrintWriter("String_Node_Str","String_Node_Str");
      writer.println("String_Node_Str");
      for (      ItemStack stack : ItemFacade.allFacades) {
        if (facadeItem.getBlocksForFacade(stack).length > 0) {
          writer.println(Block.blockRegistry.getNameForObject(facadeItem.getBlocksForFacade(stack)[0]) + "String_Node_Str" + facadeItem.getMetaValuesForFacade(stack)[0]);
        }
      }
      writer.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  ListMatchHandlerClass.itemClasses.add(ItemPipe.class);
  ListMatchHandlerClass.itemClasses.add(ItemGate.class);
  ListMatchHandlerClass.itemClasses.add(ItemFacade.class);
  ListMatchHandlerClass.itemClasses.add(ItemPipeWire.class);
}
Program: 156661
Project: 156661
Buggy source:
public void drawStack(ItemStack item){
  int cornerX=(gui.width - gui.getXSize()) / 2;
  int cornerY=(gui.height - gui.getYSize()) / 2;
  gui.drawStack(item,cornerX + x,cornerY + y);
}

Fixed version (ground truth):
public void drawStack(ItemStack item){
  int cornerX=(gui.width - gui.getXSize()) / 2;
  int cornerY=(gui.height - gui.getYSize()) / 2;
  gui.drawStack(item,cornerX + x,cornerY + y);
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
}
Program: 156662
Project: 156662
Buggy source:
public void drawSprite(int cornerX,int cornerY){
  Minecraft mc=Minecraft.getMinecraft();
  if (drawBackround) {
    mc.renderEngine.bindTexture(TEXTURE_SLOT);
    gui.drawTexturedModalRect(cornerX + x - 1,cornerY + y - 1,0,0,18,18);
  }
  if (!isDefined()) {
    return;
  }
  if (getItemStack() != null) {
    drawStack(getItemStack());
  }
 else   if (getIcon() != null) {
    mc.renderEngine.bindTexture(getTexture());
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    gui.drawTexturedModelRectFromIcon(cornerX + x,cornerY + y,getIcon(),16,16);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
  }
}

Fixed version (ground truth):
public void drawSprite(int cornerX,int cornerY){
  Minecraft mc=Minecraft.getMinecraft();
  if (drawBackround) {
    mc.renderEngine.bindTexture(TEXTURE_SLOT);
    gui.drawTexturedModalRect(cornerX + x - 1,cornerY + y - 1,0,0,18,18);
  }
  if (!isDefined()) {
    return;
  }
  if (getItemStack() != null) {
    drawStack(getItemStack());
  }
 else   if (getIcon() != null) {
    mc.renderEngine.bindTexture(getTexture());
    GL11.glPushAttrib(GL11.GL_LIGHTING_BIT | GL11.GL_COLOR_BUFFER_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    gui.drawTexturedModelRectFromIcon(cornerX + x,cornerY + y,getIcon(),16,16);
    GL11.glPopAttrib();
  }
}
Program: 156663
Project: 156663
Buggy source:
@Override public void worldMoved(GuiUrbanist gui,MovingObjectPosition pos){
  if (step == 1) {
    x=pos.blockX;
    z=pos.blockZ;
    gui.urbanist.rpcMoveFrame(pos);
  }
 else   if (step == 2) {
    float ydiff=(float)Mouse.getY() / (float)Minecraft.getMinecraft().displayHeight;
    y=(int)(startY + (ydiff - baseY) * 50);
    gui.urbanist.rpcMoveFrame(pos);
  }
}

Fixed version (ground truth):
@Override public void worldMoved(GuiUrbanist gui,MovingObjectPosition pos){
  if (step == 1) {
    this.pos=new BlockPos(pos.getBlockPos().getX(),this.pos.getY(),pos.getBlockPos().getX());
    gui.urbanist.rpcMoveFrame(this.pos);
  }
 else   if (step == 2) {
    float ydiff=(float)Mouse.getY() / (float)Minecraft.getMinecraft().displayHeight;
    this.pos=new BlockPos(this.pos.getX(),(int)(start.getY() + (ydiff - baseY) * 50),this.pos.getZ());
    gui.urbanist.rpcMoveFrame(this.pos);
  }
}
Program: 156664
Project: 156664
Buggy source:
@Override public void worldClicked(GuiUrbanist gui,MovingObjectPosition pos){
  gui.urbanist.rpcEraseBlock(pos.blockX,pos.blockY,pos.blockZ);
}

Fixed version (ground truth):
@Override public void worldClicked(GuiUrbanist gui,MovingObjectPosition pos){
  gui.urbanist.rpcEraseBlock(pos.getBlockPos());
}
Program: 156665
Project: 156665
Buggy source:
@Override public void areaSet(GuiUrbanist gui,int x1,int y1,int z1,int x2,int y2,int z2){
  super.areaSet(gui,x1,y1,z1,x2,y2,z2);
  if (selection != -1) {
    Box box=new Box();
    box.initialize(x1,y1,z1,x2,y2,z2);
    gui.urbanist.rpcStartFiller(fillerSlots.get(selection).getPattern().getUniqueTag(),box);
  }
}

Fixed version (ground truth):
@Override public void areaSet(GuiUrbanist gui,BlockPos start,BlockPos end){
  super.areaSet(gui,start,end);
  if (selection != -1) {
    Box box=new Box(start,end);
    gui.urbanist.rpcStartFiller(fillerSlots.get(selection).getPattern().getUniqueTag(),box);
  }
}
Program: 156666
Project: 156666
Buggy source:
@Override @SideOnly(Side.CLIENT) public TextureAtlasSprite getIcon(int iconIndex){
  return icons[iconIndex];
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) public TextureAtlasSprite getIcon(int iconIndex){
  return icons[iconIndex];
}
Program: 156667
Project: 156667
Buggy source:
@Override public ItemStack getStack(){
  Item item=(Item)Item.itemRegistry.getObject("String_Node_Str");
  if (item == null) {
    throw new Error("String_Node_Str");
  }
  ItemStack stack=new ItemStack(item,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  nbt.setString("String_Node_Str",id.name);
  nbt.setByte("String_Node_Str",(byte)buildingPermission.ordinal());
  nbt.setBoolean("String_Node_Str",isComplete);
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getStack(){
  Item item=(Item)Item.itemRegistry.getObject("String_Node_Str");
  if (item == null) {
    throw new Error("String_Node_Str");
  }
  ItemStack stack=new ItemStack(item,1,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  nbt.setString("String_Node_Str",id.name);
  nbt.setByte("String_Node_Str",(byte)buildingPermission.ordinal());
  nbt.setBoolean("String_Node_Str",isComplete);
  return stack;
}
Program: 156668
Project: 156668
Buggy source:
@Override public ItemStack getStack(){
  Item item=(Item)Item.itemRegistry.getObject("String_Node_Str");
  if (item == null) {
    throw new Error("String_Node_Str");
  }
  ItemStack stack=new ItemStack(item,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  nbt.setString("String_Node_Str",id.name);
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getStack(){
  Item item=(Item)Item.itemRegistry.getObject("String_Node_Str");
  if (item == null) {
    throw new Error("String_Node_Str");
  }
  ItemStack stack=new ItemStack(item,1,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  nbt.setString("String_Node_Str",id.name);
  return stack;
}
Program: 156669
Project: 156669
Buggy source:
public static Object getBlockResourceLocation(Block block){
  return new ModelResourceLocation(Utils.getNameForBlock(block));
}

Fixed version (ground truth):
public static Object getBlockResourceLocation(Block block){
  return new ModelResourceLocation(Utils.getNameForBlock(block).replace("String_Node_Str","String_Node_Str"));
}
Program: 156670
Project: 156670
Buggy source:
public static ModelResourceLocation getItemResourceLocation(Item item,String suffix){
  return new ModelResourceLocation(Utils.getNameForItem(item) + suffix,"String_Node_Str");
}

Fixed version (ground truth):
public static ModelResourceLocation getItemResourceLocation(Item item,String suffix){
  return new ModelResourceLocation(Utils.getNameForItem(item).replace("String_Node_Str","String_Node_Str") + suffix,"String_Node_Str");
}
Program: 156671
Project: 156671
Buggy source:
@Override public boolean equals(Object obj){
  if (obj.getClass() != getClass()) {
    return false;
  }
  ResourceId compareId=(ResourceId)obj;
  return index.equals(compareId.index) && side == compareId.side && localId == compareId.localId;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj == null || obj.getClass() != getClass()) {
    return false;
  }
  ResourceId compareId=(ResourceId)obj;
  return index.equals(compareId.index) && side == compareId.side && localId == compareId.localId;
}
Program: 156672
Project: 156672
Buggy source:
@Override public boolean onBlockActivated(World world,int i,int j,int k,EntityPlayer entityplayer,int par6,float par7,float par8,float par9){
  if (super.onBlockActivated(world,i,j,k,entityplayer,par6,par7,par8,par9)) {
    return true;
  }
  if (entityplayer.inventory.getCurrentItem() != null && entityplayer.inventory.getCurrentItem().getItem() instanceof IMapLocation) {
    return false;
  }
  if (entityplayer.isSneaking()) {
    return false;
  }
  TileEntity tile=world.getTileEntity(i,j,k);
  if (tile instanceof TileMarker && !(tile instanceof TileConstructionMarker)) {
    ((TileMarker)tile).tryConnection();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int i,int j,int k,EntityPlayer entityplayer,int par6,float par7,float par8,float par9){
  if (super.onBlockActivated(world,i,j,k,entityplayer,par6,par7,par8,par9)) {
    return true;
  }
  if (entityplayer.inventory.getCurrentItem() != null && entityplayer.inventory.getCurrentItem().getItem() instanceof IMapLocation) {
    return false;
  }
  if (entityplayer.isSneaking()) {
    return false;
  }
  TileEntity tile=world.getTileEntity(i,j,k);
  if (tile instanceof TileMarker) {
    ((TileMarker)tile).tryConnection();
    return true;
  }
  return false;
}
Program: 156673
Project: 156673
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileArchitect architect=(TileArchitect)tileentity;
  if (architect != null) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslated(x,y,z);
    GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
    for (    LaserData laser : architect.subLasers) {
      if (laser != null) {
        GL11.glPushMatrix();
        RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e,laser,EntityLaser.LASER_TEXTURES[3]);
        GL11.glPopMatrix();
      }
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileArchitect architect=(TileArchitect)tileentity;
  GL11.glPushMatrix();
  GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
  GL11.glEnable(GL11.GL_CULL_FACE);
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
  GL11.glTranslated(x,y,z);
  GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
  for (  LaserData laser : architect.subLasers) {
    if (laser != null) {
      GL11.glPushMatrix();
      RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e,laser,EntityLaser.LASER_TEXTURES[3]);
      GL11.glPopMatrix();
    }
  }
  GL11.glPopAttrib();
  GL11.glPopMatrix();
}
Program: 156674
Project: 156674
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileConstructionMarker marker=(TileConstructionMarker)tileentity;
  if (marker != null) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslated(x,y,z);
    GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
    if (marker.laser != null) {
      GL11.glPushMatrix();
      RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e,marker.laser,EntityLaser.LASER_TEXTURES[4]);
      GL11.glPopMatrix();
    }
    if (marker.itemBlueprint != null) {
      doRenderItem(marker.itemBlueprint,marker.xCoord + 0.5F,marker.yCoord + 0.2F,marker.zCoord + 0.5F);
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    renderItems.render(tileentity,x,y,z);
  }
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileConstructionMarker marker=(TileConstructionMarker)tileentity;
  GL11.glPushMatrix();
  GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
  GL11.glEnable(GL11.GL_CULL_FACE);
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
  GL11.glTranslated(x,y,z);
  GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
  if (marker.laser != null) {
    GL11.glPushMatrix();
    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e,marker.laser,EntityLaser.LASER_TEXTURES[4]);
    GL11.glPopMatrix();
  }
  if (marker.itemBlueprint != null) {
    doRenderItem(marker.itemBlueprint,marker.xCoord + 0.5F,marker.yCoord + 0.2F,marker.zCoord + 0.5F);
  }
  GL11.glPopAttrib();
  GL11.glPopMatrix();
  renderItems.render(tileentity,x,y,z);
}
Program: 156675
Project: 156675
Buggy source:
public void write(ByteBuf data){
  data.writeShort(items.size());
  if (items != null) {
    for (    ItemStack rb : items) {
      NetworkUtils.writeStack(data,rb);
      data.writeShort(rb.stackSize);
    }
  }
}

Fixed version (ground truth):
public void write(ByteBuf data){
  data.writeShort(items.size());
  for (  ItemStack rb : items) {
    NetworkUtils.writeStack(data,rb);
    data.writeShort(rb.stackSize);
  }
}
Program: 156676
Project: 156676
Buggy source:
private Packet getItemRequirementsPacket(final ArrayList<ItemStack> items){
  if (items != null) {
    return new PacketCommand(this,"String_Node_Str",new CommandWriter(){
      public void write(      ByteBuf data){
        data.writeShort(items.size());
        if (items != null) {
          for (          ItemStack rb : items) {
            NetworkUtils.writeStack(data,rb);
            data.writeShort(rb.stackSize);
          }
        }
      }
    }
);
  }
 else {
    return new PacketCommand(this,"String_Node_Str",null);
  }
}

Fixed version (ground truth):
private Packet getItemRequirementsPacket(final ArrayList<ItemStack> items){
  if (items != null) {
    return new PacketCommand(this,"String_Node_Str",new CommandWriter(){
      public void write(      ByteBuf data){
        data.writeShort(items.size());
        for (        ItemStack rb : items) {
          NetworkUtils.writeStack(data,rb);
          data.writeShort(rb.stackSize);
        }
      }
    }
);
  }
 else {
    return new PacketCommand(this,"String_Node_Str",null);
  }
}
Program: 156677
Project: 156677
Buggy source:
public void createUtilsIfNeeded(){
  if (!worldObj.isRemote) {
    if (builder == null) {
      if (!box.isInitialized()) {
        setBoundaries(loadDefaultBoundaries);
      }
      initializeBlueprintBuilder();
    }
  }
  if (stage != Stage.BUILDING) {
    box.isVisible=false;
    if (arm == null) {
      createArm();
    }
    if (findTarget(false)) {
      if (box != null && ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax))) {
        setHead(box.xMin + 1,yCoord + 2,box.zMin + 1);
      }
    }
  }
 else {
    box.isVisible=true;
  }
}

Fixed version (ground truth):
public void createUtilsIfNeeded(){
  if (!worldObj.isRemote) {
    if (builder == null) {
      if (!box.isInitialized()) {
        setBoundaries(loadDefaultBoundaries);
      }
      initializeBlueprintBuilder();
    }
  }
  if (stage != Stage.BUILDING) {
    box.isVisible=false;
    if (arm == null) {
      createArm();
    }
    if (findTarget(false)) {
      if ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax)) {
        setHead(box.xMin + 1,yCoord + 2,box.zMin + 1);
      }
    }
  }
 else {
    box.isVisible=true;
  }
}
Program: 156678
Project: 156678
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (worldObj.isRemote) {
    if (stage != Stage.DONE) {
      moveHead(speed);
    }
    return;
  }
  if (stage == Stage.DONE) {
    if (mode == Mode.Loop) {
      stage=Stage.IDLE;
    }
 else {
      return;
    }
  }
  if (!areChunksLoaded()) {
    return;
  }
  if (mode == Mode.Off && stage != Stage.MOVING) {
    return;
  }
  createUtilsIfNeeded();
  if (stage == Stage.BUILDING) {
    if (builder != null && !builder.isDone(this)) {
      builder.buildNextSlot(worldObj,this,xCoord,yCoord,zCoord);
    }
 else {
      stage=Stage.IDLE;
    }
  }
 else   if (stage == Stage.DIGGING) {
    dig();
  }
 else   if (stage == Stage.IDLE) {
    idling();
    return;
  }
 else   if (stage == Stage.MOVING) {
    int energyUsed=this.getBattery().useEnergy(20,(int)Math.ceil(20 + getBattery().getEnergyStored() / 10),false);
    if (energyUsed >= 20) {
      speed=0.1 + energyUsed / 2000F;
      if (worldObj.isRaining()) {
        int headBPX=(int)headPosX;
        int headBPY=(int)headPosY;
        int headBPZ=(int)headPosZ;
        if (worldObj.getHeightValue(headBPX,headBPZ) < headBPY) {
          speed*=0.7;
        }
      }
      moveHead(speed);
    }
  }
  if (updateTracker.markTimeIfDelay(worldObj)) {
    sendNetworkUpdate();
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (worldObj.isRemote) {
    if (stage != Stage.DONE) {
      moveHead(speed);
    }
    return;
  }
  if (stage == Stage.DONE) {
    if (mode == Mode.Loop) {
      stage=Stage.IDLE;
    }
 else {
      return;
    }
  }
  if (!areChunksLoaded()) {
    return;
  }
  if (mode == Mode.Off && stage != Stage.MOVING) {
    return;
  }
  createUtilsIfNeeded();
  if (stage == Stage.BUILDING) {
    if (builder != null && !builder.isDone(this)) {
      builder.buildNextSlot(worldObj,this,xCoord,yCoord,zCoord);
    }
 else {
      stage=Stage.IDLE;
    }
  }
 else   if (stage == Stage.DIGGING) {
    dig();
  }
 else   if (stage == Stage.IDLE) {
    idling();
    return;
  }
 else   if (stage == Stage.MOVING) {
    int energyUsed=this.getBattery().useEnergy(20,(int)Math.ceil(20D + getBattery().getEnergyStored() / 10),false);
    if (energyUsed >= 20) {
      speed=0.1 + energyUsed / 2000F;
      if (worldObj.isRaining()) {
        int headBPX=(int)headPosX;
        int headBPY=(int)headPosY;
        int headBPZ=(int)headPosZ;
        if (worldObj.getHeightValue(headBPX,headBPZ) < headBPY) {
          speed*=0.7;
        }
      }
      moveHead(speed);
    }
  }
  if (updateTracker.markTimeIfDelay(worldObj)) {
    sendNetworkUpdate();
  }
}
Program: 156679
Project: 156679
Buggy source:
public void saveBuildStateToNBT(NBTTagCompound nbt,IBuildingItemsProvider builder){
  NBTTagList clearList=new NBTTagList();
  nbt.setByteArray("String_Node_Str",BitSetUtils.toByteArray(usedLocations));
  NBTTagList buildingList=new NBTTagList();
  for (  BuildingItem item : builder.getBuilders()) {
    NBTTagCompound sub=new NBTTagCompound();
    item.writeToNBT(sub);
    buildingList.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",buildingList);
}

Fixed version (ground truth):
public void saveBuildStateToNBT(NBTTagCompound nbt,IBuildingItemsProvider builder){
  nbt.setByteArray("String_Node_Str",BitSetUtils.toByteArray(usedLocations));
  NBTTagList buildingList=new NBTTagList();
  for (  BuildingItem item : builder.getBuilders()) {
    NBTTagCompound sub=new NBTTagCompound();
    item.writeToNBT(sub);
    buildingList.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",buildingList);
}
Program: 156680
Project: 156680
Buggy source:
public void createDestroyItems(BuildingSlotBlock slot){
  int hardness=(int)Math.ceil(getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY);
  for (int i=0; i < hardness; ++i) {
    slot.addStackConsumed(new ItemStack(BuildCraftCore.buildToolBlock));
  }
}

Fixed version (ground truth):
public void createDestroyItems(BuildingSlotBlock slot){
  int hardness=(int)Math.ceil((double)getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY);
  for (int i=0; i < hardness; ++i) {
    slot.addStackConsumed(new ItemStack(BuildCraftCore.buildToolBlock));
  }
}
Program: 156681
Project: 156681
Buggy source:
private Constructor<?> findConstructor() throws IllegalArgumentException {
  if (params.length == 0 && emptyConstructorMap.containsKey(clazz)) {
    return emptyConstructorMap.get(clazz);
  }
  for (  Constructor<?> c : clazz.getConstructors()) {
    Class<?>[] typesSignature=c.getParameterTypes();
    if (typesSignature.length != params.length) {
      continue;
    }
    boolean valid=true;
    for (int i=0; i < params.length; i++) {
      if (params[i] == null) {
        continue;
      }
      Class<?> paramClass=params[i].getClass();
      if (!(typesSignature[i].isAssignableFrom(paramClass) || (typesSignature[i] == int.class && paramClass == Integer.class) || (typesSignature[i] == double.class && paramClass == Double.class)|| (typesSignature[i] == boolean.class && paramClass == Boolean.class))) {
        valid=false;
        break;
      }
    }
    if (!valid) {
      continue;
    }
    if (c != null && params.length == 0) {
      emptyConstructorMap.put(clazz,c);
    }
    return c;
  }
  throw new IllegalArgumentException("String_Node_Str" + clazz);
}

Fixed version (ground truth):
private Constructor<?> findConstructor() throws IllegalArgumentException {
  if (params.length == 0 && emptyConstructorMap.containsKey(clazz)) {
    return emptyConstructorMap.get(clazz);
  }
  for (  Constructor<?> c : clazz.getConstructors()) {
    if (c == null) {
      continue;
    }
    Class<?>[] typesSignature=c.getParameterTypes();
    if (typesSignature.length != params.length) {
      continue;
    }
    boolean valid=true;
    for (int i=0; i < params.length; i++) {
      if (params[i] == null) {
        continue;
      }
      Class<?> paramClass=params[i].getClass();
      if (!(typesSignature[i].isAssignableFrom(paramClass) || (typesSignature[i] == int.class && paramClass == Integer.class) || (typesSignature[i] == double.class && paramClass == Double.class)|| (typesSignature[i] == boolean.class && paramClass == Boolean.class))) {
        valid=false;
        break;
      }
    }
    if (!valid) {
      continue;
    }
    if (params.length == 0) {
      emptyConstructorMap.put(clazz,c);
    }
    return c;
  }
  throw new IllegalArgumentException("String_Node_Str" + clazz);
}
Program: 156682
Project: 156682
Buggy source:
public ConfigManager(Configuration c){
  this.config=c;
}

Fixed version (ground truth):
public ConfigManager(Configuration c){
  config=c;
}
Program: 156683
Project: 156683
Buggy source:
public void getGUINetworkData(int id,int value){
switch (id) {
case 0:
    int iEnergy=Math.round(energy);
  iEnergy=(iEnergy & 0xffff0000) | (value & 0xffff);
energy=iEnergy;
break;
case 1:
iEnergy=Math.round(energy);
iEnergy=(iEnergy & 0xffff) | ((value & 0xffff) << 16);
energy=iEnergy;
break;
case 2:
currentOutput=value;
break;
case 3:
heat=value / 100F;
break;
}
}

Fixed version (ground truth):
public void getGUINetworkData(int id,int value){
switch (id) {
case 0:
    energy=(energy & 0xffff0000) | (value & 0xffff);
  break;
case 1:
energy=(energy & 0xffff) | ((value & 0xffff) << 16);
break;
case 2:
currentOutput=value;
break;
case 3:
heat=value / 100F;
break;
}
}
Program: 156684
Project: 156684
Buggy source:
public void sendGUINetworkData(Container container,ICrafting iCrafting){
  iCrafting.sendProgressBarUpdate(container,0,Math.round(energy) & 0xffff);
  iCrafting.sendProgressBarUpdate(container,1,(Math.round(energy) & 0xffff0000) >> 16);
  iCrafting.sendProgressBarUpdate(container,2,Math.round(currentOutput));
  iCrafting.sendProgressBarUpdate(container,3,Math.round(heat * 100));
}

Fixed version (ground truth):
public void sendGUINetworkData(Container container,ICrafting iCrafting){
  iCrafting.sendProgressBarUpdate(container,0,energy & 0xffff);
  iCrafting.sendProgressBarUpdate(container,1,(energy & 0xffff0000) >> 16);
  iCrafting.sendProgressBarUpdate(container,2,currentOutput);
  iCrafting.sendProgressBarUpdate(container,3,Math.round(heat * 100));
}
Program: 156685
Project: 156685
Buggy source:
@Override public void addRecipe(String id,FluidStack ingredient1,FluidStack ingredient2,FluidStack result,int energy,int delay){
  String name=result.getFluid().getName();
  if (ingredient1 == null || ingredient2 == null || result == null) {
    BCLog.logger.warn("String_Node_Str" + id + "String_Node_Str");
  }
  FlexibleRecipe<FluidStack> recipe=new FlexibleRecipe<FluidStack>(id,result,energy,delay,ingredient1,ingredient2);
  recipes.put(id,recipe);
  validFluids1.add(ingredient1);
  validFluids2.add(ingredient2);
}

Fixed version (ground truth):
@Override public void addRecipe(String id,FluidStack ingredient1,FluidStack ingredient2,FluidStack result,int energy,int delay){
  if (ingredient1 == null || ingredient2 == null || result == null) {
    BCLog.logger.warn("String_Node_Str" + id + "String_Node_Str");
  }
  FlexibleRecipe<FluidStack> recipe=new FlexibleRecipe<FluidStack>(id,result,energy,delay,ingredient1,ingredient2);
  recipes.put(id,recipe);
  validFluids1.add(ingredient1);
  validFluids2.add(ingredient2);
}
Program: 156686
Project: 156686
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileAbstractBuilder builder=(TileAbstractBuilder)tileentity;
  if (builder != null) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslated(x,y,z);
    GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
    if (builder.getPathLaser() != null) {
      for (      LaserData laser : builder.getPathLaser()) {
        if (laser != null) {
          GL11.glPushMatrix();
          RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e,laser,EntityLaser.LASER_TEXTURES[4]);
          GL11.glPopMatrix();
        }
      }
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    renderItems.render(tileentity,x,y,z);
  }
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileentity,double x,double y,double z,float f){
  super.renderTileEntityAt(tileentity,x,y,z,f);
  TileAbstractBuilder builder=(TileAbstractBuilder)tileentity;
  GL11.glPushMatrix();
  GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
  GL11.glEnable(GL11.GL_CULL_FACE);
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
  GL11.glTranslated(x,y,z);
  GL11.glTranslated(-tileentity.xCoord,-tileentity.yCoord,-tileentity.zCoord);
  if (builder.getPathLaser() != null) {
    for (    LaserData laser : builder.getPathLaser()) {
      if (laser != null) {
        GL11.glPushMatrix();
        RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e,laser,EntityLaser.LASER_TEXTURES[4]);
        GL11.glPopMatrix();
      }
    }
  }
  GL11.glPopAttrib();
  GL11.glPopMatrix();
  renderItems.render(tileentity,x,y,z);
}
Program: 156687
Project: 156687
Buggy source:
@Override public int fill(ForgeDirection from,FluidStack resource,boolean doFill){
  if (BuildcraftFuelRegistry.coolant.getCoolant(resource.getFluid()) != null) {
    return tankCoolant.fill(resource,doFill);
  }
 else   if (BuildcraftFuelRegistry.fuel.getFuel(resource.getFluid()) != null) {
    int filled=tankFuel.fill(resource,doFill);
    if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && tankFuel.getFluid().getFluid() != currentFuel) {
      currentFuel=BuildcraftFuelRegistry.fuel.getFuel(tankFuel.getFluid().getFluid());
    }
    return filled;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
@Override public int fill(ForgeDirection from,FluidStack resource,boolean doFill){
  if (BuildcraftFuelRegistry.coolant.getCoolant(resource.getFluid()) != null) {
    return tankCoolant.fill(resource,doFill);
  }
 else   if (BuildcraftFuelRegistry.fuel.getFuel(resource.getFluid()) != null) {
    int filled=tankFuel.fill(resource,doFill);
    if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && (currentFuel == null || tankFuel.getFluid().getFluid() != currentFuel.getFluid())) {
      currentFuel=BuildcraftFuelRegistry.fuel.getFuel(tankFuel.getFluid().getFluid());
    }
    return filled;
  }
 else {
    return 0;
  }
}
Program: 156689
Project: 156689
Buggy source:
@Override public boolean equals(Object obj){
  if (obj.getClass() != getClass()) {
    return false;
  }
  StationIndex compareId=(StationIndex)obj;
  return index.equals(compareId.index) && side == compareId.side;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj == null || obj.getClass() != getClass()) {
    return false;
  }
  StationIndex compareId=(StationIndex)obj;
  return index.equals(compareId.index) && side == compareId.side;
}
Program: 156690
Project: 156690
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  laser.iterateTexture();
  if (worldObj.isRemote) {
    return;
  }
  if (mode == IControllable.Mode.Off) {
    removeLaser();
    return;
  }
  if (canFindTable()) {
    findTable();
  }
  if (!isValidTable()) {
    removeLaser();
    return;
  }
  if (getBattery().getEnergyStored() == 0) {
    removeLaser();
    return;
  }
  laser.isVisible=true;
  if (laser != null && canUpdateLaser()) {
    updateLaser();
  }
  int localPower=getBattery().useEnergy(0,getMaxPowerSent(),false);
  laserTarget.receiveLaserEnergy(localPower);
  if (laser != null) {
    pushPower(localPower);
  }
  onPowerSent(localPower);
  sendNetworkUpdate();
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  laser.iterateTexture();
  if (worldObj.isRemote) {
    return;
  }
  if (mode == IControllable.Mode.Off) {
    removeLaser();
    return;
  }
  if (canFindTable()) {
    findTable();
  }
  if (!isValidTable()) {
    removeLaser();
    return;
  }
  if (getBattery().getEnergyStored() == 0) {
    removeLaser();
    return;
  }
  if (laser != null) {
    laser.isVisible=true;
    if (canUpdateLaser()) {
      updateLaser();
    }
  }
  int localPower=getBattery().useEnergy(0,getMaxPowerSent(),false);
  laserTarget.receiveLaserEnergy(localPower);
  if (laser != null) {
    pushPower(localPower);
  }
  onPowerSent(localPower);
  sendNetworkUpdate();
}
Program: 156691
Project: 156691
Buggy source:
public static void removePipe(Pipe<?> pipe){
  if (!isValid(pipe)) {
    return;
  }
  World world=pipe.container.getWorldObj();
  if (world == null) {
    return;
  }
  int x=pipe.container.xCoord;
  int y=pipe.container.yCoord;
  int z=pipe.container.zCoord;
  if (lastRemovedDate != world.getTotalWorldTime()) {
    lastRemovedDate=world.getTotalWorldTime();
    pipeRemoved.clear();
  }
  if (pipe != null) {
    pipeRemoved.put(new BlockIndex(x,y,z),pipe);
    updateNeighbourSignalState(pipe);
  }
  world.removeTileEntity(x,y,z);
}

Fixed version (ground truth):
public static void removePipe(Pipe<?> pipe){
  if (!isValid(pipe)) {
    return;
  }
  World world=pipe.container.getWorldObj();
  if (world == null) {
    return;
  }
  int x=pipe.container.xCoord;
  int y=pipe.container.yCoord;
  int z=pipe.container.zCoord;
  if (lastRemovedDate != world.getTotalWorldTime()) {
    lastRemovedDate=world.getTotalWorldTime();
    pipeRemoved.clear();
  }
  pipeRemoved.put(new BlockIndex(x,y,z),pipe);
  updateNeighbourSignalState(pipe);
  world.removeTileEntity(x,y,z);
}
Program: 156692
Project: 156692
Buggy source:
public void initFromPipe(Class<? extends Pipe> pipeClass){
  capacity=LIQUID_IN_PIPE;
  flowRate=fluidCapacities.get(pipeClass);
  travelDelay=MathUtils.clamp(Math.round(16 / (flowRate / 10)),1,MAX_TRAVEL_DELAY);
}

Fixed version (ground truth):
public void initFromPipe(Class<? extends Pipe> pipeClass){
  capacity=LIQUID_IN_PIPE;
  flowRate=fluidCapacities.get(pipeClass);
  travelDelay=MathUtils.clamp(Math.round(16F / (flowRate / 10)),1,MAX_TRAVEL_DELAY);
}
Program: 156693
Project: 156693
Buggy source:
public int extractFluid(IFluidHandler fluidHandler,ForgeDirection side){
  int amount=liquidToExtract > transport.getFlowRate() ? transport.getFlowRate() : liquidToExtract;
  FluidTankInfo tankInfo=transport.getTankInfo(side)[0];
  FluidStack extracted;
  if (tankInfo.fluid != null && tankInfo.fluid != null) {
    extracted=fluidHandler.drain(side.getOpposite(),new FluidStack(tankInfo.fluid,amount),false);
  }
 else {
    extracted=fluidHandler.drain(side.getOpposite(),amount,false);
  }
  int inserted=0;
  if (extracted != null) {
    inserted=transport.fill(side,extracted,true);
    if (inserted > 0) {
      fluidHandler.drain(side.getOpposite(),new FluidStack(extracted.getFluid(),inserted),true);
    }
  }
  return inserted;
}

Fixed version (ground truth):
public int extractFluid(IFluidHandler fluidHandler,ForgeDirection side){
  int amount=liquidToExtract > transport.getFlowRate() ? transport.getFlowRate() : liquidToExtract;
  FluidTankInfo tankInfo=transport.getTankInfo(side)[0];
  FluidStack extracted;
  if (tankInfo.fluid != null) {
    extracted=fluidHandler.drain(side.getOpposite(),new FluidStack(tankInfo.fluid,amount),false);
  }
 else {
    extracted=fluidHandler.drain(side.getOpposite(),amount,false);
  }
  int inserted=0;
  if (extracted != null) {
    inserted=transport.fill(side,extracted,true);
    if (inserted > 0) {
      fluidHandler.drain(side.getOpposite(),new FluidStack(extracted.getFluid(),inserted),true);
    }
  }
  return inserted;
}
Program: 156694
Project: 156694
Buggy source:
public Achievement registerAchievement(Achievement a){
  page.getAchievements().add(a.registerStat());
  return a;
}

Fixed version (ground truth):
public Achievement registerAchievement(Achievement a){
  page.getAchievements().add(a);
  return a;
}
Program: 156695
Project: 156695
Buggy source:
public AxisAlignedBB getBoundingBox(){
  return AxisAlignedBB.getBoundingBox(xMin,yMin,zMin,xMax,yMax,zMax);
}

Fixed version (ground truth):
public AxisAlignedBB getBoundingBox(){
  return new AxisAlignedBB(xMin,yMin,zMin,xMax,yMax,zMax);
}
Program: 156696
Project: 156696
Buggy source:
@Override public double distanceToSquared(BlockPos index){
  int dx=index.x - (xMin + (xMax - xMin + 1));
  int dy=index.y - (yMin + (yMax - yMin + 1));
  int dz=index.z - (zMin + (zMax - zMin + 1));
  return dx * dx + dy * dy + dz * dz;
}

Fixed version (ground truth):
@Override public double distanceToSquared(BlockPos index){
  int dx=index.getX() - (xMin + (xMax - xMin + 1));
  int dy=index.getY() - (yMin + (yMax - yMin + 1));
  int dz=index.getZ() - (zMin + (zMax - zMin + 1));
  return dx * dx + dy * dy + dz * dz;
}
Program: 156697
Project: 156697
Buggy source:
public Box extendToEncompass(BlockPos toBeContained){
  if (toBeContained.x < xMin) {
    xMin=toBeContained.x - 1;
  }
  if (toBeContained.y < yMin) {
    yMin=toBeContained.y - 1;
  }
  if (toBeContained.z < zMin) {
    zMin=toBeContained.z - 1;
  }
  if (toBeContained.x > xMax) {
    xMax=toBeContained.x + 1;
  }
  if (toBeContained.y > yMax) {
    yMax=toBeContained.y + 1;
  }
  if (toBeContained.z > zMax) {
    zMax=toBeContained.z + 1;
  }
  return this;
}

Fixed version (ground truth):
public Box extendToEncompass(BlockPos toBeContained){
  if (toBeContained.getX() < xMin) {
    xMin=toBeContained.getX() - 1;
  }
  if (toBeContained.getY() < yMin) {
    yMin=toBeContained.getY() - 1;
  }
  if (toBeContained.getZ() < zMin) {
    zMin=toBeContained.getZ() - 1;
  }
  if (toBeContained.getX() > xMax) {
    xMax=toBeContained.getX() + 1;
  }
  if (toBeContained.getY() > yMax) {
    yMax=toBeContained.getY() + 1;
  }
  if (toBeContained.getZ() > zMax) {
    zMax=toBeContained.getZ() + 1;
  }
  return this;
}
Program: 156698
Project: 156698
Buggy source:
public boolean contains(BlockPos i){
  return contains(i.x,i.y,i.z);
}

Fixed version (ground truth):
public boolean contains(BlockPos i){
  return contains(i.getX(),i.getY(),i.getZ());
}
Program: 156699
Project: 156699
Buggy source:
@Override public boolean doesSneakBypassUse(World world,int x,int y,int z,EntityPlayer player){
  return true;
}

Fixed version (ground truth):
@Override public boolean doesSneakBypassUse(World world,BlockPos pos,EntityPlayer player){
  return true;
}
Program: 156700
Project: 156700
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return false;
  }
  TileEntity tile=world.getTileEntity(x,y,z);
  if (tile instanceof IDebuggable) {
    ArrayList<String> info=new ArrayList<String>();
    ((IDebuggable)tile).getDebugInfo(info,EnumFacing.getOrientation(side),stack,player);
    for (    String s : info) {
      player.addChatComponentMessage(new ChatComponentText(s));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,BlockPos pos,EnumFacing side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return false;
  }
  TileEntity tile=world.getTileEntity(pos);
  if (tile instanceof IDebuggable) {
    ArrayList<String> info=new ArrayList<String>();
    ((IDebuggable)tile).getDebugInfo(info,side,stack,player);
    for (    String s : info) {
      player.addChatComponentMessage(new ChatComponentText(s));
    }
    return true;
  }
  return false;
}
Program: 156701
Project: 156701
Buggy source:
private boolean classMatch(Item base,Item matched){
  if (base.getClass() == Item.class) {
    return base == matched;
  }
 else   if (base.getClass() == matched.getClass()) {
    if (base instanceof ItemBlock) {
      Block baseBlock=((ItemBlock)base).field_150939_a;
      Block matchedBlock=((ItemBlock)matched).field_150939_a;
      if (baseBlock.getClass() == Block.class) {
        return baseBlock == matchedBlock;
      }
 else {
        return baseBlock.equals(matchedBlock);
      }
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean classMatch(Item base,Item matched){
  if (base.getClass() == Item.class) {
    return base == matched;
  }
 else   if (base.getClass() == matched.getClass()) {
    if (base instanceof ItemBlock) {
      Block baseBlock=((ItemBlock)base).block;
      Block matchedBlock=((ItemBlock)matched).block;
      if (baseBlock.getClass() == Block.class) {
        return baseBlock == matchedBlock;
      }
 else {
        return baseBlock.equals(matchedBlock);
      }
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}