nus-yam/ex-repair huggingface dataset:
Program: 166141
Project: 166141
Buggy source:
private void performTeleport(){
  if (!TeleportDestinations.getDestinations(worldObj).isDestinationValid(teleportDestination)) {
    applyBadEffectIfNeeded(10);
    RFTools.warn(teleportingPlayer,"String_Node_Str");
    clearTeleport(200);
    return;
  }
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension());
  }
  Coordinate c=teleportDestination.getCoordinate();
  RFTools.message(teleportingPlayer,"String_Node_Str");
  teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}

Fixed version (ground truth):
private void performTeleport(){
  if (!isDestinationStillValid()) {
    applyBadEffectIfNeeded(10);
    RFTools.warn(teleportingPlayer,"String_Node_Str");
    clearTeleport(200);
    return;
  }
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension());
  }
  Coordinate c=teleportDestination.getCoordinate();
  RFTools.message(teleportingPlayer,"String_Node_Str");
  teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}
Program: 166143
Project: 166143
Buggy source:
private void applyCamoToShield(){
  sendServerCommand(ShieldTileEntity.CMD_APPLYCAMO);
}

Fixed version (ground truth):
private void applyCamoToShield(){
  ItemStack stack=tileEntity.getStackInSlot(0);
  int pass=0;
  if (stack != null) {
    Block block=Block.getBlockFromItem(stack.getItem());
    if (block != null) {
      pass=block.getRenderBlockPass();
    }
  }
  sendServerCommand(ShieldTileEntity.CMD_APPLYCAMO,new Argument("String_Node_Str",pass));
}
Program: 166144
Project: 166144
Buggy source:
private Block calculateShieldBlock(){
  if (!shieldActive || powerTimeout > 0) {
    return Blocks.air;
  }
  if (ShieldRenderingMode.MODE_INVISIBLE.equals(shieldRenderingMode)) {
    return ModBlocks.invisibleShieldBlock;
  }
  if (ShieldRenderingMode.MODE_SHIELD.equals(shieldRenderingMode)) {
    return ModBlocks.shieldBlockNOpaquePass1;
  }
  Block camoBlock=calculateCamoBlock();
  if (camoBlock != null) {
    if (camoBlock.isOpaqueCube()) {
      if (camoBlock.getRenderBlockPass() == 1) {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockOpaquePass1;
        }
 else {
          return ModBlocks.shieldBlockOpaquePass1NN;
        }
      }
 else {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockOpaquePass0;
        }
 else {
          return ModBlocks.shieldBlockOpaquePass0NN;
        }
      }
    }
 else {
      if (camoBlock.getRenderBlockPass() == 1) {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockNOpaquePass1;
        }
 else {
          return ModBlocks.shieldBlockNOpaquePass1NN;
        }
      }
 else {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockNOpaquePass0;
        }
 else {
          return ModBlocks.shieldBlockNOpaquePass0NN;
        }
      }
    }
  }
  return ModBlocks.solidShieldBlock;
}

Fixed version (ground truth):
private Block calculateShieldBlock(){
  if (!shieldActive || powerTimeout > 0) {
    return Blocks.air;
  }
  if (ShieldRenderingMode.MODE_INVISIBLE.equals(shieldRenderingMode)) {
    return ModBlocks.invisibleShieldBlock;
  }
  if (ShieldRenderingMode.MODE_SHIELD.equals(shieldRenderingMode)) {
    return ModBlocks.shieldBlockNOpaquePass1;
  }
  Block camoBlock=calculateCamoBlock();
  if (camoBlock != null) {
    if (camoBlock.isOpaqueCube()) {
      if (camoRenderPass == 1) {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockOpaquePass1;
        }
 else {
          return ModBlocks.shieldBlockOpaquePass1NN;
        }
      }
 else {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockOpaquePass0;
        }
 else {
          return ModBlocks.shieldBlockOpaquePass0NN;
        }
      }
    }
 else {
      if (camoRenderPass == 1) {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockNOpaquePass1;
        }
 else {
          return ModBlocks.shieldBlockNOpaquePass1NN;
        }
      }
 else {
        if (camoBlock.renderAsNormalBlock()) {
          return ModBlocks.shieldBlockNOpaquePass0;
        }
 else {
          return ModBlocks.shieldBlockNOpaquePass0NN;
        }
      }
    }
  }
  return ModBlocks.solidShieldBlock;
}
Program: 166145
Project: 166145
Buggy source:
@Override public void readRestorableFromNBT(NBTTagCompound tagCompound){
  super.readRestorableFromNBT(tagCompound);
  readBufferFromNBT(tagCompound);
  int m=tagCompound.getInteger("String_Node_Str");
  shieldRenderingMode=ShieldRenderingMode.values()[m];
  m=tagCompound.getInteger("String_Node_Str");
  redstoneMode=RedstoneMode.values()[m];
  readFiltersFromNBT(tagCompound);
}

Fixed version (ground truth):
@Override public void readRestorableFromNBT(NBTTagCompound tagCompound){
  super.readRestorableFromNBT(tagCompound);
  readBufferFromNBT(tagCompound);
  int m=tagCompound.getInteger("String_Node_Str");
  shieldRenderingMode=ShieldRenderingMode.values()[m];
  m=tagCompound.getInteger("String_Node_Str");
  redstoneMode=RedstoneMode.values()[m];
  camoRenderPass=tagCompound.getInteger("String_Node_Str");
  readFiltersFromNBT(tagCompound);
}
Program: 166146
Project: 166146
Buggy source:
@Override public void writeRestorableToNBT(NBTTagCompound tagCompound){
  super.writeRestorableToNBT(tagCompound);
  writeBufferToNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",shieldRenderingMode.ordinal());
  tagCompound.setByte("String_Node_Str",(byte)redstoneMode.ordinal());
  writeFiltersToNBT(tagCompound);
}

Fixed version (ground truth):
@Override public void writeRestorableToNBT(NBTTagCompound tagCompound){
  super.writeRestorableToNBT(tagCompound);
  writeBufferToNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",shieldRenderingMode.ordinal());
  tagCompound.setByte("String_Node_Str",(byte)redstoneMode.ordinal());
  tagCompound.setInteger("String_Node_Str",camoRenderPass);
  writeFiltersToNBT(tagCompound);
}
Program: 166147
Project: 166147
Buggy source:
private void enableButtons(){
  int sel=filterList.getSelected();
  int cnt=filterList.getMaximum();
  delFilter.setEnabled(sel != -1);
  upFilter.setEnabled(sel > 0);
  downFilter.setEnabled(sel < cnt - 1 && sel != -1);
  if (sel == -1) {
    addFilter.setText("String_Node_Str");
  }
 else {
    addFilter.setText("String_Node_Str");
  }
  player.setEnabled("String_Node_Str".equals(typeOptions.getCurrentChoice()));
}

Fixed version (ground truth):
private void enableButtons(){
  int sel=filterList.getSelected();
  int cnt=filterList.getMaximum();
  delFilter.setEnabled(sel != -1 && cnt > 0);
  upFilter.setEnabled(sel > 0 && cnt > 0);
  downFilter.setEnabled(sel < cnt - 1 && sel != -1 && cnt > 0);
  if (sel == -1) {
    addFilter.setText("String_Node_Str");
  }
 else {
    addFilter.setText("String_Node_Str");
  }
  player.setEnabled("String_Node_Str".equals(typeOptions.getCurrentChoice()));
}
Program: 166148
Project: 166148
Buggy source:
public void removeMonitor(Coordinate c){
  monitors.remove(c);
}

Fixed version (ground truth):
public void removeMonitor(Coordinate c){
  monitors.remove(c);
  markDirty();
}
Program: 166149
Project: 166149
Buggy source:
public void addMonitor(Coordinate c){
  monitors.add(c);
}

Fixed version (ground truth):
public void addMonitor(Coordinate c){
  monitors.add(c);
  markDirty();
}
Program: 166150
Project: 166150
Buggy source:
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  boolean cleanup=false;
  for (  Coordinate c : monitors) {
    TileEntity te=worldObj.getTileEntity(c.getX(),c.getY(),c.getZ());
    if (te instanceof EnderMonitorTileEntity) {
      EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
      enderMonitorTileEntity.fireFromEndergenic(mode);
    }
 else {
      cleanup=true;
    }
  }
  if (cleanup) {
    List<Coordinate> newMonitors=new ArrayList<Coordinate>();
    for (    Coordinate c : monitors) {
      TileEntity te=worldObj.getTileEntity(c.getX(),c.getY(),c.getZ());
      if (te instanceof EnderMonitorTileEntity) {
        newMonitors.add(c);
      }
    }
    monitors=newMonitors;
  }
}

Fixed version (ground truth):
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  boolean cleanup=false;
  for (  Coordinate c : monitors) {
    TileEntity te=worldObj.getTileEntity(c.getX(),c.getY(),c.getZ());
    if (te instanceof EnderMonitorTileEntity) {
      EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
      enderMonitorTileEntity.fireFromEndergenic(mode);
    }
 else {
      cleanup=true;
    }
  }
  if (cleanup) {
    List<Coordinate> newMonitors=new ArrayList<Coordinate>();
    for (    Coordinate c : monitors) {
      TileEntity te=worldObj.getTileEntity(c.getX(),c.getY(),c.getZ());
      if (te instanceof EnderMonitorTileEntity) {
        newMonitors.add(c);
      }
    }
    monitors=newMonitors;
    markDirty();
  }
}
Program: 166151
Project: 166151
Buggy source:
private void extractDimlets(){
  ItemStack realizedTab=inventoryHelper.getStacks()[DimensionEnscriberContainer.SLOT_TAB];
  NBTTagCompound tagCompound=realizedTab.getTagCompound();
  if (tagCompound != null) {
    int idx=DimensionEnscriberContainer.SLOT_DIMLETS;
    for (    DimletType type : DimletType.values()) {
      if (tagCompound.hasKey(type.getName())) {
        NBTTagIntArray tagIntArray=(NBTTagIntArray)tagCompound.getTag(type.getName());
        if (tagIntArray != null) {
          int[] dimlets=tagIntArray.func_150302_c();
          for (          int id : dimlets) {
            inventoryHelper.getStacks()[idx++]=new ItemStack(ModItems.knownDimlet,1,id);
          }
        }
      }
    }
  }
  inventoryHelper.getStacks()[DimensionEnscriberContainer.SLOT_TAB]=new ItemStack(ModItems.emptyDimensionTab);
  markDirty();
}

Fixed version (ground truth):
private void extractDimlets(){
  ItemStack realizedTab=inventoryHelper.getStacks()[DimensionEnscriberContainer.SLOT_TAB];
  NBTTagCompound tagCompound=realizedTab.getTagCompound();
  if (tagCompound != null) {
    int idx=DimensionEnscriberContainer.SLOT_DIMLETS;
    String descriptionString=tagCompound.getString("String_Node_Str");
    String[] opcodes=descriptionString.split("String_Node_Str");
    for (    String oc : opcodes) {
      Integer id=Integer.parseInt(oc.substring(1));
      inventoryHelper.getStacks()[idx++]=new ItemStack(ModItems.knownDimlet,1,id);
    }
  }
  inventoryHelper.getStacks()[DimensionEnscriberContainer.SLOT_TAB]=new ItemStack(ModItems.emptyDimensionTab);
  markDirty();
}
Program: 166152
Project: 166152
Buggy source:
public Collection<TeleportDestinationClientInfo> getValidDestinations(){
  List<TeleportDestinationClientInfo> result=new ArrayList<TeleportDestinationClientInfo>();
  for (  TeleportDestination destination : destinations.values()) {
    TeleportDestinationClientInfo destinationClientInfo=new TeleportDestinationClientInfo(destination);
    String dimName=DimensionManager.getProvider(destination.getDimension()).getDimensionName();
    destinationClientInfo.setDimensionName(dimName);
    result.add(destinationClientInfo);
  }
  return result;
}

Fixed version (ground truth):
public Collection<TeleportDestinationClientInfo> getValidDestinations(){
  List<TeleportDestinationClientInfo> result=new ArrayList<TeleportDestinationClientInfo>();
  for (  TeleportDestination destination : destinations.values()) {
    TeleportDestinationClientInfo destinationClientInfo=new TeleportDestinationClientInfo(destination);
    World world=DimensionManager.getWorld(destination.getDimension());
    if (world != null) {
      String dimName=DimensionManager.getProvider(destination.getDimension()).getDimensionName();
      destinationClientInfo.setDimensionName(dimName);
      result.add(destinationClientInfo);
    }
  }
  return result;
}
Program: 166153
Project: 166153
Buggy source:
public List<TeleportDestination> searchReceivers(){
  TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
  return new ArrayList<TeleportDestination>(destinations.getValidDestinations());
}

Fixed version (ground truth):
public List<TeleportDestinationClientInfo> searchReceivers(){
  TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
  return new ArrayList<TeleportDestinationClientInfo>(destinations.getValidDestinations());
}
Program: 166154
Project: 166154
Buggy source:
@Override public void select(Widget parent,int index){
  clearSelectedStatus();
}

Fixed version (ground truth):
@Override public void select(Widget parent,int index){
  clearSelectedStatus();
  selectReceiverFromTransmitter();
}
Program: 166155
Project: 166155
Buggy source:
private void populateReceivers(){
  List<TeleportDestination> newReceivers=fromServer_receivers;
  if (newReceivers == null) {
    return;
  }
  if (newReceivers.equals(receivers)) {
    return;
  }
  receivers=new ArrayList<TeleportDestination>(newReceivers);
  receiverList.removeChildren();
  for (  TeleportDestination destination : receivers) {
    Coordinate coordinate=destination.getCoordinate();
    String dimName=DimensionManager.getProvider(destination.getDimension()).getDimensionName();
    Panel panel=new Panel(mc,this).setLayout(new HorizontalLayout());
    panel.addChild(new Label(mc,this).setText(destination.getName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(65));
    panel.addChild(new Label(mc,this).setDynamic(true).setText(coordinate.toString()));
    panel.addChild(new Label(mc,this).setText(dimName).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(55));
    receiverList.addChild(panel);
  }
}

Fixed version (ground truth):
private void populateReceivers(){
  List<TeleportDestinationClientInfo> newReceivers=fromServer_receivers;
  if (newReceivers == null) {
    return;
  }
  if (newReceivers.equals(receivers)) {
    return;
  }
  receivers=new ArrayList<TeleportDestinationClientInfo>(newReceivers);
  receiverList.removeChildren();
  for (  TeleportDestinationClientInfo destination : receivers) {
    Coordinate coordinate=destination.getCoordinate();
    String dimName=destination.getDimensionName();
    Panel panel=new Panel(mc,this).setLayout(new HorizontalLayout());
    panel.addChild(new Label(mc,this).setText(destination.getName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(65));
    panel.addChild(new Label(mc,this).setDynamic(true).setText(coordinate.toString()));
    panel.addChild(new Label(mc,this).setText(dimName).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(55));
    receiverList.addChild(panel);
  }
}
Program: 166157
Project: 166157
Buggy source:
@Override public void doubleClick(Widget parent,int index){
  hilightSelectedReceiver(index);
}

Fixed version (ground truth):
@Override public void doubleClick(Widget parent,int index){
  hilightSelectedTransmitter(index);
}
Program: 166158
Project: 166158
Buggy source:
@Override protected PacketReceiversReady createMessageToClient(int x,int y,int z,List<TeleportDestination> result){
  return new PacketReceiversReady(x,y,z,DialingDeviceTileEntity.CLIENTCMD_GETRECEIVERS,result);
}

Fixed version (ground truth):
@Override protected PacketReceiversReady createMessageToClient(int x,int y,int z,List<TeleportDestinationClientInfo> result){
  return new PacketReceiversReady(x,y,z,DialingDeviceTileEntity.CLIENTCMD_GETRECEIVERS,result);
}
Program: 166159
Project: 166159
Buggy source:
public PacketReceiversReady(int x,int y,int z,String command,List<TeleportDestination> list){
  super(x,y,z,command,list);
}

Fixed version (ground truth):
public PacketReceiversReady(int x,int y,int z,String command,List<TeleportDestinationClientInfo> list){
  super(x,y,z,command,list);
}
Program: 166160
Project: 166160
Buggy source:
@Override protected TeleportDestination createItem(ByteBuf buf){
  return new TeleportDestination(buf);
}

Fixed version (ground truth):
@Override protected TeleportDestinationClientInfo createItem(ByteBuf buf){
  return new TeleportDestinationClientInfo(buf);
}
Program: 166161
Project: 166161
Buggy source:
public Collection<TeleportDestination> getValidDestinations(){
  return destinations.values();
}

Fixed version (ground truth):
public Collection<TeleportDestinationClientInfo> getValidDestinations(){
  List<TeleportDestinationClientInfo> result=new ArrayList<TeleportDestinationClientInfo>();
  for (  TeleportDestination destination : destinations.values()) {
    TeleportDestinationClientInfo destinationClientInfo=new TeleportDestinationClientInfo(destination);
    String dimName=DimensionManager.getProvider(destination.getDimension()).getDimensionName();
    destinationClientInfo.setDimensionName(dimName);
    result.add(destinationClientInfo);
  }
  return result;
}
Program: 166162
Project: 166162
Buggy source:
private void populateList(){
  if (serverDestinationList == null) {
    return;
  }
  if (serverDestinationList.equals(destinationList)) {
    return;
  }
  destinationList=new ArrayList<TeleportDestination>(serverDestinationList);
  list.removeChildren();
  for (  TeleportDestination destination : destinationList) {
    Coordinate coordinate=destination.getCoordinate();
    Panel panel=new Panel(mc,this).setLayout(new HorizontalLayout());
    panel.addChild(new Label(mc,this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(destination.getName()).setDesiredWidth(100));
    panel.addChild(new Label(mc,this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(coordinate.toString()).setDesiredWidth(75));
    list.addChild(panel);
  }
}

Fixed version (ground truth):
private void populateList(){
  if (serverDestinationList == null) {
    return;
  }
  if (serverDestinationList.equals(destinationList)) {
    return;
  }
  destinationList=new ArrayList<TeleportDestinationClientInfo>(serverDestinationList);
  list.removeChildren();
  for (  TeleportDestinationClientInfo destination : destinationList) {
    Coordinate coordinate=destination.getCoordinate();
    Panel panel=new Panel(mc,this).setLayout(new HorizontalLayout());
    panel.addChild(new Label(mc,this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(destination.getName()).setDesiredWidth(100));
    panel.addChild(new Label(mc,this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(coordinate.toString()).setDesiredWidth(75));
    list.addChild(panel);
  }
}
Program: 166163
Project: 166163
Buggy source:
private void teleport(int index){
  TeleportDestination destination=destinationList.get(index);
  Coordinate c=destination.getCoordinate();
  PacketHandler.INSTANCE.sendToServer(new PacketForceTeleport(c.getX(),c.getY(),c.getZ(),destination.getDimension()));
}

Fixed version (ground truth):
private void teleport(int index){
  TeleportDestinationClientInfo destination=destinationList.get(index);
  Coordinate c=destination.getCoordinate();
  PacketHandler.INSTANCE.sendToServer(new PacketForceTeleport(c.getX(),c.getY(),c.getZ(),destination.getDimension()));
}
Program: 166164
Project: 166164
Buggy source:
public static void setReceivers(List<TeleportDestination> destinationList){
  serverDestinationList=new ArrayList<TeleportDestination>(destinationList);
}

Fixed version (ground truth):
public static void setReceivers(List<TeleportDestinationClientInfo> destinationList){
  serverDestinationList=new ArrayList<TeleportDestinationClientInfo>(destinationList);
}
Program: 166165
Project: 166165
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  destinationList=new ArrayList<TeleportDestination>(size);
  for (int i=0; i < size; i++) {
    destinationList.add(new TeleportDestination(buf));
  }
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  destinationList=new ArrayList<TeleportDestinationClientInfo>(size);
  for (int i=0; i < size; i++) {
    destinationList.add(new TeleportDestinationClientInfo(buf));
  }
}
Program: 166166
Project: 166166
Buggy source:
public PacketAllReceiversReady(List<TeleportDestination> destinationList){
  this.destinationList=new ArrayList<TeleportDestination>();
  this.destinationList.addAll(destinationList);
}

Fixed version (ground truth):
public PacketAllReceiversReady(List<TeleportDestinationClientInfo> destinationList){
  this.destinationList=new ArrayList<TeleportDestinationClientInfo>();
  this.destinationList.addAll(destinationList);
}
Program: 166167
Project: 166167
Buggy source:
@Override public PacketAllReceiversReady onMessage(PacketGetAllReceivers message,MessageContext ctx){
  EntityPlayer player=ctx.getServerHandler().playerEntity;
  TeleportDestinations destinations=TeleportDestinations.getDestinations(player.worldObj);
  List<TeleportDestination> destinationList=new ArrayList<TeleportDestination>(destinations.getValidDestinations());
  return new PacketAllReceiversReady(destinationList);
}

Fixed version (ground truth):
@Override public PacketAllReceiversReady onMessage(PacketGetAllReceivers message,MessageContext ctx){
  EntityPlayer player=ctx.getServerHandler().playerEntity;
  TeleportDestinations destinations=TeleportDestinations.getDestinations(player.worldObj);
  List<TeleportDestinationClientInfo> destinationList=new ArrayList<TeleportDestinationClientInfo>(destinations.getValidDestinations());
  return new PacketAllReceiversReady(destinationList);
}
Program: 166168
Project: 166168
Buggy source:
private void performTeleport(){
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension());
  }
  Coordinate c=teleportDestination.getCoordinate();
  RFTools.message(teleportingPlayer,"String_Node_Str");
  teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}

Fixed version (ground truth):
private void performTeleport(){
  if (!TeleportDestinations.getDestinations(worldObj).isDestinationValid(teleportDestination)) {
    applyBadEffectIfNeeded(10);
    RFTools.warn(teleportingPlayer,"String_Node_Str");
    clearTeleport(200);
    return;
  }
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension());
  }
  Coordinate c=teleportDestination.getCoordinate();
  RFTools.message(teleportingPlayer,"String_Node_Str");
  teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}
Program: 166169
Project: 166169
Buggy source:
private boolean makeBeam(Coordinate c,World world,int dy1,int dy2,int errory){
  for (int dy=dy1; dy <= dy2; dy++) {
    Block b=world.getBlock(c.getX(),c.getY() + dy,c.getZ());
    if ((!b.isAir(world,xCoord,yCoord + dy,zCoord)) && !ModBlocks.teleportBeamBlock.equals(b)) {
      if (dy <= errory) {
        return false;
      }
 else {
        break;
      }
    }
  }
  Block b=world.getBlock(c.getX(),c.getY() + 1,c.getZ());
  if (b.isAir(world,c.getX(),c.getY() + 1,c.getZ()) || ModBlocks.teleportBeamBlock.equals(b)) {
    world.setBlock(c.getX(),c.getY() + 1,c.getZ(),ModBlocks.teleportBeamBlock,0,2);
  }
  return true;
}

Fixed version (ground truth):
private boolean makeBeam(Coordinate c,World world,int dy1,int dy2,int errory){
  for (int dy=dy1; dy <= dy2; dy++) {
    Block b=world.getBlock(c.getX(),c.getY() + dy,c.getZ());
    if ((!b.isAir(world,c.getX(),c.getY() + dy,c.getZ())) && !ModBlocks.teleportBeamBlock.equals(b)) {
      if (dy <= errory) {
        return false;
      }
 else {
        break;
      }
    }
  }
  Block b=world.getBlock(c.getX(),c.getY() + 1,c.getZ());
  if (b.isAir(world,c.getX(),c.getY() + 1,c.getZ()) || ModBlocks.teleportBeamBlock.equals(b)) {
    world.setBlock(c.getX(),c.getY() + 1,c.getZ(),ModBlocks.teleportBeamBlock,0,2);
  }
  return true;
}
Program: 166170
Project: 166170
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  boolean wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed) {
    if (world.isRemote) {
      EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      endergenicTileEntity.useWrench();
    }
    return true;
  }
 else {
    return super.onBlockActivated(world,x,y,z,player,side,sx,sy,sz);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  boolean wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed) {
    if (world.isRemote) {
      EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      endergenicTileEntity.useWrench(player);
    }
    return true;
  }
 else {
    return super.onBlockActivated(world,x,y,z,player,side,sx,sy,sz);
  }
}
Program: 166171
Project: 166171
Buggy source:
public void useWrench(){
  EndergenicTileEntity otherTE=RFTools.instance.clientInfo.getSelectedEndergenicTileEntity();
  if (otherTE == null) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(this);
    EndergenicTileEntity destinationTE=getDestinationTE();
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(destinationTE);
    if (destinationTE == null) {
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str");
    }
 else {
      int distance=getDistanceInTicks();
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + distance + "String_Node_Str");
    }
  }
 else   if (otherTE.equals(this)) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
  }
 else {
    Coordinate c=new Coordinate(xCoord,yCoord,zCoord);
    int distance=otherTE.calculateDistance(c);
    if (distance >= 5) {
      RFTools.warn(Minecraft.getMinecraft().thePlayer,"String_Node_Str");
      return;
    }
    otherTE.setDestination(c);
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
    RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + otherTE.getDistanceInTicks() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void useWrench(EntityPlayer player){
  EndergenicTileEntity otherTE=RFTools.instance.clientInfo.getSelectedEndergenicTileEntity();
  if (otherTE == null) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(this);
    EndergenicTileEntity destinationTE=getDestinationTE();
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(destinationTE);
    if (destinationTE == null) {
      RFTools.message(player,"String_Node_Str");
    }
 else {
      int distance=getDistanceInTicks();
      RFTools.message(player,"String_Node_Str" + distance + "String_Node_Str");
    }
  }
 else   if (otherTE.equals(this)) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
  }
 else {
    Coordinate c=new Coordinate(xCoord,yCoord,zCoord);
    int distance=otherTE.calculateDistance(c);
    if (distance >= 5) {
      RFTools.warn(player,"String_Node_Str");
      return;
    }
    otherTE.setDestination(c);
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
    RFTools.message(player,"String_Node_Str" + otherTE.getDistanceInTicks() + "String_Node_Str");
  }
}
Program: 166172
Project: 166172
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)tileEntity;
  ResourceLocation txt;
  if (endergenicTileEntity == RFTools.instance.clientInfo.getSelectedEndergenicTileEntity()) {
    txt=redglow;
  }
 else   if (endergenicTileEntity == RFTools.instance.clientInfo.getDestinationEndergenicTileEntity()) {
    txt=blueglow;
  }
 else {
    return;
  }
  this.bindTexture(txt);
  Tessellator tessellator=Tessellator.instance;
  GL11.glPushMatrix();
  GL11.glTranslated(x,y,z);
  tessellator.startDrawingQuads();
  tessellator.setColorRGBA(255,255,255,128);
  tessellator.setBrightness(240);
  boolean blending=GL11.glIsEnabled(GL11.GL_BLEND);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.UP.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.DOWN.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.NORTH.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.SOUTH.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.WEST.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.EAST.ordinal(),1.1f,-0.05f);
  tessellator.draw();
  GL11.glPopMatrix();
  if (!blending) {
    GL11.glDisable(GL11.GL_BLEND);
  }
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)tileEntity;
  ResourceLocation txt;
  if (endergenicTileEntity.equals(RFTools.instance.clientInfo.getSelectedEndergenicTileEntity())) {
    txt=redglow;
  }
 else   if (endergenicTileEntity.equals(RFTools.instance.clientInfo.getDestinationEndergenicTileEntity())) {
    txt=blueglow;
  }
 else {
    return;
  }
  this.bindTexture(txt);
  Tessellator tessellator=Tessellator.instance;
  GL11.glPushMatrix();
  GL11.glTranslated(x,y,z);
  tessellator.startDrawingQuads();
  tessellator.setColorRGBA(255,255,255,128);
  tessellator.setBrightness(240);
  boolean blending=GL11.glIsEnabled(GL11.GL_BLEND);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.UP.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.DOWN.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.NORTH.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.SOUTH.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.WEST.ordinal(),1.1f,-0.05f);
  DefaultISBRH.addSideFullTexture(tessellator,ForgeDirection.EAST.ordinal(),1.1f,-0.05f);
  tessellator.draw();
  GL11.glPopMatrix();
  if (!blending) {
    GL11.glDisable(GL11.GL_BLEND);
  }
}
Program: 166173
Project: 166173
Buggy source:
public void useWrench(){
  EndergenicTileEntity otherTE=RFTools.instance.clientInfo.getSelectedEndergenicTileEntity();
  if (otherTE == null) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(this);
    EndergenicTileEntity destinationTE=getDestinationTE();
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(destinationTE);
    if (destinationTE == null) {
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str");
    }
 else {
      int distance=getDistanceInTicks();
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + distance + "String_Node_Str");
    }
  }
 else   if (otherTE == this) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
  }
 else {
    otherTE.setDestination(new Coordinate(xCoord,yCoord,zCoord));
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
    RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + otherTE.getDistanceInTicks() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void useWrench(){
  EndergenicTileEntity otherTE=RFTools.instance.clientInfo.getSelectedEndergenicTileEntity();
  if (otherTE == null) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(this);
    EndergenicTileEntity destinationTE=getDestinationTE();
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(destinationTE);
    if (destinationTE == null) {
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str");
    }
 else {
      int distance=getDistanceInTicks();
      RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + distance + "String_Node_Str");
    }
  }
 else   if (otherTE.equals(this)) {
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
  }
 else {
    otherTE.setDestination(new Coordinate(xCoord,yCoord,zCoord));
    RFTools.instance.clientInfo.setSelectedEndergenicTileEntity(null);
    RFTools.instance.clientInfo.setDestinationEndergenicTileEntity(null);
    RFTools.message(Minecraft.getMinecraft().thePlayer,"String_Node_Str" + otherTE.getDistanceInTicks() + "String_Node_Str");
  }
}
Program: 166174
Project: 166174
Buggy source:
@Override public boolean renderWorldBlock(IBlockAccess world,int x,int y,int z,Block block,int modelId,RenderBlocks renderer){
  Tessellator tessellator=Tessellator.instance;
  tessellator.setColorOpaque(255,255,255);
  tessellator.addTranslation(x,y,z);
  int meta=0;
  if (world != null) {
    meta=world.getBlockMetadata(x,y,z);
  }
  ForgeDirection k=BlockTools.getOrientationHoriz(meta);
  addSideHeight(block,tessellator,Constants.SIDE_NORTH,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_SOUTH,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_WEST,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_EAST,meta,.3);
  addSideHeightWithRotation(block,tessellator,Constants.SIDE_UP,meta,.3,k);
  addSideHeight(block,tessellator,Constants.SIDE_DOWN,meta,.3);
  tessellator.addTranslation(-x,-y,-z);
  return true;
}

Fixed version (ground truth):
@Override public boolean renderWorldBlock(IBlockAccess world,int x,int y,int z,Block block,int modelId,RenderBlocks renderer){
  Tessellator tessellator=Tessellator.instance;
  tessellator.setColorOpaque(255,255,255);
  tessellator.addTranslation(x,y,z);
  tessellator.setBrightness(block.getMixedBrightnessForBlock(world,x,y,z));
  int meta=0;
  if (world != null) {
    meta=world.getBlockMetadata(x,y,z);
  }
  ForgeDirection k=BlockTools.getOrientationHoriz(meta);
  addSideHeight(block,tessellator,Constants.SIDE_NORTH,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_SOUTH,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_WEST,meta,.3);
  addSideHeight(block,tessellator,Constants.SIDE_EAST,meta,.3);
  addSideHeightWithRotation(block,tessellator,Constants.SIDE_UP,meta,.3,k);
  addSideHeight(block,tessellator,Constants.SIDE_DOWN,meta,.3);
  tessellator.addTranslation(-x,-y,-z);
  return true;
}
Program: 166175
Project: 166175
Buggy source:
@Override protected void checkStateServer(){
  if (!isValid()) {
    counter=1;
    return;
  }
  counter--;
  if (counter > 0) {
    return;
  }
  counter=20;
  TileEntity tileEntity=worldObj.getTileEntity(monitorX,monitorY,monitorZ);
  if (!(tileEntity instanceof IEnergyHandler)) {
    setInvalid();
    return;
  }
  IEnergyHandler handler=(IEnergyHandler)tileEntity;
  int maxEnergy=handler.getMaxEnergyStored(ForgeDirection.DOWN);
  int ratio=0;
  boolean alarm=false;
  if (maxEnergy > 0) {
    int stored=handler.getEnergyStored(ForgeDirection.DOWN);
    ratio=1 + (stored * 5) / maxEnergy;
    if (ratio < 1) {
      ratio=1;
    }
 else     if (ratio > 5) {
      ratio=5;
    }
switch (alarmMode) {
case MODE_OFF:
      alarm=false;
    break;
case MODE_LESS:
  alarm=((stored * 100 / maxEnergy) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxEnergy) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (rflevel.getValue() != ratio || alarm != alarmValue) {
rflevel.setValue(ratio);
if (alarmValue != alarm) {
inAlarm.setValue(alarm);
}
notifyBlockUpdate();
}
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  if (!isValid()) {
    counter=1;
    return;
  }
  counter--;
  if (counter > 0) {
    return;
  }
  counter=20;
  TileEntity tileEntity=worldObj.getTileEntity(monitorX,monitorY,monitorZ);
  if (!(tileEntity instanceof IEnergyHandler)) {
    setInvalid();
    return;
  }
  IEnergyHandler handler=(IEnergyHandler)tileEntity;
  int maxEnergy=handler.getMaxEnergyStored(ForgeDirection.DOWN);
  int ratio=0;
  boolean alarm=false;
  if (maxEnergy > 0) {
    int stored=handler.getEnergyStored(ForgeDirection.DOWN);
    ratio=1 + (stored * 5) / maxEnergy;
    if (ratio < 1) {
      ratio=1;
    }
 else     if (ratio > 5) {
      ratio=5;
    }
switch (alarmMode) {
case MODE_OFF:
      alarm=false;
    break;
case MODE_LESS:
  alarm=((stored * 100 / maxEnergy) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxEnergy) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (getRflevel() != ratio || alarm != alarmValue) {
rflevel.setValue(ratio);
if (alarmValue != alarm) {
inAlarm.setValue(alarm);
}
notifyBlockUpdate();
}
}
Program: 166176
Project: 166176
Buggy source:
public int getRflevel(){
  return rflevel.getValue();
}

Fixed version (ground truth):
public int getRflevel(){
  Integer value=rflevel.getValue();
  if (value == null) {
    return 0;
  }
  return value;
}
Program: 166177
Project: 166177
Buggy source:
@Override public void writeToNBT(NBTTagCompound tagCompound){
  super.writeToNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",monitorX);
  tagCompound.setInteger("String_Node_Str",monitorY);
  tagCompound.setInteger("String_Node_Str",monitorZ);
  tagCompound.setInteger("String_Node_Str",rflevel.getValue());
  tagCompound.setByte("String_Node_Str",(byte)alarmMode.getIndex());
  tagCompound.setByte("String_Node_Str",(byte)alarmLevel);
  Boolean value=inAlarm.getValue();
  tagCompound.setBoolean("String_Node_Str",value == null ? false : value);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound tagCompound){
  super.writeToNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",monitorX);
  tagCompound.setInteger("String_Node_Str",monitorY);
  tagCompound.setInteger("String_Node_Str",monitorZ);
  tagCompound.setInteger("String_Node_Str",getRflevel());
  tagCompound.setByte("String_Node_Str",(byte)alarmMode.getIndex());
  tagCompound.setByte("String_Node_Str",(byte)alarmLevel);
  Boolean value=inAlarm.getValue();
  tagCompound.setBoolean("String_Node_Str",value == null ? false : value);
}
Program: 166179
Project: 166179
Buggy source:
private boolean mergeItemStacks(ItemStack itemStack,SlotType slotType,boolean reverse){
  SlotRanges ranges=factory.getSlotRangesMap().get(slotType);
  for (  Range<Integer> r : ranges.asRanges()) {
    Integer start=r.lowerEndpoint();
    int end=r.upperEndpoint() + 1;
    if (mergeItemStack(itemStack,start,end,reverse)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean mergeItemStacks(ItemStack itemStack,SlotType slotType,boolean reverse){
  SlotRanges ranges=factory.getSlotRangesMap().get(slotType);
  if (ranges == null) {
    return false;
  }
  for (  Range<Integer> r : ranges.asRanges()) {
    Integer start=r.lowerEndpoint();
    int end=r.upperEndpoint() + 1;
    if (mergeItemStack(itemStack,start,end,reverse)) {
      return true;
    }
  }
  return false;
}
Program: 166180
Project: 166180
Buggy source:
@Override public void readFromNBT(NBTTagCompound tagCompound){
  super.readFromNBT(tagCompound);
  prevIn=tagCompound.getBoolean("String_Node_Str");
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound tagCompound){
  super.readFromNBT(tagCompound);
  prevIn=tagCompound.getBoolean("String_Node_Str");
  readBufferFromNBT(tagCompound);
}
Program: 166181
Project: 166181
Buggy source:
@Override public void writeToNBT(NBTTagCompound tagCompound){
  super.writeToNBT(tagCompound);
  tagCompound.setBoolean("String_Node_Str",prevIn);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound tagCompound){
  super.writeToNBT(tagCompound);
  tagCompound.setBoolean("String_Node_Str",prevIn);
  writeBufferToNBT(tagCompound);
}
Program: 166182
Project: 166182
Buggy source:
private boolean takePearl(){
  for (  ItemStack stack : stacks) {
    if (Items.ender_pearl.equals(stack.getItem()) && stack.stackSize > 0) {
      stack.stackSize--;
      markDirty();
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean takePearl(){
  for (int i=0; i < stacks.length; i++) {
    ItemStack stack=stacks[i];
    if (stack != null && Items.ender_pearl.equals(stack.getItem()) && stack.stackSize > 0) {
      decrStackSize(i,1);
      return true;
    }
  }
  return false;
}
Program: 166183
Project: 166183
Buggy source:
private boolean mergeItemStacks(ItemStack itemStack,SlotType slotType,boolean reverse){
  SlotRanges ranges=factory.getSlotRangesMap().get(slotType);
  if (ranges == null) {
    return false;
  }
  for (  Range<Integer> r : ranges.asRanges()) {
    Integer start=r.lowerEndpoint();
    int end=r.upperEndpoint() + 1;
    if (mergeItemStack(itemStack,start,end,reverse)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean mergeItemStacks(ItemStack itemStack,SlotType slotType,boolean reverse){
  SlotRanges ranges=factory.getSlotRangesMap().get(slotType);
  if (ranges == null) {
    return false;
  }
  for (  Range<Integer> r : ranges.asRanges()) {
    Integer start=r.lowerEndpoint();
    int end=r.upperEndpoint();
    if (mergeItemStack(itemStack,start,end,reverse)) {
      return true;
    }
  }
  return false;
}
Program: 166184
Project: 166184
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  super.breakBlock(world,x,y,z,block,meta);
  if (world.isRemote) {
    return;
  }
  TeleportDestinations destinations=TeleportDestinations.getDestinations(world);
  destinations.removeDestination(new Coordinate(x,y,z),0);
  destinations.save(world);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  super.breakBlock(world,x,y,z,block,meta);
  if (world.isRemote) {
    return;
  }
  TeleportDestinations destinations=TeleportDestinations.getDestinations(world);
  destinations.removeDestination(new Coordinate(x,y,z),world.provider.dimensionId);
  destinations.save(world);
}
Program: 166185
Project: 166185
Buggy source:
@Override public void registerBlockIcons(IIconRegister iconRegister){
  iconBottom=iconRegister.registerIcon(RFTools.MODID + "String_Node_Str" + "String_Node_Str");
  iconSide=iconRegister.registerIcon(RFTools.MODID + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void registerBlockIcons(IIconRegister iconRegister){
  iconTop=iconRegister.registerIcon(RFTools.MODID + "String_Node_Str" + "String_Node_Str");
  iconSide=iconRegister.registerIcon(RFTools.MODID + "String_Node_Str" + "String_Node_Str");
}
Program: 166186
Project: 166186
Buggy source:
@Override public IIcon getIcon(int side,int meta){
  if (side == ForgeDirection.DOWN.ordinal()) {
    return iconBottom;
  }
 else {
    return iconSide;
  }
}

Fixed version (ground truth):
@Override public IIcon getIcon(int side,int meta){
  if (side == ForgeDirection.UP.ordinal()) {
    return iconTop;
  }
 else {
    return iconSide;
  }
}
Program: 166187
Project: 166187
Buggy source:
@Override protected void checkStateServer(){
  super.checkStateServer();
  int meta=worldObj.getBlockMetadata(xCoord,yCoord,zCoord);
  int rf;
  if (BlockTools.getRedstoneSignal(meta)) {
    rf=rfOn;
  }
 else {
    rf=rfOff;
  }
  if (rf <= 0) {
    return;
  }
  for (int i=0; i < 6; i++) {
    ForgeDirection dir=ForgeDirection.getOrientation(i);
    TileEntity te=worldObj.getTileEntity(xCoord + dir.offsetX,yCoord + dir.offsetY,zCoord + dir.offsetZ);
    if (te instanceof IEnergyHandler) {
      IEnergyHandler handler=(IEnergyHandler)te;
      ForgeDirection opposite=dir.getOpposite();
      if (handler.canConnectEnergy(opposite)) {
        int received=handler.receiveEnergy(opposite,rf,false);
        rf-=received;
        if (rf <= 0) {
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  super.checkStateServer();
  int meta=worldObj.getBlockMetadata(xCoord,yCoord,zCoord);
  int rf;
  if (BlockTools.getRedstoneSignal(meta)) {
    rf=rfOn;
  }
 else {
    rf=rfOff;
  }
  if (rf <= 0) {
    return;
  }
  int energyStored=getEnergyStored(ForgeDirection.DOWN);
  if (energyStored <= 0) {
    return;
  }
  for (int i=0; i < 6; i++) {
    ForgeDirection dir=ForgeDirection.getOrientation(i);
    TileEntity te=worldObj.getTileEntity(xCoord + dir.offsetX,yCoord + dir.offsetY,zCoord + dir.offsetZ);
    if (te instanceof IEnergyHandler) {
      IEnergyHandler handler=(IEnergyHandler)te;
      ForgeDirection opposite=dir.getOpposite();
      if (handler.canConnectEnergy(opposite)) {
        int rfToGive;
        if (rf <= energyStored) {
          rfToGive=rf;
        }
 else {
          rfToGive=energyStored;
        }
        int received=handler.receiveEnergy(opposite,rfToGive,false);
        energyStored-=extractEnergy(ForgeDirection.DOWN,received,false);
        if (energyStored <= 0) {
          return;
        }
      }
    }
  }
}