nus-yam/ex-repair huggingface dataset:
Program: 156850
Project: 156850
Buggy source:
private void render(ItemRenderType type,ItemStack stack){
  GL11.glPushMatrix();
  GL11.glDisable(GL11.GL_LIGHTING);
  IIcon icon=ItemGate.getLogic(stack).getIconItem();
  renderItem.renderIcon(0,0,icon,16,16);
  if (type == ItemRenderType.ENTITY)   GL11.glTranslatef(0,0,-0.01f);
  icon=ItemGate.getMaterial(stack).getIconItem();
  if (icon != null)   renderItem.renderIcon(0,0,icon,16,16);
  for (  IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) {
    icon=expansion.getOverlayItem();
    if (icon != null)     renderItem.renderIcon(0,0,icon,16,16);
  }
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glPopMatrix();
}

Fixed version (ground truth):
private void render(ItemRenderType type,ItemStack stack){
  GL11.glPushMatrix();
  GL11.glDisable(GL11.GL_LIGHTING);
  GL11.glEnable(GL11.GL_ALPHA_TEST);
  IIcon icon=ItemGate.getLogic(stack).getIconItem();
  renderItem.renderIcon(0,0,icon,16,16);
  if (type == ItemRenderType.ENTITY)   GL11.glTranslatef(0,0,-0.01f);
  icon=ItemGate.getMaterial(stack).getIconItem();
  if (icon != null)   renderItem.renderIcon(0,0,icon,16,16);
  for (  IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) {
    icon=expansion.getOverlayItem();
    if (icon != null)     renderItem.renderIcon(0,0,icon,16,16);
  }
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glPopMatrix();
}
Program: 156852
Project: 156852
Buggy source:
@Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister par1IconRegister){
  blockIcon=par1IconRegister.registerIcon("String_Node_Str");
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister par1IconRegister){
  blockIcon=par1IconRegister.registerIcon("String_Node_Str");
  activeMarker=par1IconRegister.registerIcon("String_Node_Str");
}
Program: 156853
Project: 156853
Buggy source:
@Override public void delegateAIEnded(AIRobot ai){
  ItemStack itemFound=null;
  for (  ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity nearbyTile=robot.worldObj.getTileEntity(stationToDock.pipe.xCoord + dir.offsetX,stationToDock.pipe.yCoord + dir.offsetY,stationToDock.pipe.zCoord + dir.offsetZ);
    if (nearbyTile != null && nearbyTile instanceof IInventory) {
      ITransactor trans=Transactor.getTransactorFor(nearbyTile);
      itemFound=trans.remove(filter,dir.getOpposite(),true);
      if (itemFound != null) {
        break;
      }
    }
  }
  if (itemFound != null) {
    robot.setItemInUse(itemFound);
    terminate();
  }
}

Fixed version (ground truth):
@Override public void delegateAIEnded(AIRobot ai){
  if (robot.getDockingStation() != null) {
    DockingStation station=(DockingStation)robot.getDockingStation();
    ItemStack itemFound=null;
    for (    ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      TileEntity nearbyTile=robot.worldObj.getTileEntity(station.pipe.xCoord + dir.offsetX,station.pipe.yCoord + dir.offsetY,station.pipe.zCoord + dir.offsetZ);
      if (nearbyTile != null && nearbyTile instanceof IInventory) {
        ITransactor trans=Transactor.getTransactorFor(nearbyTile);
        itemFound=trans.remove(filter,dir.getOpposite(),true);
        if (itemFound != null) {
          break;
        }
      }
    }
    if (itemFound != null) {
      robot.setItemInUse(itemFound);
      terminate();
    }
  }
}
Program: 156854
Project: 156854
Buggy source:
@Override public boolean matches(DockingStation station){
  for (  ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity nearbyTile=robot.worldObj.getTileEntity(station.x() + dir.offsetX,station.y() + dir.offsetY,station.z() + dir.offsetZ);
    if (nearbyTile != null && nearbyTile instanceof IInventory) {
      ITransactor trans=Transactor.getTransactorFor(nearbyTile);
      if (trans.remove(filter,dir.getOpposite(),false) != null) {
        stationToDock=station;
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean matches(DockingStation station){
  for (  ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
    TileEntity nearbyTile=robot.worldObj.getTileEntity(station.x() + dir.offsetX,station.y() + dir.offsetY,station.z() + dir.offsetZ);
    if (nearbyTile != null && nearbyTile instanceof IInventory) {
      ITransactor trans=Transactor.getTransactorFor(nearbyTile);
      if (trans.remove(filter,dir.getOpposite(),false) != null) {
        return true;
      }
    }
  }
  return false;
}
Program: 156855
Project: 156855
Buggy source:
@RPC(RPCSide.SERVER) public void requestInitialization(RPCMessageInfo info){
  RPCHandler.rpcPlayer(info.sender,this,"String_Node_Str",itemInUse);
}

Fixed version (ground truth):
@RPC(RPCSide.SERVER) public void requestInitialization(RPCMessageInfo info){
  RPCHandler.rpcPlayer(info.sender,this,"String_Node_Str",itemInUse,itemActive);
}
Program: 156856
Project: 156856
Buggy source:
protected void init(){
}

Fixed version (ground truth):
protected void init(){
  if (worldObj.isRemote) {
    RPCHandler.rpcServer(this,"String_Node_Str");
  }
}
Program: 156857
Project: 156857
Buggy source:
public EntityRobot(World par1World){
  super(par1World);
  motionX=0;
  motionY=0;
  motionZ=0;
  ignoreFrustumCheck=true;
  laser.isVisible=false;
  entityCollisionReduction=1F;
  width=0.5F;
  height=0.5F;
}

Fixed version (ground truth):
public EntityRobot(World world){
  super(world);
  motionX=0;
  motionY=0;
  motionZ=0;
  ignoreFrustumCheck=true;
  laser.isVisible=false;
  entityCollisionReduction=1F;
  width=0.5F;
  height=0.5F;
}
Program: 156858
Project: 156858
Buggy source:
@Override public void end(){
  robot.setItemActive(false);
}

Fixed version (ground truth):
@Override public void end(){
  robot.setItemActive(false);
  robot.worldObj.destroyBlockInWorldPartially(robot.getEntityId(),woodToChop.x,woodToChop.y,woodToChop.z,-1);
}
Program: 156859
Project: 156859
Buggy source:
@Override public void aimItemAt(int x,int y,int z){
  float itemAngle1=(float)Math.atan2(z - Math.floor(posZ),x - Math.floor(posX));
  float itemAngle2=0;
  if (Math.floor(posY) < y) {
    itemAngle2=(float)-Math.PI / 4;
    if (Math.floor(posX) == x && Math.floor(posZ) == z) {
      itemAngle2-=(float)Math.PI / 4;
    }
  }
 else   if (Math.floor(posY) > y) {
    itemAngle2=(float)Math.PI / 2;
    if (Math.floor(posX) == x && Math.floor(posZ) == z) {
      itemAngle2+=(float)Math.PI / 4;
    }
  }
  updateDataServer();
}

Fixed version (ground truth):
@Override public void aimItemAt(int x,int y,int z){
  itemAngle1=(float)Math.atan2(z - Math.floor(posZ),x - Math.floor(posX));
  itemAngle2=0;
  if (Math.floor(posY) < y) {
    itemAngle2=(float)-Math.PI / 4;
    if (Math.floor(posX) == x && Math.floor(posZ) == z) {
      itemAngle2-=(float)Math.PI / 4;
    }
  }
 else   if (Math.floor(posY) > y) {
    itemAngle2=(float)Math.PI / 2;
    if (Math.floor(posX) == x && Math.floor(posZ) == z) {
      itemAngle2+=(float)Math.PI / 4;
    }
  }
  updateDataServer();
}
Program: 156860
Project: 156860
Buggy source:
public Gate(Pipe pipe,GateMaterial material,GateLogic logic){
  this.pipe=pipe;
  this.material=material;
  this.logic=logic;
}

Fixed version (ground truth):
public Gate(Pipe pipe,GateMaterial material,GateLogic logic){
  this.pipe=pipe;
  this.material=material;
  this.logic=logic;
  for (int i=0; i < actionsState.length; ++i) {
    actionsState[i]=ActionState.Deactivated;
  }
}
Program: 156862
Project: 156862
Buggy source:
@Override public void updateProgressBar(int id,int state){
  if (id == 0) {
    for (int i=0; i < 8; i++) {
      triggerState[i]=((state >> i) & 0x01) == 0x01;
    }
  }
}

Fixed version (ground truth):
@Override public void updateProgressBar(int id,int state){
  if (id == 0) {
    for (int i=0; i < 8; i++) {
      actionsState[i]=ActionState.values()[((state >> (i * 2)) & 0x03)];
    }
  }
}
Program: 156863
Project: 156863
Buggy source:
/** 
 * SERVER SIDE 
 */
private int calculateTriggerState(){
  if (pipe.gate == null) {
    return 0;
  }
  int state=0;
  for (int i=0; i < triggerState.length; i++) {
    if (pipe.gate.triggers[i] != null) {
      triggerState[i]=isNearbyTriggerActive(pipe.gate.triggers[i],pipe.gate.getTriggerParameter(i));
    }
    state|=triggerState[i] ? 0x01 << i : 0x0;
  }
  return state;
}

Fixed version (ground truth):
/** 
 * SERVER SIDE 
 */
private int calculateTriggerState(){
  if (pipe.gate == null) {
    return 0;
  }
  int state=0;
  for (int i=0; i < actionsState.length; i++) {
    actionsState[i]=getActionState(i);
    state|=(actionsState[i].ordinal() & 0x03) << i * 2;
  }
  return state;
}
Program: 156865
Project: 156865
Buggy source:
private boolean isMatchingIngredient(int gridSlot,int inputSlot){
  ItemStack inputStack=internalInventoryCrafting.tempStacks[inputSlot];
  if (inputStack == null) {
    return false;
  }
 else   if (StackHelper.isMatchingItem(craftingSlots.getStackInSlot(gridSlot),inputStack,true,false)) {
    return true;
  }
 else   if (StackHelper.isCraftingEquivalent(craftingSlots.oreIDs[gridSlot],inputStack)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean isMatchingIngredient(int gridSlot,int inputSlot){
  ItemStack inputStack=internalInventoryCrafting.tempStacks[inputSlot];
  if (inputStack == null) {
    return false;
  }
 else   if (StackHelper.isMatchingItem(craftingSlots.getStackInSlot(gridSlot),inputStack,true,false)) {
    return true;
  }
 else {
    return StackHelper.isCraftingEquivalent(craftingSlots.oreIDs[gridSlot],inputStack);
  }
}
Program: 156866
Project: 156866
Buggy source:
public void inventorySlotsToWorld(MappingRegistry registry,NBTTagCompound nbt,String nbtName){
  if (!nbt.hasKey(nbtName)) {
    return;
  }
  NBTTagList list=nbt.getTagList(nbtName,Constants.NBT.TAG_COMPOUND);
  for (int i=0; i < list.tagCount(); ++i) {
    NBTTagCompound invSlot=list.getCompoundTagAt(i);
    Item item=registry.getItemForId(invSlot.getInteger("String_Node_Str"));
    invSlot.setInteger("String_Node_Str",Item.getIdFromItem(item));
  }
}

Fixed version (ground truth):
public void inventorySlotsToWorld(MappingRegistry registry,NBTTagCompound nbt,String nbtName){
  if (!nbt.hasKey(nbtName)) {
    return;
  }
 else {
    registry.inventoryToWorld(nbt.getTagList(nbtName,Constants.NBT.TAG_COMPOUND));
  }
}
Program: 156867
Project: 156867
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  block=registry.getBlockForId(nbt.getInteger("String_Node_Str"));
  meta=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str")) {
    NBTTagList rq=nbt.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
    ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
    for (int i=0; i < rq.tagCount(); ++i) {
      try {
        NBTTagCompound sub=rq.getCompoundTagAt(i);
        if (sub.getInteger("String_Node_Str") >= 0) {
          sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
          rqs.add(ItemStack.loadItemStackFromNBT(sub));
        }
 else {
          defaultPermission=BuildingPermission.CREATIVE_ONLY;
        }
      }
 catch (      Throwable t) {
        t.printStackTrace();
        defaultPermission=BuildingPermission.CREATIVE_ONLY;
      }
    }
    storedRequirements=rqs.toArray(new ItemStack[rqs.size()]);
  }
 else {
    storedRequirements=new ItemStack[0];
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  super.readFromNBT(nbt,registry);
  block=registry.getBlockForId(nbt.getInteger("String_Node_Str"));
  meta=nbt.getInteger("String_Node_Str");
  if (nbt.hasKey("String_Node_Str")) {
    NBTTagList rq=nbt.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
    ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
    for (int i=0; i < rq.tagCount(); ++i) {
      try {
        NBTTagCompound sub=rq.getCompoundTagAt(i);
        if (sub.getInteger("String_Node_Str") >= 0) {
          registry.stackToWorld(sub);
          rqs.add(ItemStack.loadItemStackFromNBT(sub));
        }
 else {
          defaultPermission=BuildingPermission.CREATIVE_ONLY;
        }
      }
 catch (      Throwable t) {
        t.printStackTrace();
        defaultPermission=BuildingPermission.CREATIVE_ONLY;
      }
    }
    storedRequirements=rqs.toArray(new ItemStack[rqs.size()]);
  }
 else {
    storedRequirements=new ItemStack[0];
  }
}
Program: 156868
Project: 156868
Buggy source:
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  nbt.setInteger("String_Node_Str",registry.getIdForBlock(block));
  nbt.setInteger("String_Node_Str",meta);
  if (storedRequirements.length > 0) {
    NBTTagList rq=new NBTTagList();
    for (    ItemStack stack : storedRequirements) {
      NBTTagCompound sub=new NBTTagCompound();
      stack.writeToNBT(stack.writeToNBT(sub));
      sub.setInteger("String_Node_Str",registry.getIdForItem(stack.getItem()));
      rq.appendTag(sub);
    }
    nbt.setTag("String_Node_Str",rq);
  }
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  super.writeToNBT(nbt,registry);
  nbt.setInteger("String_Node_Str",registry.getIdForBlock(block));
  nbt.setInteger("String_Node_Str",meta);
  if (storedRequirements.length > 0) {
    NBTTagList rq=new NBTTagList();
    for (    ItemStack stack : storedRequirements) {
      NBTTagCompound sub=new NBTTagCompound();
      stack.writeToNBT(sub);
      registry.stackToRegistry(sub);
      rq.appendTag(sub);
    }
    nbt.setTag("String_Node_Str",rq);
  }
}
Program: 156869
Project: 156869
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  cpt=nbt.getCompoundTag("String_Node_Str");
  NBTTagList rq=nbt.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
  for (int i=0; i < rq.tagCount(); ++i) {
    try {
      NBTTagCompound sub=rq.getCompoundTagAt(i);
      if (sub.getInteger("String_Node_Str") >= 0) {
        sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
        rqs.add(ItemStack.loadItemStackFromNBT(sub));
      }
 else {
      }
    }
 catch (    Throwable t) {
      t.printStackTrace();
    }
  }
  storedRequirements=rqs.toArray(new ItemStack[rqs.size()]);
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  super.readFromNBT(nbt,registry);
  cpt=nbt.getCompoundTag("String_Node_Str");
  NBTTagList rq=nbt.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
  for (int i=0; i < rq.tagCount(); ++i) {
    try {
      NBTTagCompound sub=rq.getCompoundTagAt(i);
      if (sub.getInteger("String_Node_Str") >= 0) {
        sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
        rqs.add(ItemStack.loadItemStackFromNBT(sub));
      }
 else {
      }
    }
 catch (    Throwable t) {
      t.printStackTrace();
    }
  }
  storedRequirements=rqs.toArray(new ItemStack[rqs.size()]);
}
Program: 156870
Project: 156870
Buggy source:
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  NBTTagList nbttaglist=cpt.getTagList("String_Node_Str",6);
  nbt.setInteger("String_Node_Str",registry.getIdForEntity(entity));
  nbt.setTag("String_Node_Str",cpt);
  NBTTagList rq=new NBTTagList();
  for (  ItemStack stack : storedRequirements) {
    NBTTagCompound sub=new NBTTagCompound();
    stack.writeToNBT(stack.writeToNBT(sub));
    sub.setInteger("String_Node_Str",registry.getIdForItem(stack.getItem()));
    rq.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",rq);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  super.writeToNBT(nbt,registry);
  NBTTagList nbttaglist=cpt.getTagList("String_Node_Str",6);
  nbt.setInteger("String_Node_Str",registry.getIdForEntity(entity));
  nbt.setTag("String_Node_Str",cpt);
  NBTTagList rq=new NBTTagList();
  for (  ItemStack stack : storedRequirements) {
    NBTTagCompound sub=new NBTTagCompound();
    stack.writeToNBT(stack.writeToNBT(sub));
    sub.setInteger("String_Node_Str",registry.getIdForItem(stack.getItem()));
    rq.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",rq);
}
Program: 156871
Project: 156871
Buggy source:
/** 
 * Return the building permission for blueprint containing this schematic.
 * @return
 */
public BuildingPermission getBuildingPermission(){
  return BuildingPermission.ALL;
}

Fixed version (ground truth):
/** 
 * Return the building permission for blueprint containing this schematic.
 */
public BuildingPermission getBuildingPermission(){
  return BuildingPermission.ALL;
}
Program: 156872
Project: 156872
Buggy source:
/** 
 * @param iconIndex
 * @return
 */
@SideOnly(Side.CLIENT) IIcon getIcon(int iconIndex);

Fixed version (ground truth):
/** 
 * @param iconIndex
 */
@SideOnly(Side.CLIENT) IIcon getIcon(int iconIndex);
Program: 156873
Project: 156873
Buggy source:
/** 
 * Get the PowerReceiver for this side of the block. You can return the same PowerReceiver for all sides or one for each side. You should NOT return null to this method unless you mean to NEVER receive power from that side. Returning null, after previous returning a PowerReceiver, will most likely cause pipe connections to derp out and engines to eventually explode.
 * @param side
 * @return
 */
PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side);

Fixed version (ground truth):
/** 
 * Get the PowerReceiver for this side of the block. You can return the same PowerReceiver for all sides or one for each side. You should NOT return null to this method unless you mean to NEVER receive power from that side. Returning null, after previous returning a PowerReceiver, will most likely cause pipe connections to derp out and engines to eventually explode.
 * @param side
 */
PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side);
Program: 156874
Project: 156874
Buggy source:
/** 
 * The amount of power that this PowerHandler currently needs.
 * @return
 */
public double powerRequest(){
  update();
  return battery.getEnergyRequested();
}

Fixed version (ground truth):
/** 
 * The amount of power that this PowerHandler currently needs.
 */
public double powerRequest(){
  update();
  return battery.getEnergyRequested();
}
Program: 156875
Project: 156875
Buggy source:
/** 
 * Add an Assembly Table recipe.
 * @param input Object... containing either an ItemStack, or a paired stringand integer(ex: "dyeBlue", 1)
 * @param energy MJ cost to produce
 * @param output resulting ItemStack
 */
void addRecipe(double energyCost,ItemStack output,Object... input);

Fixed version (ground truth):
/** 
 * Add an Assembly Table recipe.
 * @param input Object... containing either an ItemStack, or a paired string and integer(ex: "dyeBlue", 1)
 * @param energyCost MJ cost to produce
 * @param output resulting ItemStack
 */
void addRecipe(double energyCost,ItemStack output,Object... input);
Program: 156876
Project: 156876
Buggy source:
/** 
 * True if the pipe is connected to the block/pipe in the specific direction
 * @param wire
 * @return true if connect
 */
boolean isPipeConnected(ForgeDirection with);

Fixed version (ground truth):
/** 
 * True if the pipe is connected to the block/pipe in the specific direction
 * @param with
 * @return true if connect
 */
boolean isPipeConnected(ForgeDirection with);
Program: 156877
Project: 156877
Buggy source:
/** 
 * Removes and returns a single item from the inventory matching the filter.
 * @param filter
 * @param orientation
 * @param doRemove
 * @return 
 */
ItemStack remove(IStackFilter filter,ForgeDirection orientation,boolean doRemove);

Fixed version (ground truth):
/** 
 * Removes and returns a single item from the inventory matching the filter.
 * @param filter
 * @param orientation
 * @param doRemove
 */
ItemStack remove(IStackFilter filter,ForgeDirection orientation,boolean doRemove);
Program: 156878
Project: 156878
Buggy source:
/** 
 * Clones both dimensions of a float[][]
 * @param source the float[][] to deepClone
 * @return
 */
public static float[][] deepClone(float[][] source){
  float[][] target=source.clone();
  for (int i=0; i < target.length; i++) {
    target[i]=source[i].clone();
  }
  return target;
}

Fixed version (ground truth):
/** 
 * Clones both dimensions of a float[][]
 * @param source the float[][] to deepClone
 */
public static float[][] deepClone(float[][] source){
  float[][] target=source.clone();
  for (int i=0; i < target.length; i++) {
    target[i]=source[i].clone();
  }
  return target;
}
Program: 156879
Project: 156879
Buggy source:
/** 
 * Should return the textureindex used by the Pipe Item Renderer, as this is done client-side the default implementation might not work if your getTextureIndex(Orienations.Unknown) has logic. Then override this
 * @return
 */
public int getIconIndexForItem(){
  return getIconIndex(ForgeDirection.UNKNOWN);
}

Fixed version (ground truth):
/** 
 * Should return the textureindex used by the Pipe Item Renderer, as this is done client-side the default implementation might not work if your getTextureIndex(Orienations.Unknown) has logic. Then override this
 */
public int getIconIndexForItem(){
  return getIconIndex(ForgeDirection.UNKNOWN);
}
Program: 156880
Project: 156880
Buggy source:
/** 
 * Retrieves pipe at specified coordinates if any.
 * @param world
 * @param x
 * @param y
 * @param z
 * @return
 */
private TileGenericPipe getPipe(World world,int x,int y,int z){
  if (!world.blockExists(x,y,z)) {
    return null;
  }
  TileEntity tile=world.getTileEntity(x,y,z);
  if (!(tile instanceof TileGenericPipe)) {
    return null;
  }
  return (TileGenericPipe)tile;
}

Fixed version (ground truth):
/** 
 * Retrieves pipe at specified coordinates if any.
 * @param world
 * @param x
 * @param y
 * @param z
 */
private TileGenericPipe getPipe(World world,int x,int y,int z){
  if (!world.blockExists(x,y,z)) {
    return null;
  }
  TileEntity tile=world.getTileEntity(x,y,z);
  if (!(tile instanceof TileGenericPipe)) {
    return null;
  }
  return (TileGenericPipe)tile;
}
Program: 156882
Project: 156882
Buggy source:
/** 
 * Generates a flatten in a given area
 */
public static void flatten(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  int lastX=Integer.MAX_VALUE, lastY=Integer.MAX_VALUE, lastZ=Integer.MAX_VALUE;
  for (int x=xMin; x <= xMax; ++x) {
    for (int z=zMin; z <= zMax; ++z) {
      for (int y=yMax; y >= yMin; --y) {
        template.contents[x][y][z]=new SchematicMask(true);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates a flatten in a given area
 */
public static void flatten(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  int lastX=Integer.MAX_VALUE, lastY=Integer.MAX_VALUE, lastZ=Integer.MAX_VALUE;
  for (int x=xMin; x <= xMax; ++x) {
    for (int z=zMin; z <= zMax; ++z) {
      for (int y=yMax; y >= yMin; --y) {
        if (isValid(x,y,z,template)) {
          template.contents[x][y][z]=new SchematicMask(true);
        }
      }
    }
  }
}
Program: 156883
Project: 156883
Buggy source:
/** 
 * Generates a filling in a given area
 */
public static void fill(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  for (int y=yMin; y <= yMax; ++y) {
    for (int x=xMin; x <= xMax; ++x) {
      for (int z=zMin; z <= zMax; ++z) {
        template.contents[x][y][z]=new SchematicMask(true);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates a filling in a given area
 */
public static void fill(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  for (int y=yMin; y <= yMax; ++y) {
    for (int x=xMin; x <= xMax; ++x) {
      for (int z=zMin; z <= zMax; ++z) {
        if (isValid(x,y,z,template)) {
          template.contents[x][y][z]=new SchematicMask(true);
        }
      }
    }
  }
}
Program: 156884
Project: 156884
Buggy source:
/** 
 * Generates an empty in a given area
 */
public static void empty(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  int lastX=Integer.MAX_VALUE, lastY=Integer.MAX_VALUE, lastZ=Integer.MAX_VALUE;
  for (int y=yMax; y >= yMin; y--) {
    for (int x=xMin; x <= xMax; ++x) {
      for (int z=zMin; z <= zMax; ++z) {
        template.contents[x][y][z]=null;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates an empty in a given area
 */
public static void empty(int xMin,int yMin,int zMin,int xMax,int yMax,int zMax,Template template){
  int lastX=Integer.MAX_VALUE, lastY=Integer.MAX_VALUE, lastZ=Integer.MAX_VALUE;
  for (int y=yMax; y >= yMin; y--) {
    for (int x=xMin; x <= xMax; ++x) {
      for (int z=zMin; z <= zMax; ++z) {
        if (isValid(x,y,z,template)) {
          template.contents[x][y][z]=null;
        }
      }
    }
  }
}
Program: 156886
Project: 156886
Buggy source:
public static boolean isSoftBlock(Block block,World world,int x,int y,int z){
  return block == null || BuildCraftAPI.softBlocks.contains(block) || block.isAir(world,x,y,z);
}

Fixed version (ground truth):
public static boolean isSoftBlock(Block block,World world,int x,int y,int z){
  return block == null || BuildCraftAPI.softBlocks.contains(block) || block.isReplaceable(world,x,y,z) || block.isAir(world,x,y,z);
}
Program: 156887
Project: 156887
Buggy source:
public void initialize(){
  if (!initialized) {
    double dx=destination.x - origin.x;
    double dy=destination.y - origin.y;
    double dz=destination.z - origin.z;
    double size=Math.sqrt(dx * dx + dy * dy + dz * dz);
    maxLifetime=size * 7.0;
    maxHeight=(5.0 + (destination.y - origin.y) / 2.0);
    double a=maxLifetime / 2.0;
    double b=maxHeight;
    double c=Math.sqrt(a * a + b * b);
    maxLifetime+=c * 2;
    vx=dx / maxLifetime;
    vy=dy / maxLifetime;
    vz=dz / maxLifetime;
    for (    ItemStack s : stacksToBuild) {
      StackAtPosition sPos=new StackAtPosition();
      sPos.stack=s;
      stacksToDisplay.add(sPos);
    }
    if (stacksToDisplay.size() == 0) {
      StackAtPosition sPos=new StackAtPosition();
      sPos.stack=new ItemStack(BuildCraftBuilders.stripesBlock);
      stacksToDisplay.add(sPos);
    }
    initialized=true;
  }
}

Fixed version (ground truth):
public void initialize(){
  if (!initialized) {
    double dx=destination.x - origin.x;
    double dy=destination.y - origin.y;
    double dz=destination.z - origin.z;
    double size=Math.sqrt(dx * dx + dy * dy + dz * dz);
    maxLifetime=size * 7.0;
    maxHeight=(5.0 + (destination.y - origin.y) / 2.0);
    double a=maxLifetime / 2.0;
    double b=maxHeight;
    double c=Math.sqrt(a * a + b * b);
    maxLifetime=c * 2;
    vx=dx / maxLifetime;
    vy=dy / maxLifetime;
    vz=dz / maxLifetime;
    for (    ItemStack s : stacksToBuild) {
      StackAtPosition sPos=new StackAtPosition();
      sPos.stack=s;
      stacksToDisplay.add(sPos);
    }
    if (stacksToDisplay.size() == 0) {
      StackAtPosition sPos=new StackAtPosition();
      sPos.stack=new ItemStack(BuildCraftBuilders.stripesBlock);
      stacksToDisplay.add(sPos);
    }
    initialized=true;
  }
}
Program: 156888
Project: 156888
Buggy source:
@Override public void addInformation(ItemStack stack,EntityPlayer player,List list,boolean advanced){
  BlueprintId blueprint=getId(stack);
  if (blueprint != null) {
    if (blueprint.name.equals("String_Node_Str")) {
      list.add(String.format(StringUtils.localize("String_Node_Str")));
    }
 else {
      list.add(String.format(blueprint.name));
    }
    list.add(String.format(StringUtils.localize("String_Node_Str") + "String_Node_Str" + NBTUtils.getItemData(stack).getString("String_Node_Str")));
  }
 else {
    list.add(StringUtils.localize("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void addInformation(ItemStack stack,EntityPlayer player,List list,boolean advanced){
  if (NBTUtils.getItemData(stack).hasKey("String_Node_Str")) {
    String name=NBTUtils.getItemData(stack).getString("String_Node_Str");
    if (name.equals("String_Node_Str")) {
      list.add(String.format(StringUtils.localize("String_Node_Str")));
    }
 else {
      list.add(String.format(name));
    }
    list.add(String.format(StringUtils.localize("String_Node_Str") + "String_Node_Str" + NBTUtils.getItemData(stack).getString("String_Node_Str")));
  }
 else {
    list.add(StringUtils.localize("String_Node_Str"));
  }
}
Program: 156889
Project: 156889
Buggy source:
@Override public IIcon getIconIndex(ItemStack stack){
  if (getId(stack) == null) {
    return cleanBlueprint;
  }
 else {
    return usedBlueprint;
  }
}

Fixed version (ground truth):
@Override public IIcon getIconIndex(ItemStack stack){
  if (!NBTUtils.getItemData(stack).hasKey("String_Node_Str")) {
    return cleanBlueprint;
  }
 else {
    return usedBlueprint;
  }
}
Program: 156890
Project: 156890
Buggy source:
@Override public IIcon getIconIndex(ItemStack stack){
  if (getId(stack) == null) {
    return itemIcon;
  }
 else {
    return usedTemplate;
  }
}

Fixed version (ground truth):
@Override public IIcon getIconIndex(ItemStack stack){
  if (!NBTUtils.getItemData(stack).hasKey("String_Node_Str")) {
    return itemIcon;
  }
 else {
    return usedTemplate;
  }
}
Program: 156891
Project: 156891
Buggy source:
@Override public ItemStack getStack(){
  ItemStack stack=new ItemStack(BuildCraftBuilders.blueprintItem,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getStack(){
  ItemStack stack=new ItemStack(BuildCraftBuilders.blueprintItem,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: 156892
Project: 156892
Buggy source:
@Override public ItemStack getStack(){
  ItemStack stack=new ItemStack(BuildCraftBuilders.templateItem,1);
  NBTTagCompound nbt=NBTUtils.getItemData(stack);
  id.write(nbt);
  nbt.setString("String_Node_Str",author);
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getStack(){
  ItemStack stack=new ItemStack(BuildCraftBuilders.templateItem,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: 156893
Project: 156893
Buggy source:
@EventHandler public void load(FMLInitializationEvent evt){
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,new GuiHandler());
  CoreProxy.proxy.registerTileEntity(TileQuarry.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileMiningWell.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileAutoWorkbench.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TilePump.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileFloodGate.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileTank.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileRefinery.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileHopper.class,"String_Node_Str");
  FactoryProxy.proxy.initializeTileEntities();
  SchematicRegistry.registerSchematicClass(autoWorkbenchBlock,SchematicAutoWorkbench.class);
  SchematicRegistry.registerSchematicClass(frameBlock,SchematicFrame.class);
  SchematicRegistry.registerSchematicClass(refineryBlock,SchematicRefinery.class);
  SchematicRegistry.registerSchematicClass(tankBlock,SchematicTank.class);
  if (BuildCraftCore.loadDefaultRecipes) {
    loadRecipes();
  }
}

Fixed version (ground truth):
@EventHandler public void load(FMLInitializationEvent evt){
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,new GuiHandler());
  CoreProxy.proxy.registerTileEntity(TileQuarry.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileMiningWell.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileAutoWorkbench.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TilePump.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileFloodGate.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileTank.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileRefinery.class,"String_Node_Str");
  CoreProxy.proxy.registerTileEntity(TileHopper.class,"String_Node_Str");
  FactoryProxy.proxy.initializeTileEntities();
  SchematicRegistry.registerSchematicClass(frameBlock,SchematicFrame.class);
  SchematicRegistry.registerSchematicClass(refineryBlock,SchematicRefinery.class);
  SchematicRegistry.registerSchematicClass(tankBlock,SchematicTank.class);
  if (BuildCraftCore.loadDefaultRecipes) {
    loadRecipes();
  }
}
Program: 156894
Project: 156894
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Schematic clone(){
  Schematic obj;
  try {
    obj=(Schematic)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    return null;
  }
  obj.storedRequirements=ArrayUtils.clone(storedRequirements);
  return obj;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Schematic clone(){
  Schematic obj;
  try {
    obj=(Schematic)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    return null;
  }
  return obj;
}
Program: 156895
Project: 156895
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  block=registry.getBlockForId(nbt.getInteger("String_Node_Str"));
  meta=nbt.getInteger("String_Node_Str");
  NBTTagList rq=nbt.getTagList("String_Node_Str",Utils.NBTTag_Types.NBTTagList.ordinal());
  storedRequirements=new ItemStack[rq.tagCount()];
  for (int i=0; i < rq.tagCount(); ++i) {
    NBTTagCompound sub=rq.getCompoundTagAt(i);
    sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
    storedRequirements[i]=ItemStack.loadItemStackFromNBT(sub);
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt,MappingRegistry registry){
  block=registry.getBlockForId(nbt.getInteger("String_Node_Str"));
  meta=nbt.getInteger("String_Node_Str");
  NBTTagList rq=nbt.getTagList("String_Node_Str",Utils.NBTTag_Types.NBTTagCompound.ordinal());
  ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
  for (int i=0; i < rq.tagCount(); ++i) {
    try {
      NBTTagCompound sub=rq.getCompoundTagAt(i);
      if (sub.getInteger("String_Node_Str") >= 0) {
        sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
        rqs.add(ItemStack.loadItemStackFromNBT(sub));
      }
 else {
      }
    }
 catch (    Throwable t) {
      t.printStackTrace();
    }
  }
  storedRequirements=rqs.toArray(new ItemStack[rqs.size()]);
}
Program: 156896
Project: 156896
Buggy source:
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  nbt.setInteger("String_Node_Str",registry.getIdForBlock(block));
  nbt.setInteger("String_Node_Str",meta);
  NBTTagList rq=new NBTTagList();
  for (  ItemStack stack : storedRequirements) {
    NBTTagCompound sub=new NBTTagCompound();
    stack.writeToNBT(stack.writeToNBT(sub));
    sub.setInteger("String_Node_Str",Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("String_Node_Str"))));
    rq.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",rq);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound nbt,MappingRegistry registry){
  nbt.setInteger("String_Node_Str",registry.getIdForBlock(block));
  nbt.setInteger("String_Node_Str",meta);
  NBTTagList rq=new NBTTagList();
  for (  ItemStack stack : storedRequirements) {
    NBTTagCompound sub=new NBTTagCompound();
    stack.writeToNBT(stack.writeToNBT(sub));
    sub.setInteger("String_Node_Str",registry.getIdForItem(stack.getItem()));
    rq.appendTag(sub);
  }
  nbt.setTag("String_Node_Str",rq);
}
Program: 156897
Project: 156897
Buggy source:
/** 
 * Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that "id" and "meta" will be set automatically, corresponding to the block id and meta. By default, if the block is a BlockContainer, tile information will be to save / load the block.
 */
@Override public void readFromWorld(IBuilderContext context,int x,int y,int z){
  super.readFromWorld(context,x,y,z);
  if (block instanceof BlockContainer) {
    TileEntity tile=context.world().getTileEntity(x,y,z);
    if (tile != null) {
      tile.writeToNBT(cpt);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that "id" and "meta" will be set automatically, corresponding to the block id and meta. By default, if the block is a BlockContainer, tile information will be to save / load the block.
 */
@Override public void readFromWorld(IBuilderContext context,int x,int y,int z){
  super.readFromWorld(context,x,y,z);
  if (block instanceof BlockContainer) {
    TileEntity tile=context.world().getTileEntity(x,y,z);
    if (tile != null) {
      tile.writeToNBT(cpt);
    }
    if (tile instanceof IInventory) {
      IInventory inv=(IInventory)tile;
      ArrayList<ItemStack> rqs=new ArrayList<ItemStack>();
      for (int i=0; i < inv.getSizeInventory(); ++i) {
        if (inv.getStackInSlot(i) != null) {
          rqs.add(inv.getStackInSlot(i));
        }
      }
      storedRequirements=Utils.concat(storedRequirements,rqs.toArray(new ItemStack[rqs.size()]));
    }
  }
}
Program: 156898
Project: 156898
Buggy source:
/** 
 * Places the block in the world, at the location specified in the slot.
 */
@Override public void writeToWorld(IBuilderContext context,int x,int y,int z){
  super.writeToWorld(context,x,y,z);
  if (block instanceof BlockContainer) {
    TileEntity tile=context.world().getTileEntity(x,y,z);
    cpt.setInteger("String_Node_Str",x);
    cpt.setInteger("String_Node_Str",y);
    cpt.setInteger("String_Node_Str",z);
    if (tile != null) {
      tile.readFromNBT(cpt);
    }
    if (tile instanceof IInventory) {
      IInventory inv=(IInventory)tile;
      for (int i=0; i < inv.getSizeInventory(); ++i) {
        inv.setInventorySlotContents(i,null);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Places the block in the world, at the location specified in the slot.
 */
@Override public void writeToWorld(IBuilderContext context,int x,int y,int z){
  super.writeToWorld(context,x,y,z);
  if (block instanceof BlockContainer) {
    TileEntity tile=context.world().getTileEntity(x,y,z);
    cpt.setInteger("String_Node_Str",x);
    cpt.setInteger("String_Node_Str",y);
    cpt.setInteger("String_Node_Str",z);
    if (tile != null) {
      tile.readFromNBT(cpt);
    }
  }
}
Program: 156899
Project: 156899
Buggy source:
public BptBuilderBase instanciateBluePrint(int x,int y,int z,ForgeDirection o){
  BlueprintBase bpt=null;
  try {
    bpt=ItemBlueprint.loadBlueprint(items[0]);
  }
 catch (  Throwable t) {
    setInventorySlotContents(0,null);
    return null;
  }
  if (bpt == null) {
    return null;
  }
  bpt=bpt.clone();
  BptContext context=bpt.getContext(worldObj,bpt.getBoxForPos(x,y,z));
  if (o == ForgeDirection.EAST) {
  }
 else   if (o == ForgeDirection.SOUTH) {
    bpt.rotateLeft(context);
  }
 else   if (o == ForgeDirection.WEST) {
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
  }
 else   if (o == ForgeDirection.NORTH) {
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
  }
  BptBuilderBase result=null;
  if (items[0].getItem() instanceof ItemBlueprintStandard) {
    result=new BptBuilderBlueprint((Blueprint)bpt,worldObj,x,y,z);
  }
 else   if (items[0].getItem() instanceof ItemBlueprintTemplate) {
    return new BptBuilderTemplate(bpt,worldObj,x,y,z);
  }
 else {
    result=null;
  }
  return result;
}

Fixed version (ground truth):
public BptBuilderBase instanciateBluePrint(int x,int y,int z,ForgeDirection o){
  BlueprintBase bpt=null;
  try {
    bpt=ItemBlueprint.loadBlueprint(items[0]);
  }
 catch (  Throwable t) {
    setInventorySlotContents(0,null);
    t.printStackTrace();
    return null;
  }
  if (bpt == null) {
    return null;
  }
  bpt=bpt.clone();
  BptContext context=bpt.getContext(worldObj,bpt.getBoxForPos(x,y,z));
  if (o == ForgeDirection.EAST) {
  }
 else   if (o == ForgeDirection.SOUTH) {
    bpt.rotateLeft(context);
  }
 else   if (o == ForgeDirection.WEST) {
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
  }
 else   if (o == ForgeDirection.NORTH) {
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
    bpt.rotateLeft(context);
  }
  BptBuilderBase result=null;
  if (items[0].getItem() instanceof ItemBlueprintStandard) {
    result=new BptBuilderBlueprint((Blueprint)bpt,worldObj,x,y,z);
  }
 else   if (items[0].getItem() instanceof ItemBlueprintTemplate) {
    return new BptBuilderTemplate(bpt,worldObj,x,y,z);
  }
 else {
    result=null;
  }
  return result;
}
Program: 156900
Project: 156900
Buggy source:
@SideOnly(Side.CLIENT) @Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public ItemStack getPickBlock(MovingObjectPosition target,World world,int x,int y,int z){
  RaytraceResult rayTraceResult=doRayTrace(world,x,y,z,Minecraft.getMinecraft().thePlayer);
  if (rayTraceResult != null && rayTraceResult.boundingBox != null) {
switch (rayTraceResult.hitPart) {
case Gate:
      Pipe pipe=getPipe(world,x,y,z);
    return pipe.gate.getGateItem();
case Plug:
  return new ItemStack(BuildCraftTransport.plugItem);
case Pipe:
return new ItemStack(getPipe(world,x,y,z).item);
case Facade:
ForgeDirection dir=ForgeDirection.getOrientation(target.sideHit);
FacadeMatrix matrix=getPipe(world,x,y,z).container.renderState.facadeMatrix;
Block block=matrix.getFacadeBlock(dir);
if (block != null) {
return ItemFacade.getStack(block,matrix.getFacadeMetaId(dir));
}
}
}
return null;
}
Program: 156901
Project: 156901
Buggy source:
public PathIterator(BlockIndex from,Iterator<BlockIndex> it){
  this.to=it.next();
  currentIterator=it;
  double dx=to.x - from.z;
  double dy=to.y - from.y;
  double dz=to.z - from.z;
  double size=Math.sqrt(dx * dx + dy * dy + dz * dz);
  cx=dx / size / 10;
  cy=dy / size / 10;
  cz=dz / size / 10;
  ix=from.x;
  iy=from.y;
  iz=from.z;
  lastDistance=(ix - to.x) * (ix - to.x) + (iy - to.y) * (iy - to.y) + (iz - to.z) * (iz - to.z);
  if (Math.abs(dx) > Math.abs(dz)) {
    if (dx > 0) {
      o=ForgeDirection.EAST;
    }
 else {
      o=ForgeDirection.WEST;
    }
  }
 else {
    if (dz > 0) {
      o=ForgeDirection.SOUTH;
    }
 else {
      o=ForgeDirection.NORTH;
    }
  }
}

Fixed version (ground truth):
public PathIterator(BlockIndex from,Iterator<BlockIndex> it){
  this.to=it.next();
  currentIterator=it;
  double dx=to.x - from.x;
  double dy=to.y - from.y;
  double dz=to.z - from.z;
  double size=Math.sqrt(dx * dx + dy * dy + dz * dz);
  cx=dx / size / 10;
  cy=dy / size / 10;
  cz=dz / size / 10;
  ix=from.x;
  iy=from.y;
  iz=from.z;
  lastDistance=(ix - to.x) * (ix - to.x) + (iy - to.y) * (iy - to.y) + (iz - to.z) * (iz - to.z);
  if (Math.abs(dx) > Math.abs(dz)) {
    if (dx > 0) {
      o=ForgeDirection.EAST;
    }
 else {
      o=ForgeDirection.WEST;
    }
  }
 else {
    if (dz > 0) {
      o=ForgeDirection.SOUTH;
    }
 else {
      o=ForgeDirection.NORTH;
    }
  }
}
Program: 156902
Project: 156902
Buggy source:
public void createBpt(){
  ForgeDirection o=ForgeDirection.values()[worldObj.getBlockMetadata(xCoord,yCoord,zCoord)].getOpposite();
  if (o == ForgeDirection.EAST) {
  }
 else   if (o == ForgeDirection.SOUTH) {
    writingBlueprint.rotateLeft(writingContext);
    writingBlueprint.rotateLeft(writingContext);
    writingBlueprint.rotateLeft(writingContext);
  }
 else   if (o == ForgeDirection.WEST) {
    writingBlueprint.rotateLeft(writingContext);
    writingBlueprint.rotateLeft(writingContext);
  }
 else   if (o == ForgeDirection.NORTH) {
    writingBlueprint.rotateLeft(writingContext);
  }
  BuildCraftBuilders.serverDB.add(writingBlueprint);
  setInventorySlotContents(1,ItemBlueprint.getBlueprintItem(writingBlueprint));
  setInventorySlotContents(0,null);
  writingBlueprint=null;
  writingContext=null;
  blockScanner=null;
}

Fixed version (ground truth):
public void createBpt(){
  BuildCraftBuilders.serverDB.add(writingBlueprint);
  setInventorySlotContents(1,ItemBlueprint.getBlueprintItem(writingBlueprint));
  setInventorySlotContents(0,null);
  writingBlueprint=null;
  writingContext=null;
  blockScanner=null;
}
Program: 156903
Project: 156903
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (!worldObj.isRemote && blockScanner != null) {
    if (blockScanner.blocksLeft() != 0) {
      for (      BlockIndex index : blockScanner) {
        writingBlueprint.readFromWorld(writingContext,this,index.x,index.y,index.z);
      }
      computingTime=(int)((1 - (float)blockScanner.blocksLeft() / (float)blockScanner.totalBlocks()) * 100);
    }
 else {
      createBpt();
      computingTime=0;
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!worldObj.isRemote && blockScanner != null) {
    if (blockScanner.blocksLeft() != 0) {
      for (      BlockIndex index : blockScanner) {
        writingBlueprint.readFromWorld(writingContext,this,index.x,index.y,index.z);
      }
      computingTime=(int)((1 - (float)blockScanner.blocksLeft() / (float)blockScanner.totalBlocks()) * 100);
      if (blockScanner.blocksLeft() == 0) {
        ForgeDirection o=ForgeDirection.values()[worldObj.getBlockMetadata(xCoord,yCoord,zCoord)].getOpposite();
        if (o == ForgeDirection.EAST) {
        }
 else         if (o == ForgeDirection.SOUTH) {
          writingBlueprint.rotateLeft(writingContext);
          writingBlueprint.rotateLeft(writingContext);
          writingBlueprint.rotateLeft(writingContext);
        }
 else         if (o == ForgeDirection.WEST) {
          writingBlueprint.rotateLeft(writingContext);
          writingBlueprint.rotateLeft(writingContext);
        }
 else         if (o == ForgeDirection.NORTH) {
          writingBlueprint.rotateLeft(writingContext);
        }
      }
    }
 else     if (writingBlueprint.getData() != null) {
      createBpt();
      computingTime=0;
    }
  }
}
Program: 156904
Project: 156904
Buggy source:
private BlueprintBase load(final BlueprintId id){
  File blueprintFile=new File(blueprintFolder,String.format(Locale.ENGLISH,"String_Node_Str" + fileExt,id.toString()));
  if (blueprintFile.exists()) {
    try {
      NBTTagCompound nbt=CompressedStreamTools.readCompressed(new FileInputStream(blueprintFile));
      BlueprintBase blueprint=BlueprintBase.loadBluePrint(nbt);
      blueprint.id=id;
      loadedBlueprints.put(id,blueprint);
      return blueprint;
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return null;
}

Fixed version (ground truth):
private BlueprintBase load(final BlueprintId id){
  File blueprintFile=new File(blueprintFolder,String.format(Locale.ENGLISH,"String_Node_Str" + fileExt,id.toString()));
  if (blueprintFile.exists()) {
    try {
      FileInputStream f=new FileInputStream(blueprintFile);
      byte[] data=new byte[(int)blueprintFile.length()];
      f.read(data);
      f.close();
      NBTTagCompound nbt=CompressedStreamTools.decompress(data);
      BlueprintBase blueprint=BlueprintBase.loadBluePrint(nbt);
      blueprint.id=id;
      loadedBlueprints.put(id,blueprint);
      return blueprint;
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return null;
}