nus-yam/ex-repair huggingface dataset:
Program: 34669
Project: 34669
Buggy source:
public static String sentence(String text){
  if (!ModCommonProxy.hardcoreEnderbacon)   return text;
  String lc=StatCollector.translateToLocal("String_Node_Str"), fc=Character.toUpperCase(lc.charAt(0)) + lc.substring(1), uc=lc.toUpperCase();
  text=lcword.matcher(text).replaceAll(lc);
  text=fcword.matcher(text).replaceAll(fc);
  text=ucword.matcher(text).replaceAll(uc);
  return text;
}

Fixed version (ground truth):
public static String sentence(String text){
  if (!ModCommonProxy.hardcoreEnderbacon)   return text;
  String lc=StatCollector.translateToLocal("String_Node_Str"), fc=Character.toUpperCase(lc.charAt(0)) + lc.substring(1), uc=lc.toUpperCase(Locale.ENGLISH);
  text=lcword.matcher(text).replaceAll(lc);
  text=fcword.matcher(text).replaceAll(fc);
  text=ucword.matcher(text).replaceAll(uc);
  return text;
}
Program: 34670
Project: 34670
Buggy source:
public StrongholdPiece(int weight,int minAmount,int maxAmount,Size size){
  super(weight,minAmount,maxAmount,size);
}

Fixed version (ground truth):
public StrongholdPiece(Type type,int weight,int minAmount,int maxAmount,Size size){
  super(type,weight,minAmount,maxAmount,size);
}
Program: 34671
Project: 34671
Buggy source:
public StrongholdPieceCorridor(int weight){
  super(weight,0,20,new Size(5,5,3));
  addConnection(new Connection(Facing4.NORTH_NEGZ,0,0,2));
  addConnection(new Connection(Facing4.SOUTH_POSZ,2,0,2));
}

Fixed version (ground truth):
public StrongholdPieceCorridor(int weight){
  super(Type.CORRIDOR,weight,0,20,new Size(5,5,3));
  addConnection(Facing4.NORTH_NEGZ,0,0,2);
  addConnection(Facing4.SOUTH_POSZ,2,0,2);
}
Program: 34672
Project: 34672
Buggy source:
public StrongholdPieceEndPortal(){
  super(new Size(9,10,9));
  addConnection(new Connection(Facing4.NORTH_NEGZ,0,0,4));
  addConnection(new Connection(Facing4.SOUTH_POSZ,8,0,4));
}

Fixed version (ground truth):
public StrongholdPieceEndPortal(){
  super(Type.ROOM,new Size(9,10,9));
  addConnection(Facing4.NORTH_NEGZ,0,0,4);
  addConnection(Facing4.SOUTH_POSZ,8,0,4);
}
Program: 34673
Project: 34673
Buggy source:
public void generateInWorld(World world,Random rand,int centerX,int bottomY,int centerZ){
  PosMutable pos=new PosMutable();
  int x, y, z, index=0;
  for (y=0; y < sizeY; y++) {
    for (x=-radX; x <= radX; x++) {
      for (z=-radZ; z <= radZ; z++) {
        pos.set(centerX + x,bottomY + y,centerZ + z).setBlock(world,blocks[index],metadata[index],2);
        ++index;
      }
    }
  }
  tileEntityMap.forEachEntry((ind,value) -> {
    toPos(ind,pos);
    value.generateTile(pos.getTileEntity(world),rand);
    return true;
  }
);
  scheduledUpdates.forEach(ind -> {
    toPos(ind,pos);
    world.markBlockForUpdate(pos.getX(),pos.getY(),pos.getZ());
    return true;
  }
);
  entityList.forEach(entity -> {
    entity.setPosition(centerX + entity.posX,bottomY + entity.posY,centerZ + entity.posZ);
    world.spawnEntityInWorld(entity);
  }
);
}

Fixed version (ground truth):
public void generateInWorld(World world,Random rand,int centerX,int bottomY,int centerZ){
  PosMutable pos=new PosMutable();
  int x, y, z, index=0;
  for (z=-radZ; z <= radZ; z++) {
    for (x=-radX; x <= radX; x++) {
      for (y=0; y < sizeY; y++) {
        if (blocks[index] != null)         pos.set(centerX + x,bottomY + y,centerZ + z).setBlock(world,blocks[index],metadata[index],2);
        ++index;
      }
    }
  }
  tileEntityMap.forEachEntry((ind,value) -> {
    toPos(ind,pos);
    value.generateTile(pos.getTileEntity(world),rand);
    return true;
  }
);
  scheduledUpdates.forEach(ind -> {
    toPos(ind,pos);
    world.markBlockForUpdate(pos.getX(),pos.getY(),pos.getZ());
    return true;
  }
);
  entityList.forEach(entity -> {
    entity.setPosition(centerX + entity.posX,bottomY + entity.posY,centerZ + entity.posZ);
    world.spawnEntityInWorld(entity);
  }
);
}
Program: 34674
Project: 34674
Buggy source:
/** 
 * Returns a random piece or null if the search fails.
 */
private StructureDungeonPiece selectNextPiece(Random rand){
  StructureDungeonPiece nextPiece=pieces.getRandomItem(rand);
  return pieceCount.get(nextPiece) >= nextPiece.maxAmount ? null : nextPiece;
}

Fixed version (ground truth):
/** 
 * Returns a random piece or null if the search fails.
 */
private StructureDungeonPiece selectNextPiece(Random rand){
  StructureDungeonPiece nextPiece=pieces.getRandomItem(rand);
  return nextPiece != null && pieceCount.get(nextPiece) >= nextPiece.maxAmount ? null : nextPiece;
}
Program: 34676
Project: 34676
Buggy source:
public abstract void generate(StructureWorld world,Random rand,Pos topLeft);

Fixed version (ground truth):
public abstract void generate(StructureWorld world,Random rand,int x,int y,int z);
Program: 34677
Project: 34677
Buggy source:
public UpdateNotificationManager(){
  UpdateSavefile.prepare();
  saveFile=new UpdateSavefile();
  saveFile.load();
}

Fixed version (ground truth):
public UpdateNotificationManager(){
  UpdateSavefile.prepare();
  saveFile=new UpdateSavefile();
  saveFile.load();
  lastCheckedMod=saveFile.newestModVersion;
}
Program: 34678
Project: 34678
Buggy source:
@SubscribeEvent public void onPlayerLogin(PlayerLoggedInEvent e){
  if (enableNotifications || enableBuildCheck) {
    long time=System.currentTimeMillis();
    if (lastNotificationTime == -1 || time - lastNotificationTime > 43200000) {
      lastNotificationTime=time;
      new UpdateThread().start();
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onPlayerLogin(PlayerLoggedInEvent e){
  if (enableNotifications || enableBuildCheck) {
    long time=Calendar.getInstance().getTimeInMillis();
    if (time - saveFile.lastCheckTime > 86400000L) {
      saveFile.lastCheckTime=time;
      new UpdateThread().start();
    }
  }
}
Program: 34680
Project: 34680
Buggy source:
@SubscribeEvent public void onRenderBlockOutline(DrawBlockHighlightEvent e){
  BlockPosM tmp=BlockPosM.tmp(e.target.blockX,e.target.blockY,e.target.blockZ);
  if (tmp.getBlock(e.player.worldObj) == BlockList.energy_cluster) {
    clusterLookedAt=(TileEntityEnergyCluster)tmp.getTileEntity(e.player.worldObj);
    e.setCanceled(true);
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onRenderBlockOutline(DrawBlockHighlightEvent e){
  BlockPosM tmp=tmpPos.set(e.target.blockX,e.target.blockY,e.target.blockZ);
  if (tmp.getBlock(e.player.worldObj) == BlockList.energy_cluster) {
    clusterLookedAt=(TileEntityEnergyCluster)tmp.getTileEntity(e.player.worldObj);
    e.setCanceled(true);
  }
}
Program: 34681
Project: 34681
Buggy source:
public static BlockPosM tmp(long serialized){
  return temporary.set(serialized);
}

Fixed version (ground truth):
public static BlockPosM tmp(long serialized){
  return temporary.get().set(serialized);
}
Program: 34682
Project: 34682
Buggy source:
@SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister){
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister){
}
Program: 34683
Project: 34683
Buggy source:
@SideOnly(Side.CLIENT) @Override public IIcon getIcon(int side,int meta){
  return Blocks.soul_sand.getIcon(side,0);
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side,int meta){
  return Blocks.soul_sand.getIcon(side,0);
}
Program: 34684
Project: 34684
Buggy source:
public static void finalizeEventTests() throws Throwable {
  if (!isLoaded)   return;
  Builder<String> unitDataList=ImmutableList.builder();
  unitDataList.add("String_Node_Str");
  unitDataList.add("String_Node_Str" + menuDisplayOk + "String_Node_Str"+ menuDisplayFailed+ "String_Node_Str");
  Field field=FMLCommonHandler.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(FMLCommonHandler.instance(),unitDataList.build());
  field=ForgeVersion.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(null,ForgeVersion.Status.UP_TO_DATE);
}

Fixed version (ground truth):
public static void finalizeEventTests() throws Throwable {
  if (!isLoaded)   return;
  Builder<String> unitDataList=ImmutableList.builder();
  unitDataList.add("String_Node_Str");
  unitDataList.add("String_Node_Str" + menuDisplayOk + "String_Node_Str"+ menuDisplayFailed+ "String_Node_Str");
  Field field=FMLCommonHandler.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(FMLCommonHandler.instance(),unitDataList.build());
  field=FMLCommonHandler.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(FMLCommonHandler.instance(),unitDataList.build());
  field=ForgeVersion.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(null,ForgeVersion.Status.UP_TO_DATE);
}
Program: 34686
Project: 34686
Buggy source:
@Override public void sendMessage(MessageType msgType,int[] data){
switch (msgType) {
case TRANSPORT_BEACON_GUI:
    GuiScreen gui=Minecraft.getMinecraft().currentScreen;
  if (gui instanceof GuiTransportBeacon && data.length == 5) {
    GuiTransportBeacon beacon=(GuiTransportBeacon)gui;
    if (beacon.centerX == data[0] && beacon.centerY == data[1] && beacon.centerZ == data[2])     beacon.updateStatusEvent(data[3],data[4] == 1);
  }
break;
case ENHANCEMENT_SLOT_RESET:
Container container=Minecraft.getMinecraft().thePlayer.openContainer;
if (container instanceof ContainerEndPowderEnhancements) ((ContainerEndPowderEnhancements)container).onEnhancementSlotChangeClient(-1);
break;
}
}

Fixed version (ground truth):
@Override public void sendMessage(MessageType msgType,int[] data){
switch (msgType) {
case TRANSPORT_BEACON_GUI:
    GuiScreen gui=Minecraft.getMinecraft().currentScreen;
  if (gui instanceof GuiTransportBeacon && data.length == 5) {
    GuiTransportBeacon beacon=(GuiTransportBeacon)gui;
    if (beacon.centerX == data[0] && beacon.centerY == data[1] && beacon.centerZ == data[2])     beacon.updateStatusEvent(data[3],data[4] == 1);
  }
break;
case ENHANCEMENT_SLOT_RESET:
Container container=Minecraft.getMinecraft().thePlayer.openContainer;
if (container instanceof ContainerEndPowderEnhancements) ((ContainerEndPowderEnhancements)container).onEnhancementSlotChangeClient(-1);
break;
case DEBUG_TITLE_SET:
Display.setTitle(Display.getTitle() + "String_Node_Str" + (Log.isDeobfEnvironment ? "String_Node_Str" : "String_Node_Str")+ ' '+ HardcoreEnderExpansion.modVersion);
break;
}
}
Program: 34687
Project: 34687
Buggy source:
public static void initializeDebug(){
  if (forceDebugEnabled || isDeobfEnvironment) {
    Display.setTitle(new StringBuilder().append(Display.getTitle()).append("String_Node_Str").append(isDeobfEnvironment ? "String_Node_Str" : "String_Node_Str").append(' ').append(HardcoreEnderExpansion.modVersion).toString());
  }
}

Fixed version (ground truth):
public static void initializeDebug(){
  if (forceDebugEnabled || isDeobfEnvironment) {
    HardcoreEnderExpansion.proxy.sendMessage(MessageType.DEBUG_TITLE_SET,ArrayUtils.EMPTY_INT_ARRAY);
  }
}
Program: 34688
Project: 34688
Buggy source:
@Override public void call(MessageRunner runner){
  WeightedLootList list=lootNames.get(runner.getString("String_Node_Str"));
  int limit=runner.getInt("String_Node_Str");
  ItemPattern pattern=runner.<ItemPattern>getValue("String_Node_Str");
  pattern.setDamageValues(ArrayUtils.EMPTY_INT_ARRAY);
  pattern.setNBT(null);
  int size=list.size();
  for (Iterator<LootItemStack> iter=list.iterator(); iter.hasNext(); ) {
    if (pattern.matches(new ItemStack(iter.next().getItem()))) {
      iter.remove();
      if (limit > 0 && --limit == 0)       break;
    }
  }
  size=size - DragonEssenceHandler.recipes.size();
  if (size == 0)   MessageLogger.logWarn("String_Node_Str");
 else   MessageLogger.logOk("String_Node_Str",size);
}

Fixed version (ground truth):
@Override public void call(MessageRunner runner){
  WeightedLootList list=lootNames.get(runner.getString("String_Node_Str"));
  int limit=runner.getInt("String_Node_Str");
  ItemPattern pattern=runner.<ItemPattern>getValue("String_Node_Str");
  pattern.setDamageValues(ArrayUtils.EMPTY_INT_ARRAY);
  int size=list.size();
  for (Iterator<LootItemStack> iter=list.iterator(); iter.hasNext(); ) {
    if (pattern.matches(new ItemStack(iter.next().getItem()))) {
      iter.remove();
      if (limit > 0 && --limit == 0)       break;
    }
  }
  size=size - DragonEssenceHandler.recipes.size();
  if (size == 0)   MessageLogger.logWarn("String_Node_Str");
 else   MessageLogger.logOk("String_Node_Str",size);
}
Program: 34689
Project: 34689
Buggy source:
@Override public void drawScreen(int mouseX,int mouseY,float partialTickTime){
  if (isLoaded) {
    int wheel=Mouse.getDWheel();
    float prevScale=field_146570_r;
    if (wheel < 0)     field_146570_r+=0.5F;
 else     if (wheel > 0)     field_146570_r-=0.5F;
    field_146570_r=MathUtil.clamp(field_146570_r,1F,2F);
    if (field_146570_r != prevScale) {
      field_146567_u-=((field_146570_r * field_146555_f) - (prevScale * field_146555_f)) * 0.5F;
      field_146566_v-=((field_146570_r * field_146557_g) - (prevScale * field_146557_g)) * 0.5F;
      field_146565_w=field_146569_s=field_146567_u;
      field_146573_x=field_146568_t=field_146566_v;
    }
  }
  super.drawScreen(mouseX,mouseY,partialTickTime);
}

Fixed version (ground truth):
@Override public void drawScreen(int mouseX,int mouseY,float partialTickTime){
  if (isLoaded) {
    int wheel=Mouse.getDWheel();
    float prevScale=field_146570_r;
    if (wheel < 0)     field_146570_r+=0.5F;
 else     if (wheel > 0)     field_146570_r-=0.5F;
    field_146570_r=MathUtil.clamp(field_146570_r,1F,2F);
    if (!MathUtil.floatEquals(field_146570_r,prevScale)) {
      field_146567_u-=((field_146570_r * field_146555_f) - (prevScale * field_146555_f)) * 0.5F;
      field_146566_v-=((field_146570_r * field_146557_g) - (prevScale * field_146557_g)) * 0.5F;
      field_146565_w=field_146569_s=field_146567_u;
      field_146573_x=field_146568_t=field_146566_v;
    }
  }
  super.drawScreen(mouseX,mouseY,partialTickTime);
}
Program: 34690
Project: 34690
Buggy source:
public ItemStack tryTeleportEntity(ItemStack is,EntityPlayer player,Entity entity){
  if (entity.isRiding() || entity.riddenByEntity != null)   return is;
  if (is.stackTagCompound != null && is.stackTagCompound.hasKey("String_Node_Str"))   return is;
  GemData gemData=new GemData();
  gemData.set(is.stackTagCompound);
  if (gemData.isLinked() && entity.dimension == gemData.dim) {
    int itemDamage=is.getItemDamage();
    if (itemDamage >= is.getMaxDamage())     return is;
    boolean isLiving=entity instanceof EntityLivingBase;
    PacketPipeline.sendToAllAround(entity,64D,new C21EffectEntity(FXType.Entity.GEM_TELEPORT_FROM,entity));
    damageItem(is,player);
    if (isLiving)     ((EntityLivingBase)entity).setPositionAndUpdate(gemData.x + 0.5D,gemData.y + 1.001D,gemData.z + 0.5D);
    entity.setLocationAndAngles(gemData.x + 0.5D,gemData.y + 1.001D,gemData.z + 0.5D,entity.rotationYaw,entity.rotationPitch);
    entity.fallDistance=0F;
    float percBroken=itemDamage / (float)is.getMaxDamage();
    if (percBroken > 0.66F && entity.worldObj.rand.nextFloat() * 1.4F < percBroken) {
      GemSideEffects.performRandomEffect(entity,percBroken);
    }
    if (is.stackTagCompound == null)     is.stackTagCompound=new NBTTagCompound();
    is.stackTagCompound.setByte("String_Node_Str",(byte)50);
    PacketPipeline.sendToAllAround(entity,64D,new C20Effect(FXType.Basic.GEM_TELEPORT_TO,entity));
    CausatumUtils.increase(player,CausatumMeters.ITEM_USAGE,1F);
  }
  return is;
}

Fixed version (ground truth):
public ItemStack tryTeleportEntity(ItemStack is,EntityPlayer player,Entity entity){
  if (entity.isRiding() || entity.riddenByEntity != null || is.stackTagCompound == null)   return is;
  if (is.stackTagCompound != null && is.stackTagCompound.hasKey("String_Node_Str"))   return is;
  GemData gemData=new GemData();
  gemData.set(is.stackTagCompound);
  if (gemData.isLinked() && entity.dimension == gemData.dim) {
    int itemDamage=is.getItemDamage();
    if (itemDamage >= is.getMaxDamage())     return is;
    boolean isLiving=entity instanceof EntityLivingBase;
    PacketPipeline.sendToAllAround(entity,64D,new C21EffectEntity(FXType.Entity.GEM_TELEPORT_FROM,entity));
    damageItem(is,player);
    if (isLiving)     ((EntityLivingBase)entity).setPositionAndUpdate(gemData.x + 0.5D,gemData.y + 1.001D,gemData.z + 0.5D);
    entity.setLocationAndAngles(gemData.x + 0.5D,gemData.y + 1.001D,gemData.z + 0.5D,entity.rotationYaw,entity.rotationPitch);
    entity.fallDistance=0F;
    float percBroken=itemDamage / (float)is.getMaxDamage();
    if (percBroken > 0.66F && entity.worldObj.rand.nextFloat() * 1.4F < percBroken) {
      GemSideEffects.performRandomEffect(entity,percBroken);
    }
    if (is.stackTagCompound == null)     is.stackTagCompound=new NBTTagCompound();
    is.stackTagCompound.setByte("String_Node_Str",(byte)50);
    PacketPipeline.sendToAllAround(entity,64D,new C20Effect(FXType.Basic.GEM_TELEPORT_TO,entity));
    CausatumUtils.increase(player,CausatumMeters.ITEM_USAGE,1F);
  }
  return is;
}
Program: 34691
Project: 34691
Buggy source:
@Override public void run(String... args){
  int variation=args.length == 0 ? -1 : Ints.tryParse(args[0]);
  for (  IslandBiomeBase biome : new ArrayList<IslandBiomeBase>(IslandBiomeBase.biomeList)) {
    if (biome.isValidMetadata(variation)) {
      List<IslandBiomeBase> prevBiomes=new ArrayList<>(IslandBiomeBase.biomeList);
      IslandBiomeBase.biomeList.clear();
      IslandBiomeBase.biomeList.add(biome);
      try {
        Field fieldVariations=IslandBiomeBase.class.getDeclaredField("String_Node_Str");
        fieldVariations.setAccessible(true);
        Object prevVariations=fieldVariations.get(biome);
        BiomeContentVariation variationInst=null;
        for (        BiomeContentVariation var : (WeightedList<BiomeContentVariation>)prevVariations) {
          if (var.id == variation) {
            variationInst=var;
            break;
          }
        }
        if (variationInst != null) {
          fieldVariations.set(biome,new WeightedList<BiomeContentVariation>(variationInst));
          generate();
          fieldVariations.set(biome,prevVariations);
          variation=-2;
        }
      }
 catch (      NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
        e.printStackTrace();
      }
      IslandBiomeBase.biomeList.clear();
      IslandBiomeBase.biomeList.addAll(prevBiomes);
    }
  }
  if (variation == -1)   generate();
}

Fixed version (ground truth):
@Override public void run(String... args){
  int variation=args.length == 0 ? -1 : DragonUtil.tryParse(args[0],-1);
  for (  IslandBiomeBase biome : new ArrayList<IslandBiomeBase>(IslandBiomeBase.biomeList)) {
    if (biome.isValidMetadata(variation)) {
      List<IslandBiomeBase> prevBiomes=new ArrayList<>(IslandBiomeBase.biomeList);
      IslandBiomeBase.biomeList.clear();
      IslandBiomeBase.biomeList.add(biome);
      try {
        Field fieldVariations=IslandBiomeBase.class.getDeclaredField("String_Node_Str");
        fieldVariations.setAccessible(true);
        Object prevVariations=fieldVariations.get(biome);
        BiomeContentVariation variationInst=null;
        for (        BiomeContentVariation var : (WeightedList<BiomeContentVariation>)prevVariations) {
          if (var.id == variation) {
            variationInst=var;
            break;
          }
        }
        if (variationInst != null) {
          fieldVariations.set(biome,new WeightedList<BiomeContentVariation>(variationInst));
          generate();
          fieldVariations.set(biome,prevVariations);
          variation=-2;
        }
      }
 catch (      NoSuchFieldException|SecurityException|IllegalArgumentException|IllegalAccessException e) {
        e.printStackTrace();
      }
      IslandBiomeBase.biomeList.clear();
      IslandBiomeBase.biomeList.addAll(prevBiomes);
    }
  }
  if (variation == -1)   generate();
}
Program: 34693
Project: 34693
Buggy source:
public static void load(){
  if (!DragonUtil.checkSystemProperty("String_Node_Str"))   return;
  Log.debug("String_Node_Str");
  try {
    for (    ClassInfo clsInfo : ClassPath.from(UnitTester.class.getClassLoader()).getTopLevelClassesRecursive("String_Node_Str")) {
      Class<?> cls=clsInfo.load();
      Constructor<?> constr=null;
      try {
        constr=cls.getConstructor();
      }
 catch (      Exception e) {
      }
      if (constr == null) {
        Log.error("String_Node_Str",cls.getSimpleName());
        continue;
      }
      for (      Method method : cls.getMethods()) {
        UnitTest test=method.getAnnotation(UnitTest.class);
        if (test != null) {
          if ((method.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
            Log.error("String_Node_Str",cls.getSimpleName(),method.getName());
            continue;
          }
          if (test.runTime() != RunTime.INGAME && !test.trigger().isEmpty()) {
            Log.error("String_Node_Str",cls.getSimpleName(),method.getName(),test.runTime());
            continue;
          }
          if (test.type() == MethodType.PREPARATION)           registryPrep.put(test.runTime(),method);
 else           registryTests.put(test.runTime(),method);
          Log.debug("String_Node_Str",cls.getSimpleName(),method.getName(),test.type() == MethodType.PREPARATION ? "String_Node_Str" : "String_Node_Str");
        }
      }
    }
  }
 catch (  IOException e) {
    Log.throwable(e,"String_Node_Str");
  }
}

Fixed version (ground truth):
public static void load(){
  if (!DragonUtil.checkSystemProperty("String_Node_Str"))   return;
  Log.debug(prefix + "String_Node_Str");
  try {
    for (    ClassInfo clsInfo : ClassPath.from(UnitTester.class.getClassLoader()).getTopLevelClassesRecursive("String_Node_Str")) {
      Class<?> cls=clsInfo.load();
      Constructor<?> constr=null;
      try {
        constr=cls.getConstructor();
      }
 catch (      Exception e) {
      }
      if (constr == null) {
        Log.error(prefix + "String_Node_Str",cls.getSimpleName());
        continue;
      }
      for (      Method method : cls.getMethods()) {
        UnitTest test=method.getAnnotation(UnitTest.class);
        if (test != null) {
          if ((method.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
            Log.error(prefix + "String_Node_Str",cls.getSimpleName(),method.getName());
            continue;
          }
          if (test.runTime() != RunTime.INGAME && !test.trigger().isEmpty()) {
            Log.error(prefix + "String_Node_Str",cls.getSimpleName(),method.getName(),test.runTime());
            continue;
          }
          if (test.type() == MethodType.PREPARATION)           registryPrep.put(test.runTime(),method);
 else           registryTests.put(test.runTime(),method);
          Log.debug(prefix + "String_Node_Str",cls.getSimpleName(),method.getName(),test.type() == MethodType.PREPARATION ? "String_Node_Str" : "String_Node_Str");
        }
      }
    }
  }
 catch (  IOException e) {
    Log.throwable(e,prefix + "String_Node_Str");
  }
}
Program: 34694
Project: 34694
Buggy source:
public static void trigger(RunTime time,String trigger){
  Set<Method> prepList=new HashSet<>(), testList=new HashSet<>();
  for (  Method prep : registryPrep.get(time)) {
    if (trigger.equals(prep.getAnnotation(UnitTest.class).trigger()))     prepList.add(prep);
  }
  for (  Method test : registryTests.get(time)) {
    if (trigger.equals(test.getAnnotation(UnitTest.class).trigger()))     testList.add(test);
  }
  if (prepList.isEmpty() && testList.isEmpty())   return;
  Log.debug("String_Node_Str",prepList.size(),testList.size());
  Map<Class<?>,Object> objects=new HashMap<>();
  int succeeded=0, failed=0;
  for (  Method method : Iterables.concat(prepList,testList)) {
    try {
      Class<?> cls=method.getDeclaringClass();
      Object obj=objects.get(cls);
      if (obj == null)       objects.put(cls,obj=cls.newInstance());
      boolean isTest=testList.contains(method);
      try {
        method.invoke(obj);
        if (isTest)         ++succeeded;
      }
 catch (      InvocationTargetException e) {
        if (!isTest)         Log.throwable(e.getCause(),"String_Node_Str");
 else {
          Throwable cause=e.getCause();
          Log.error("String_Node_Str",cls.getSimpleName(),method.getName(),cause.getStackTrace()[0].getLineNumber(),cause.getMessage());
          ++failed;
        }
      }
    }
 catch (    Exception e) {
      Log.throwable(e,"String_Node_Str");
    }
  }
  Log.debug("String_Node_Str",succeeded,failed);
}

Fixed version (ground truth):
public static void trigger(RunTime time,String trigger){
  Set<Method> prepList=new HashSet<>(), testList=new HashSet<>();
  for (  Method prep : registryPrep.get(time)) {
    if (trigger.equals(prep.getAnnotation(UnitTest.class).trigger()))     prepList.add(prep);
  }
  for (  Method test : registryTests.get(time)) {
    if (trigger.equals(test.getAnnotation(UnitTest.class).trigger()))     testList.add(test);
  }
  if (prepList.isEmpty() && testList.isEmpty())   return;
  Log.debug(prefix + "String_Node_Str",prepList.size(),testList.size());
  Map<Class<?>,Object> objects=new HashMap<>();
  int succeeded=0, failed=0;
  for (  Method method : Iterables.concat(prepList,testList)) {
    try {
      Class<?> cls=method.getDeclaringClass();
      Object obj=objects.get(cls);
      if (obj == null)       objects.put(cls,obj=cls.newInstance());
      boolean isTest=testList.contains(method);
      try {
        method.invoke(obj);
        if (isTest)         ++succeeded;
      }
 catch (      InvocationTargetException e) {
        if (!isTest)         Log.throwable(e.getCause(),prefix + "String_Node_Str");
 else {
          Throwable cause=e.getCause();
          Log.error(prefix + "String_Node_Str",cls.getSimpleName(),method.getName(),cause.getStackTrace()[1].getLineNumber(),cause.getMessage());
          ++failed;
        }
      }
    }
 catch (    Exception e) {
      Log.throwable(e,prefix + "String_Node_Str");
    }
  }
  Log.debug(prefix + "String_Node_Str",succeeded,failed);
}
Program: 34695
Project: 34695
Buggy source:
@Override protected void mouseClicked(int mouseX,int mouseY,int buttonId){
  if (buttonId == 0 && achievements != null) {
    int offsetX=MathUtil.clamp(MathUtil.floor(field_146567_u),AchievementList.minDisplayColumn * 24 - 112,AchievementList.maxDisplayColumn * 24 - 78);
    int offsetY=MathUtil.clamp(MathUtil.floor(field_146566_v),AchievementList.minDisplayRow * 24 - 112,AchievementList.maxDisplayRow * 24 - 78);
    int centerX=(width - field_146555_f) / 2 + 16;
    int centerY=(height - field_146557_g) / 2 + 17;
    float realMouseX=(mouseX - centerX) * field_146570_r;
    float realMouseY=(mouseY - centerY) * field_146570_r;
    for (    Achievement achievement : achievements.getAchievements()) {
      int x=achievement.displayColumn * 24 - offsetX;
      int y=achievement.displayRow * 24 - offsetY;
      if (x >= -24 && y >= -24 && x <= 224F * field_146570_r && y <= 155F * field_146570_r && realMouseX >= x && realMouseX <= x + 22 && realMouseY >= y && realMouseY <= y + 22) {
        KnowledgeObject<? extends IKnowledgeObjectInstance<?>> obj=KnowledgeUtils.tryGetFromItemStack(achievement.theItemStack);
        if (obj != null)         CompendiumEventsClient.openCompendium(obj);
      }
    }
  }
  super.mouseClicked(mouseX,mouseY,buttonId);
}

Fixed version (ground truth):
@Override protected void mouseClicked(int mouseX,int mouseY,int buttonId) throws IOException {
  if (buttonId == 0 && achievements != null) {
    int offsetX=MathUtil.clamp(MathUtil.floor(field_146567_u),AchievementList.minDisplayColumn * 24 - 112,AchievementList.maxDisplayColumn * 24 - 78);
    int offsetY=MathUtil.clamp(MathUtil.floor(field_146566_v),AchievementList.minDisplayRow * 24 - 112,AchievementList.maxDisplayRow * 24 - 78);
    int centerX=(width - field_146555_f) / 2 + 16;
    int centerY=(height - field_146557_g) / 2 + 17;
    float realMouseX=(mouseX - centerX) * field_146570_r;
    float realMouseY=(mouseY - centerY) * field_146570_r;
    for (    Achievement achievement : achievements.getAchievements()) {
      int x=achievement.displayColumn * 24 - offsetX;
      int y=achievement.displayRow * 24 - offsetY;
      if (x >= -24 && y >= -24 && x <= 224F * field_146570_r && y <= 155F * field_146570_r && realMouseX >= x && realMouseX <= x + 22 && realMouseY >= y && realMouseY <= y + 22) {
        KnowledgeObject<? extends IKnowledgeObjectInstance<?>> obj=KnowledgeUtils.tryGetFromItemStack(achievement.theItemStack);
        if (obj != null)         CompendiumEventsClient.openCompendium(obj);
      }
    }
  }
  super.mouseClicked(mouseX,mouseY,buttonId);
}
Program: 34697
Project: 34697
Buggy source:
@Override public boolean hasEffect(ItemStack is,int pass){
  return is.getItemDamage() == 1 || super.hasEffect(is,pass);
}

Fixed version (ground truth):
@Override public boolean hasEffect(ItemStack is){
  return is.getItemDamage() == 1 || super.hasEffect(is);
}
Program: 34698
Project: 34698
Buggy source:
public BlockDeathFlowerPot(){
  setTickRandomly(true);
  setDefaultState(blockState.getBaseState().withProperty(BlockDeathFlower.DECAY,0));
}

Fixed version (ground truth):
public BlockDeathFlowerPot(){
  super(Material.circuits);
  setTickRandomly(true);
  createSimpleMeta(BlockDeathFlower.DECAY,0,15);
}
Program: 34700
Project: 34700
Buggy source:
public BlockAbstractStateInt(Material materialIn){
  super(materialIn);
}

Fixed version (ground truth):
public BlockAbstractStateInt(Material material){
  super(material);
}
Program: 34701
Project: 34701
Buggy source:
private PropertyEnumSimple(String name,Class valueClass){
  super(name,String.class);
  Set<String> valuesSetup=new HashSet<>();
  for (  Object o : valueClass.getEnumConstants()) {
    Enum e=(Enum)o;
    if (!valuesSetup.add(e.name()))     throw new IllegalArgumentException("String_Node_Str" + e + "String_Node_Str");
  }
  values=ImmutableSet.copyOf(valuesSetup);
}

Fixed version (ground truth):
private PropertyEnumSimple(String name,Class valueClass){
  super(name,String.class);
  Set<Enum> valuesSetup=new HashSet<>();
  for (  Object o : valueClass.getEnumConstants()) {
    Enum e=(Enum)o;
    if (!valuesSetup.add(e))     throw new IllegalArgumentException("String_Node_Str" + e + "String_Node_Str");
  }
  values=ImmutableSet.copyOf(valuesSetup);
}
Program: 34702
Project: 34702
Buggy source:
public EntityMobBabyEnderman(World world){
  super(world);
  setSize(0.5F,1.26F);
  stepHeight=1F;
  for (  ItemPriorityLevel level : ItemPriorityLevel.values)   itemPriorities.add(level);
  for (int a=0, index1, index2, size=itemPriorities.size(); a < rand.nextInt(20); a++) {
    index1=rand.nextInt(size);
    index2=rand.nextInt(size);
    if (index1 == index2)     continue;
    Collections.swap(itemPriorities,index1,index2);
  }
}

Fixed version (ground truth):
public EntityMobBabyEnderman(World world){
  super(world);
  EntityAIOldTarget.insertOldAI(this);
  setSize(0.5F,1.26F);
  stepHeight=1F;
  for (  ItemPriorityLevel level : ItemPriorityLevel.values)   itemPriorities.add(level);
  for (int a=0, index1, index2, size=itemPriorities.size(); a < rand.nextInt(20); a++) {
    index1=rand.nextInt(size);
    index2=rand.nextInt(size);
    if (index1 == index2)     continue;
    Collections.swap(itemPriorities,index1,index2);
  }
}
Program: 34704
Project: 34704
Buggy source:
public EntityMobEnderGuardian(World world){
  super(world);
  setSize(1.5F,3.2F);
}

Fixed version (ground truth):
public EntityMobEnderGuardian(World world){
  super(world);
  EntityAIOldTarget.insertOldAI(this);
  setSize(1.5F,3.2F);
}
Program: 34705
Project: 34705
Buggy source:
@Override protected void applyEntityAttributes(){
  super.applyEntityAttributes();
  getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.55D);
  getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(ModCommonProxy.opMobs ? 42D : 24D);
  getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(ModCommonProxy.opMobs ? 4D : 2D);
}

Fixed version (ground truth):
@Override protected void applyEntityAttributes(){
  super.applyEntityAttributes();
  getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(22D);
  getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.55D);
  getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(ModCommonProxy.opMobs ? 42D : 24D);
  getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(ModCommonProxy.opMobs ? 4D : 2D);
}
Program: 34706
Project: 34706
Buggy source:
public EntityMobFireGolem(World world){
  super(world);
  setSize(0.9F,1.4F);
  isImmuneToFire=true;
  experienceValue=8;
}

Fixed version (ground truth):
public EntityMobFireGolem(World world){
  super(world);
  EntityAIOldTarget.insertOldAI(this);
  setSize(0.9F,1.4F);
  isImmuneToFire=true;
  experienceValue=8;
}
Program: 34709
Project: 34709
Buggy source:
@Override public void onUpdate(){
  super.onUpdate();
  lifespan=Integer.MAX_VALUE;
  overrideDeath=false;
}

Fixed version (ground truth):
@Override public void onUpdate(){
  super.onUpdate();
  lifespan=Integer.MAX_VALUE;
  overrideDeath=false;
  if (posY < -60D) {
    BlockDragonEggCustom.teleportEntityToPortal(this);
    super.setDead();
  }
}
Program: 34710
Project: 34710
Buggy source:
public void forceSpecialAttack(DragonSpecialAttackBase newAttack){
  lastAttack=currentAttack;
  if (currentAttack != null)   currentAttack.end();
  currentAttack=newAttack;
  currentAttack.init();
}

Fixed version (ground truth):
public void forceSpecialAttack(DragonSpecialAttackBase newAttack){
  lastAttack=currentAttack;
  if (currentAttack != null) {
    currentAttack.end();
    nextAttackTicks=currentAttack.getNextAttackTimer();
  }
  currentAttack=newAttack;
  currentAttack.init();
}
Program: 34713
Project: 34713
Buggy source:
@Override public void update(){
  if (dragon.target != null && biteCooldown == 0) {
    if (dragon.attacks.biteClosePlayers() && ++biteCounter >= (dragon.angryStatus ? 3 : 1)) {
      dragon.trySetTarget(null);
      biteCounter=0;
    }
    biteCooldown=(byte)(dragon.angryStatus ? 7 : 9);
  }
  if (biteCooldown > 0)   --biteCooldown;
}

Fixed version (ground truth):
@Override public void update(){
  if (biteCooldown == 0 || --biteCooldown == 0) {
    if (dragon.attacks.biteClosePlayers() && ++biteCounter >= (dragon.angryStatus ? 3 : 1)) {
      dragon.trySetTarget(null);
      biteCounter=0;
    }
    biteCooldown=(byte)(dragon.angryStatus ? 7 : 9);
  }
}
Program: 34714
Project: 34714
Buggy source:
@Override public void update(){
  if (dragon.target != null && ++timer >= (24 - dragon.worldObj.difficultySetting.getDifficultyId() * 4) + (dragon.angryStatus ? 10 : 30) - ((100 - dragon.attacks.getHealthPercentage()) >> 3)) {
    if (dragon.target.getDistanceSqToEntity(dragon.dragonPartHead) > 400D) {
      dragon.shots.createNew(ShotType.FIREBALL).setTarget(dragon.target).shoot();
      timer=0;
    }
 else     --timer;
  }
 else   timer=8;
}

Fixed version (ground truth):
@Override public void update(){
  if (dragon.target == null)   timer=8;
 else   if (dragon.target != null && ++timer >= (24 - dragon.worldObj.difficultySetting.getDifficultyId() * 4) + (dragon.angryStatus ? 5 : 20) - (ModCommonProxy.opMobs ? 5 : 0) - ((100 - dragon.attacks.getHealthPercentage()) >> 4)) {
    if (dragon.target.getDistanceSqToEntity(dragon.dragonPartHead) > 400D) {
      dragon.shots.createNew(ShotType.FIREBALL).setTarget(dragon.target).shoot();
      timer=0;
    }
 else     --timer;
  }
}
Program: 34716
Project: 34716
Buggy source:
public boolean biteClosePlayers(){
  boolean res=false;
  for (  EntityPlayer player : (List<EntityPlayer>)dragon.worldObj.getEntitiesWithinAABB(EntityPlayer.class,dragon.dragonPartHead.boundingBox.expand(2.8D,2.4D,2.8D))) {
    int diff=dragon.worldObj.difficultySetting.getDifficultyId(), rm;
    player.attackEntityFrom(DamageSource.causeMobDamage(dragon),(ModCommonProxy.opMobs ? 9F : 4F) + diff);
switch (diff) {
case 3:
      rm=34;
    break;
case 2:
  rm=22;
break;
case 1:
rm=15;
break;
default :
rm=10;
}
if (dragon.worldObj.rand.nextInt(100) < rm) {
player.addPotionEffect(new PotionEffect(Potion.poison.id,180 + 25 * diff,0));
dragon.rewards.addHandicap(0.1F,false);
if (dragon.worldObj.rand.nextInt(100) < 35 + diff * 12) {
player.addPotionEffect(new PotionEffect(Potion.blindness.id,200 + 18 * diff,0));
player.addPotionEffect(new PotionEffect(Potion.confusion.id,160 + 20 * diff,0));
}
}
res=true;
}
return res;
}

Fixed version (ground truth):
public boolean biteClosePlayers(){
  boolean res=false;
  for (  EntityPlayer player : (List<EntityPlayer>)dragon.worldObj.getEntitiesWithinAABB(EntityPlayer.class,dragon.dragonPartHead.boundingBox.expand(2.2D,1.5D,2.2D))) {
    int diff=dragon.worldObj.difficultySetting.getDifficultyId(), rm;
    player.attackEntityFrom(DamageSource.causeMobDamage(dragon),(ModCommonProxy.opMobs ? 9F : 4F) + diff);
switch (diff) {
case 3:
      rm=34;
    break;
case 2:
  rm=22;
break;
case 1:
rm=15;
break;
default :
rm=10;
}
if (dragon.worldObj.rand.nextInt(100) < rm) {
player.addPotionEffect(new PotionEffect(Potion.poison.id,120 + 35 * diff,ModCommonProxy.opMobs ? 1 : 0));
dragon.rewards.addHandicap(0.1F,false);
if (dragon.worldObj.rand.nextInt(100) < 35 + diff * 12) {
player.addPotionEffect(new PotionEffect(Potion.blindness.id,160 + 24 * diff,0));
player.addPotionEffect(new PotionEffect(Potion.confusion.id,100 + 24 * diff,0));
}
}
res=true;
}
return res;
}
Program: 34717
Project: 34717
Buggy source:
private void updateEnderCrystal(){
  if (healingEnderCrystal != null) {
    if (healingEnderCrystal.isDead) {
      if (!worldObj.isRemote) {
        attackEntityFromPart(dragonPartHead,DamageSource.setExplosionSource(null),10F);
        if (target == null)         trySetTarget(attacks.getRandomPlayer());
      }
      healingEnderCrystal=null;
    }
 else     if (ticksExisted % 10 == 0 && getHealth() < getMaxHealth())     setHealth(getHealth() + (ModCommonProxy.opMobs ? 2F : 1F));
  }
  if (rand.nextInt(10) == 0) {
    float dist=30F + 4F * worldObj.difficultySetting.getDifficultyId() + (ModCommonProxy.opMobs ? 8F : 0F);
    healingEnderCrystal=DragonUtil.getClosestEntity(this,worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class,boundingBox.expand(dist,dist,dist)));
  }
}

Fixed version (ground truth):
private void updateEnderCrystal(){
  if (healingEnderCrystal != null) {
    if (healingEnderCrystal.isDead) {
      if (!worldObj.isRemote) {
        attackEntityFromPart(dragonPartHead,DamageSource.setExplosionSource(null),10F);
        if (target == null)         trySetTarget(attacks.getRandomPlayer());
      }
      healingEnderCrystal=null;
    }
 else     if (ticksExisted % 10 == 0 && getHealth() < getMaxHealth())     setHealth(getHealth() + (ModCommonProxy.opMobs ? 2F : 1F));
  }
  if (rand.nextInt(10) == 0) {
    float dist=30F + 4F * worldObj.difficultySetting.getDifficultyId() + (ModCommonProxy.opMobs ? 8F : 0F);
    healingEnderCrystal=DragonUtil.getClosestEntity(this,(List<EntityEnderCrystal>)worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class,boundingBox.expand(dist,dist,dist)));
  }
}
Program: 34719
Project: 34719
Buggy source:
public static <T extends Entity>T getClosestEntity(Entity source,List<T> list){
  double closestDist=Double.MAX_VALUE, currentDist;
  Entity closestEntity=null;
  for (  Entity entity : list) {
    if (!entity.isDead && (currentDist=source.getDistanceSqToEntity(entity)) < closestDist) {
      closestDist=currentDist;
      closestEntity=entity;
    }
  }
  return (T)closestEntity;
}

Fixed version (ground truth):
public static <T extends Entity>T getClosestEntity(Entity source,List<? extends T> list){
  double closestDist=Double.MAX_VALUE, currentDist;
  Entity closestEntity=null;
  for (  Entity entity : list) {
    if (!entity.isDead && (currentDist=source.getDistanceSqToEntity(entity)) < closestDist) {
      closestDist=currentDist;
      closestEntity=entity;
    }
  }
  return (T)closestEntity;
}
Program: 34720
Project: 34720
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack is,World world,EntityPlayer player){
  if (!world.isRemote) {
    CurseType type=CurseType.getFromDamage(is.getItemDamage());
    if (type == null)     return is;
    world.spawnEntityInWorld(new EntityProjectileCurse(world,player,type,CurseType.isEternal(is.getItemDamage())));
  }
  if (!player.capabilities.isCreativeMode)   --is.stackSize;
  return is;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack is,World world,EntityPlayer player){
  if (!world.isRemote) {
    CurseType type=CurseType.getFromDamage(is.getItemDamage());
    if (type == null)     return is;
    world.spawnEntityInWorld(new EntityProjectileCurse(world,player,is,type,CurseType.isEternal(is.getItemDamage())));
  }
  if (!player.capabilities.isCreativeMode)   --is.stackSize;
  return is;
}
Program: 34721
Project: 34721
Buggy source:
public void addElementAt(int chunkX,int chunkZ,WorldGenElement element){
  elements.put(getFromChunkPos(chunkX,chunkZ),element);
}

Fixed version (ground truth):
public void addElementAt(int chunkX,int chunkZ,WorldGenElement element){
  elements.put(getFromChunkPos(chunkX,chunkZ),element);
  setModified();
}
Program: 34722
Project: 34722
Buggy source:
@Override protected void onSave(NBTTagCompound nbt){
}

Fixed version (ground truth):
@Override protected void onSave(NBTTagCompound nbt){
  TByteObjectHashMap<NBTTagList> saved=new TByteObjectHashMap<>();
  byte ord;
  for (TLongObjectIterator<WorldGenElement> iter=elements.iterator(); iter.hasNext(); iter.advance()) {
    ord=(byte)iter.value().ordinal();
    if (!saved.containsKey(ord))     saved.put(ord,new NBTTagList());
    saved.get(ord).appendTag(new NBTTagDouble(Double.longBitsToDouble(iter.key())));
  }
  for (TByteObjectIterator<NBTTagList> iter=saved.iterator(); iter.hasNext(); iter.advance()) {
    nbt.setTag(String.valueOf(iter.key()),iter.value());
  }
}
Program: 34723
Project: 34723
Buggy source:
public boolean isAreaBlocked(int chunkX,int chunkZ,WorldGenElement element){
  for (TLongIterator iter=elements.keySet().iterator(); iter.hasNext(); ) {
    long pos=iter.next();
    WorldGenElement ele=elements.get(pos);
    if (Math.abs(getX(pos) - chunkX) <= ele.rad + element.rad && Math.abs(getZ(pos) - chunkZ) <= ele.rad + element.rad) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isAreaBlocked(int chunkX,int chunkZ,WorldGenElement element){
  for (TLongObjectIterator<WorldGenElement> iter=elements.iterator(); iter.hasNext(); iter.advance()) {
    if (Math.abs(getX(iter.key()) - chunkX) <= iter.value().rad + element.rad && Math.abs(getZ(iter.key()) - chunkZ) <= iter.value().rad + element.rad) {
      return true;
    }
  }
  return false;
}
Program: 34724
Project: 34724
Buggy source:
@Override protected void onLoad(NBTTagCompound nbt){
}

Fixed version (ground truth):
@Override protected void onLoad(NBTTagCompound nbt){
  WorldGenElement[] vals=WorldGenElement.values();
  for (int a=0; a < vals.length; a++) {
    NBTTagList list=nbt.getTagList(String.valueOf(a),NBT.TAG_LONG);
    for (int index=0; index < list.tagCount(); index++) {
      elements.put(Double.doubleToLongBits(list.func_150309_d(index)),vals[a]);
    }
  }
}
Program: 34725
Project: 34725
Buggy source:
private final long getFromChunkPos(int x,int z){
  if (x >= -1875000 && z >= -1875000 && x < 1875000 && z < 1875000)   return ((x + 1875000) << 24) | (z + 1875000);
 else   return Long.MIN_VALUE;
}

Fixed version (ground truth):
private final long getFromChunkPos(int x,int z){
  if (x >= -1875000 && z >= -1875000 && x < 1875000 && z < 1875000)   return ((x + 1875000) << 24) | (z + 1875000);
 else   return Long.MAX_VALUE;
}
Program: 34726
Project: 34726
Buggy source:
public ComponentIsland(Random rand,int x,int z){
  super(rand,x,20,z,208,140,208);
  this.startX=x;
  this.startZ=z;
  coordBaseMode=0;
  boundingBox=new StructureBoundingBox(x,20,z,x + sizeX - 1,140 + sizeY - 1,z + sizeZ - 1);
  structure=new LargeStructureWorld(this);
}

Fixed version (ground truth):
public ComponentIsland(Random rand,int x,int z){
  super(rand,x,20,z,208,140,208);
  this.startX=x;
  this.startZ=z;
  coordBaseMode=0;
  boundingBox=new StructureBoundingBox(x,20,z,x + sizeX - 1,140 + sizeY - 1,z + sizeZ - 1);
  structure=new LargeStructureWorld(this);
  WorldDataHandler.<WorldGenSavefile>get(WorldGenSavefile.class).addElementAt(startX >> 4,startZ >> 4,WorldGenElement.BIOME_ISLAND);
}
Program: 34727
Project: 34727
Buggy source:
protected ComponentTower(Random rand,int x,int z){
  super(rand,x,32,z,32,140,32);
  startX=x;
  startZ=z;
}

Fixed version (ground truth):
protected ComponentTower(Random rand,int x,int z){
  super(rand,x,32,z,32,140,32);
  startX=x;
  startZ=z;
  WorldDataHandler.<WorldGenSavefile>get(WorldGenSavefile.class).addElementAt(startX >> 4,startZ >> 4,WorldGenElement.DUNGEON_TOWER);
}
Program: 34728
Project: 34728
Buggy source:
@Override protected boolean canStructureSpawn(int x,int z,Random rand){
  ChunkPosition island=worldObj.getChunkProvider().func_147416_a(worldObj,"String_Node_Str",x * 16,50,z * 16);
  return island == null || MathUtil.distance(x * 16 - island.chunkPosX,z * 16 - island.chunkPosZ) > 170;
}

Fixed version (ground truth):
@Override protected boolean canStructureSpawn(int x,int z,Random rand){
  return !WorldDataHandler.<WorldGenSavefile>get(WorldGenSavefile.class).isAreaBlocked(x >> 4,z >> 4,WorldGenElement.DUNGEON_TOWER);
}
Program: 34731
Project: 34731
Buggy source:
private boolean teleportTo(double x,double y,double z,boolean ignoreChecks){
  if (prevTeleportAttempt != null)   return prevTeleportAttempt.booleanValue();
 else   if (!(prevTeleportAttempt=Boolean.valueOf(canTeleport())))   return false;
  double oldX=posX, oldY=posY, oldZ=posZ;
  posX=x;
  posY=y;
  posZ=z;
  boolean hasTeleported=false;
  int ix=MathHelper.floor_double(posX), iy=MathHelper.floor_double(posY), iz=MathHelper.floor_double(posZ);
  if (worldObj.blockExists(ix,iy,iz)) {
    boolean foundTopBlock=ignoreChecks;
    while (!foundTopBlock && iy > 0) {
      if (worldObj.getBlock(ix,iy - 1,iz).getMaterial().blocksMovement())       foundTopBlock=true;
 else {
        --posY;
        --iy;
      }
    }
    if (foundTopBlock) {
      setPosition(posX,posY,posZ);
      if ((worldObj.getCollidingBoundingBoxes(this,boundingBox).isEmpty() && !worldObj.isAnyLiquid(boundingBox)) || ignoreChecks) {
        hasTeleported=true;
      }
    }
  }
  if (!hasTeleported) {
    setPosition(oldX,oldY,oldZ);
    return false;
  }
 else {
    if (!worldObj.isRemote)     PacketPipeline.sendToAllAround(this,256D,new C22EffectLine(FXType.Line.ENDERMAN_TELEPORT,oldX,oldY,oldZ,posX,posY,posZ));
    return true;
  }
}

Fixed version (ground truth):
private boolean teleportTo(double x,double y,double z,boolean ignoreChecks){
  if (prevTeleportAttempt != null)   return prevTeleportAttempt.booleanValue();
 else   if (!(prevTeleportAttempt=Boolean.valueOf(canTeleport())))   return false;
  double oldX=posX, oldY=posY, oldZ=posZ;
  posX=x;
  posY=y;
  posZ=z;
  boolean hasTeleported=false;
  int ix=MathHelper.floor_double(posX), iy=MathHelper.floor_double(posY), iz=MathHelper.floor_double(posZ);
  if (worldObj.blockExists(ix,iy,iz) || ignoreChecks) {
    boolean foundTopBlock=ignoreChecks;
    while (!foundTopBlock && iy > 0) {
      if (worldObj.getBlock(ix,iy - 1,iz).getMaterial().blocksMovement())       foundTopBlock=true;
 else {
        --posY;
        --iy;
      }
    }
    if (foundTopBlock) {
      setPosition(posX,posY,posZ);
      if ((worldObj.getCollidingBoundingBoxes(this,boundingBox).isEmpty() && !worldObj.isAnyLiquid(boundingBox)) || ignoreChecks) {
        hasTeleported=true;
      }
    }
  }
  if (!hasTeleported) {
    setPosition(oldX,oldY,oldZ);
    return false;
  }
 else {
    if (!worldObj.isRemote && !ignoreChecks)     PacketPipeline.sendToAllAround(this,256D,new C22EffectLine(FXType.Line.ENDERMAN_TELEPORT,oldX,oldY,oldZ,posX,posY,posZ));
    return true;
  }
}