nus-yam/ex-repair huggingface dataset:
Program: 12627
Project: 12627
Buggy source:
@Override public boolean onBlockActivated(World worldIn,BlockPos pos,IBlockState state,EntityPlayer playerIn,EnumHand hand,EnumFacing facing,float hitX,float hitY,float hitZ){
  if (!worldIn.isRemote) {
    ItemStack stack=playerIn.getHeldItem(hand);
    if (!ItemStackUtil.isEmpty(stack) && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY,null)) {
      TileBloodContainer bloodContainer=(TileBloodContainer)worldIn.getTileEntity(pos);
      IFluidHandler source=bloodContainer.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null);
      if (playerIn.isSneaking()) {
        FluidActionResult result=FluidUtil.tryFillContainer(stack,source,Integer.MAX_VALUE,playerIn,true);
        if (result.isSuccess()) {
          playerIn.setHeldItem(hand,result.getResult());
        }
      }
 else {
        FluidActionResult result=FluidUtil.tryEmptyContainer(stack,source,Integer.MAX_VALUE,playerIn,true);
        if (result.isSuccess()) {
          playerIn.setHeldItem(hand,result.getResult());
        }
      }
      worldIn.notifyBlockUpdate(pos,state,state,3);
      bloodContainer.markDirty();
      return true;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World worldIn,BlockPos pos,IBlockState state,EntityPlayer playerIn,EnumHand hand,EnumFacing facing,float hitX,float hitY,float hitZ){
  if (!worldIn.isRemote) {
    ItemStack stack=playerIn.getHeldItem(hand);
    if (!ItemStackUtil.isEmpty(stack) && FluidLib.hasFluidItemCap(stack)) {
      TileBloodContainer bloodContainer=(TileBloodContainer)worldIn.getTileEntity(pos);
      IFluidHandler source=bloodContainer.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null);
      if (playerIn.isSneaking()) {
        FluidActionResult result=FluidUtil.tryFillContainer(stack,source,Integer.MAX_VALUE,playerIn,true);
        if (result.isSuccess()) {
          playerIn.setHeldItem(hand,result.getResult());
        }
      }
 else {
        FluidActionResult result=FluidUtil.tryEmptyContainer(stack,source,Integer.MAX_VALUE,playerIn,true);
        if (result.isSuccess()) {
          playerIn.setHeldItem(hand,result.getResult());
        }
      }
      worldIn.notifyBlockUpdate(pos,state,state,3);
      bloodContainer.markDirty();
      return true;
    }
  }
  return true;
}
Program: 12628
Project: 12628
Buggy source:
@Nullable @Override public FluidStack isValidFluidItem(@Nonnull ItemStack stack){
  if (fluidStack == null)   return null;
  if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null)) {
    IFluidHandler handler=stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null);
    FluidStack drained=handler.drain(fluidStack,false);
    if (drained == null || !drained.isFluidStackIdentical(fluidStack)) {
      return null;
    }
    return fluidStack.copy();
  }
  return null;
}

Fixed version (ground truth):
@Nullable @Override public FluidStack isValidFluidItem(@Nonnull ItemStack stack){
  if (fluidStack == null)   return null;
  if (FluidLib.hasFluidItemCap(stack)) {
    IFluidHandler handler=FluidLib.getFluidItemCap(stack);
    FluidStack drained=handler.drain(fluidStack,false);
    if (drained == null || !drained.isFluidStackIdentical(fluidStack)) {
      return null;
    }
    return fluidStack.copy();
  }
  return null;
}
Program: 12629
Project: 12629
Buggy source:
/** 
 * @return The liquid color of the given stack. -1 if not a (registered) liquid stack
 */
private static int getLiquidColor(ItemStack s){
  if (s != null) {
    if (s.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null)) {
      IFluidHandler handler=s.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null);
      FluidStack fluid=handler.drain(10000,false);
      if (fluid != null) {
        return getFluidColor(fluid);
      }
    }
  }
  return AlchemicalCauldronCraftingManager.getInstance().getLiquidColor(s);
}

Fixed version (ground truth):
/** 
 * @return The liquid color of the given stack. -1 if not a (registered) liquid stack
 */
private static int getLiquidColor(ItemStack s){
  if (s != null) {
    if (FluidLib.hasFluidItemCap(s)) {
      IFluidHandler handler=FluidLib.getFluidItemCap(s);
      FluidStack fluid=handler.drain(10000,false);
      if (fluid != null) {
        return getFluidColor(fluid);
      }
    }
  }
  return AlchemicalCauldronCraftingManager.getInstance().getLiquidColor(s);
}
Program: 12630
Project: 12630
Buggy source:
private void finishCooking(){
  if (canCook()) {
    IAlchemicalCauldronRecipe recipe=AlchemicalCauldronCraftingManager.getInstance().findRecipe(getStackInSlot(SLOT_LIQUID),getStackInSlot(SLOT_INGREDIENT));
    if (!isStackInSlot(SLOT_RESULT)) {
      setInventorySlotContents(SLOT_RESULT,recipe.getOutput().copy());
    }
 else     if (getStackInSlot(SLOT_RESULT).isItemEqual(recipe.getOutput())) {
      ItemStackUtil.grow(getStackInSlot(SLOT_RESULT),ItemStackUtil.getCount(recipe.getOutput()));
    }
    if (recipe.isValidLiquidItem(getStackInSlot(SLOT_LIQUID))) {
      decrStackSize(SLOT_LIQUID,1);
    }
 else {
      ItemStack fluidContainer=getStackInSlot(SLOT_LIQUID);
      FluidStack s=recipe.isValidFluidItem(fluidContainer);
      if (s != null) {
        IFluidHandler handler=fluidContainer.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,null);
        handler.drain(s,true);
      }
 else {
        VampirismMod.log.w("String_Node_Str","String_Node_Str",recipe,fluidContainer);
      }
    }
    decrStackSize(SLOT_INGREDIENT,1);
  }
}

Fixed version (ground truth):
private void finishCooking(){
  if (canCook()) {
    IAlchemicalCauldronRecipe recipe=AlchemicalCauldronCraftingManager.getInstance().findRecipe(getStackInSlot(SLOT_LIQUID),getStackInSlot(SLOT_INGREDIENT));
    if (!isStackInSlot(SLOT_RESULT)) {
      setInventorySlotContents(SLOT_RESULT,recipe.getOutput().copy());
    }
 else     if (getStackInSlot(SLOT_RESULT).isItemEqual(recipe.getOutput())) {
      ItemStackUtil.grow(getStackInSlot(SLOT_RESULT),ItemStackUtil.getCount(recipe.getOutput()));
    }
    if (recipe.isValidLiquidItem(getStackInSlot(SLOT_LIQUID))) {
      decrStackSize(SLOT_LIQUID,1);
    }
 else {
      ItemStack fluidContainer=getStackInSlot(SLOT_LIQUID);
      FluidStack s=recipe.isValidFluidItem(fluidContainer);
      if (s != null) {
        IFluidHandler handler=FluidLib.getFluidItemCap(fluidContainer);
        handler.drain(s,true);
      }
 else {
        VampirismMod.log.w("String_Node_Str","String_Node_Str",recipe,fluidContainer);
      }
    }
    decrStackSize(SLOT_INGREDIENT,1);
  }
}
Program: 12631
Project: 12631
Buggy source:
/** 
 * Can be overridden to use other items as arrows. Could cause problems though.
 */
protected boolean isArrow(@Nullable ItemStack stack){
  return !ItemStackUtil.isEmpty(stack) && stack.getItem() instanceof ItemCrossbowArrow;
}

Fixed version (ground truth):
/** 
 * Can be overridden to use other items as arrows. Could cause problems though.
 */
protected boolean isArrow(@Nonnull ItemStack stack){
  return !ItemStackUtil.isEmpty(stack) && stack.getItem() instanceof ItemCrossbowArrow;
}
Program: 12632
Project: 12632
Buggy source:
/** 
 * Searches Offhand,Mainhand and the inventory afterwards for arrows
 * @param player
 * @param bowStack The itemstack of the bow
 * @return The itemstack of the arrows or null
 */
protected @Nullable ItemStack findAmmo(EntityPlayer player,ItemStack bowStack){
  if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND))) {
    return player.getHeldItem(EnumHand.OFF_HAND);
  }
 else   if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) {
    return player.getHeldItem(EnumHand.MAIN_HAND);
  }
 else {
    for (int i=0; i < player.inventory.getSizeInventory(); ++i) {
      ItemStack itemstack=player.inventory.getStackInSlot(i);
      if (this.isArrow(itemstack)) {
        return itemstack;
      }
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Searches Offhand,Mainhand and the inventory afterwards for arrows
 * @param player
 * @param bowStack The itemstack of the bow
 * @return The itemstack of the arrows or null
 */
protected @Nonnull ItemStack findAmmo(EntityPlayer player,ItemStack bowStack){
  if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND))) {
    return player.getHeldItem(EnumHand.OFF_HAND);
  }
 else   if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) {
    return player.getHeldItem(EnumHand.MAIN_HAND);
  }
 else {
    for (int i=0; i < player.inventory.getSizeInventory(); ++i) {
      ItemStack itemstack=player.inventory.getStackInSlot(i);
      if (this.isArrow(itemstack)) {
        return itemstack;
      }
    }
    return ItemStack.EMPTY;
  }
}
Program: 12633
Project: 12633
Buggy source:
/** 
 * Checks if stackA contains stackB True if A !=null and B == null
 */
public static boolean doesStackContain(@Nonnull ItemStack stackA,@Nonnull ItemStack stackB){
  return !stackA.isEmpty() && (stackB.isEmpty() || (areStacksEqualIgnoreAmount(stackA,stackB) && stackA.getCount() >= stackB.getCount()));
}

Fixed version (ground truth):
/** 
 * Checks if stackA contains stackB True if A !=null and B == null
 */
public static boolean doesStackContain(@Nonnull ItemStack stackA,@Nonnull ItemStack stackB){
  return (stackB.isEmpty() || !stackA.isEmpty() && (areStacksEqualIgnoreAmount(stackA,stackB) && stackA.getCount() >= stackB.getCount()));
}
Program: 12634
Project: 12634
Buggy source:
@Override public void update(){
  boolean wasBurning=isBurning();
  boolean wasCooking=cookTime > 0;
  boolean dirty=false;
  if (wasBurning) {
    burnTime--;
  }
  if (!world.isRemote) {
    if (isBurning() || isStackInSlot(SLOT_LIQUID) && isStackInSlot(SLOT_INGREDIENT) && isStackInSlot(SLOT_FUEL)) {
      if (!isBurning() && canCook()) {
        this.burnTime=TileEntityFurnace.getItemBurnTime(getStackInSlot(SLOT_FUEL));
        if (isBurning()) {
          decrStackSize(SLOT_FUEL,1);
          dirty=true;
        }
        totalBurnTime=burnTime;
      }
      if (isBurning() && this.canCook()) {
        cookTime++;
        if (cookTime >= totalCookTime) {
          cookTime=0;
          this.totalCookTime=getCookTime();
          this.finishCooking();
          dirty=true;
        }
      }
 else {
        cookTime=0;
      }
    }
 else     if (!isBurning() && this.cookTime > 0) {
      this.cookTime=MathHelper.clamp(this.cookTime - 2,0,this.totalCookTime);
    }
    if (wasBurning != this.isBurning()) {
      dirty=true;
    }
 else     if (wasCooking != this.cookTime > 0) {
      dirty=true;
    }
  }
 else {
    if (isCooking() && boilingSound == null && this.world.rand.nextInt(25) == 0) {
      boilingSound=VampLib.proxy.createSoundReference(ModSounds.boiling,SoundCategory.BLOCKS,getPos(),0.015F,7);
      boilingSound.startPlaying();
    }
 else     if (!isCooking() && boilingSound != null) {
      boilingSound.stopPlaying();
      boilingSound=null;
    }
  }
  if (dirty) {
    this.markDirty(true);
  }
}

Fixed version (ground truth):
@Override public void update(){
  boolean wasBurning=isBurning();
  boolean wasCooking=cookTime > 0;
  boolean dirty=false;
  if (wasBurning) {
    burnTime--;
  }
  if (!world.isRemote) {
    if (isBurning() || isStackInSlot(SLOT_LIQUID) && isStackInSlot(SLOT_FUEL)) {
      if (!isBurning() && canCook()) {
        this.burnTime=TileEntityFurnace.getItemBurnTime(getStackInSlot(SLOT_FUEL));
        if (isBurning()) {
          decrStackSize(SLOT_FUEL,1);
          dirty=true;
        }
        totalBurnTime=burnTime;
      }
      if (isBurning() && this.canCook()) {
        cookTime++;
        if (cookTime >= totalCookTime) {
          cookTime=0;
          this.totalCookTime=getCookTime();
          this.finishCooking();
          dirty=true;
        }
      }
 else {
        cookTime=0;
      }
    }
 else     if (!isBurning() && this.cookTime > 0) {
      this.cookTime=MathHelper.clamp(this.cookTime - 2,0,this.totalCookTime);
    }
    if (wasBurning != this.isBurning()) {
      dirty=true;
    }
 else     if (wasCooking != this.cookTime > 0) {
      dirty=true;
    }
  }
 else {
    if (isCooking() && boilingSound == null && this.world.rand.nextInt(25) == 0) {
      boilingSound=VampLib.proxy.createSoundReference(ModSounds.boiling,SoundCategory.BLOCKS,getPos(),0.015F,7);
      boilingSound.startPlaying();
    }
 else     if (!isCooking() && boilingSound != null) {
      boilingSound.stopPlaying();
      boilingSound=null;
    }
  }
  if (dirty) {
    this.markDirty(true);
  }
}
Program: 12635
Project: 12635
Buggy source:
private void finishCooking(){
  if (canCook()) {
    IAlchemicalCauldronRecipe recipe=AlchemicalCauldronCraftingManager.getInstance().findRecipe(getStackInSlot(SLOT_LIQUID),getStackInSlot(SLOT_INGREDIENT));
    if (!isStackInSlot(SLOT_RESULT)) {
      setInventorySlotContents(SLOT_RESULT,recipe.getOutput().copy());
    }
 else     if (getStackInSlot(SLOT_RESULT).isItemEqual(recipe.getOutput())) {
      ItemStackUtil.grow(getStackInSlot(SLOT_RESULT),ItemStackUtil.getCount(recipe.getOutput()));
    }
    if (recipe.isValidLiquidItem(getStackInSlot(SLOT_LIQUID))) {
      decrStackSize(SLOT_LIQUID,1);
    }
 else {
      ItemStack fluidContainer=getStackInSlot(SLOT_LIQUID);
      FluidStack s=recipe.isValidFluidItem(fluidContainer);
      if (s != null) {
        IFluidHandler handler=FluidLib.getFluidItemCap(fluidContainer);
        handler.drain(s,true);
      }
 else {
        VampirismMod.log.w("String_Node_Str","String_Node_Str",recipe,fluidContainer);
      }
    }
    decrStackSize(SLOT_INGREDIENT,1);
  }
}

Fixed version (ground truth):
private void finishCooking(){
  if (canCook()) {
    IAlchemicalCauldronRecipe recipe=AlchemicalCauldronCraftingManager.getInstance().findRecipe(getStackInSlot(SLOT_LIQUID),getStackInSlot(SLOT_INGREDIENT));
    if (!isStackInSlot(SLOT_RESULT)) {
      setInventorySlotContents(SLOT_RESULT,recipe.getOutput().copy());
    }
 else     if (getStackInSlot(SLOT_RESULT).isItemEqual(recipe.getOutput())) {
      ItemStackUtil.grow(getStackInSlot(SLOT_RESULT),ItemStackUtil.getCount(recipe.getOutput()));
    }
    if (recipe.isValidLiquidItem(getStackInSlot(SLOT_LIQUID))) {
      decrStackSize(SLOT_LIQUID,1);
    }
 else {
      ItemStack fluidContainer=getStackInSlot(SLOT_LIQUID);
      FluidStack s=recipe.isValidFluidItem(fluidContainer);
      if (s != null) {
        IFluidHandlerItem handler=(IFluidHandlerItem)FluidLib.getFluidItemCap(fluidContainer);
        handler.drain(s,true);
        setInventorySlotContents(SLOT_LIQUID,handler.getContainer());
      }
 else {
        VampirismMod.log.w("String_Node_Str","String_Node_Str",recipe,fluidContainer);
      }
    }
    decrStackSize(SLOT_INGREDIENT,1);
  }
}
Program: 12636
Project: 12636
Buggy source:
public static boolean doesBlockHaveSolidTopSurface(World worldIn,BlockPos pos){
  return worldIn.getBlockState(pos.down()).isSideSolid(worldIn,pos,EnumFacing.UP) && worldIn.getBlockState(pos).getMaterial().isSolid() && !worldIn.getBlockState(pos.up()).getMaterial().isSolid();
}

Fixed version (ground truth):
public static boolean doesBlockHaveSolidTopSurface(World worldIn,BlockPos pos){
  return worldIn.getBlockState(pos).isSideSolid(worldIn,pos,EnumFacing.UP);
}
Program: 12638
Project: 12638
Buggy source:
private void registerNBTSubtypes(ISubtypeRegistry registry){
  registry.useNbtForSubtypes(ModItems.armorOfSwiftness_boots,ModItems.armorOfSwiftness_chest,ModItems.armorOfSwiftness_helmet,ModItems.armorOfSwiftness_legs);
  registry.useNbtForSubtypes(ModItems.hunterAxe);
  registry.useNbtForSubtypes(ModItems.hunterCoat_boots,ModItems.hunterCoat_chest,ModItems.hunterCoat_helmet,ModItems.hunterCoat_legs);
  registry.useNbtForSubtypes(ModItems.obsidianArmor_boots,ModItems.armorOfSwiftness_chest,ModItems.obsidianArmor_legs,ModItems.obsidianArmor_helmet);
  registry.useNbtForSubtypes(ModItems.holyWaterBottle);
}

Fixed version (ground truth):
private void registerNBTSubtypes(ISubtypeRegistry registry){
  registry.useNbtForSubtypes(ModItems.armorOfSwiftness_boots,ModItems.armorOfSwiftness_chest,ModItems.armorOfSwiftness_helmet,ModItems.armorOfSwiftness_legs);
  registry.useNbtForSubtypes(ModItems.hunterAxe);
  registry.useNbtForSubtypes(ModItems.hunterCoat_boots,ModItems.hunterCoat_chest,ModItems.hunterCoat_helmet,ModItems.hunterCoat_legs);
  registry.useNbtForSubtypes(ModItems.obsidianArmor_boots,ModItems.obsidianArmor_chest,ModItems.obsidianArmor_legs,ModItems.obsidianArmor_helmet);
  registry.useNbtForSubtypes(ModItems.holyWaterBottle);
}
Program: 12639
Project: 12639
Buggy source:
@SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event){
  if (event.isWasDeath()) {
    for (int i=0; i < listeners.length; i++) {
      ((IPlayerEventListener)event.getEntity().getCapability(listeners[i],null)).onPlayerClone(event.getOriginal());
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event){
  for (int i=0; i < listeners.length; i++) {
    ((IPlayerEventListener)event.getEntity().getCapability(listeners[i],null)).onPlayerClone(event.getOriginal(),event.isWasDeath());
  }
}
Program: 12640
Project: 12640
Buggy source:
void onPlayerClone(EntityPlayer original);

Fixed version (ground truth):
void onPlayerClone(EntityPlayer original,boolean wasDeath);
Program: 12641
Project: 12641
Buggy source:
@Override public void onPlayerClone(EntityPlayer original){
  copyFrom(original);
}

Fixed version (ground truth):
@Override public void onPlayerClone(EntityPlayer original,boolean wasDeath){
  copyFrom(original);
}
Program: 12642
Project: 12642
Buggy source:
@SubscribeEvent public void handleInputEvent(InputEvent event){
  KEY keyPressed=getPressedKeyBinding();
  if (keyPressed == KEY.SUCK) {
    RayTraceResult mouseOver=Minecraft.getMinecraft().objectMouseOver;
    if (mouseOver != null && mouseOver.entityHit != null) {
      VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.SUCKBLOOD,"String_Node_Str" + mouseOver.entityHit.getEntityId()));
    }
  }
 else   if (keyPressed == KEY.ACTION) {
    EntityPlayer player=Minecraft.getMinecraft().thePlayer;
    if (FactionPlayerHandler.get(player).getCurrentFaction() != null) {
      player.openGui(VampirismMod.instance,ModGuiHandler.ID_ACTION,player.worldObj,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ());
    }
  }
 else   if (keyPressed == KEY.SKILL) {
    EntityPlayer player=Minecraft.getMinecraft().thePlayer;
    if (FactionPlayerHandler.get(player).getCurrentFaction() != null) {
      player.openGui(VampirismMod.instance,ModGuiHandler.ID_SKILL,player.worldObj,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ());
    }
  }
 else   if (keyPressed == KEY.VISION) {
    VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.VAMPIRE_VISION_TOGGLE,"String_Node_Str"));
  }
 else   if (keyPressed == KEY.BLOOD_POTION) {
    VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.OPEN_BLOOD_POTION,"String_Node_Str"));
  }
}

Fixed version (ground truth):
@SubscribeEvent public void handleInputEvent(InputEvent event){
  KEY keyPressed=getPressedKeyBinding();
  if (keyPressed == KEY.SUCK) {
    RayTraceResult mouseOver=Minecraft.getMinecraft().objectMouseOver;
    if (mouseOver != null && mouseOver.entityHit != null && !Minecraft.getMinecraft().thePlayer.isSpectator()) {
      VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.SUCKBLOOD,"String_Node_Str" + mouseOver.entityHit.getEntityId()));
    }
  }
 else   if (keyPressed == KEY.ACTION) {
    EntityPlayer player=Minecraft.getMinecraft().thePlayer;
    if (FactionPlayerHandler.get(player).getCurrentFaction() != null) {
      player.openGui(VampirismMod.instance,ModGuiHandler.ID_ACTION,player.worldObj,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ());
    }
  }
 else   if (keyPressed == KEY.SKILL) {
    EntityPlayer player=Minecraft.getMinecraft().thePlayer;
    if (FactionPlayerHandler.get(player).getCurrentFaction() != null) {
      player.openGui(VampirismMod.instance,ModGuiHandler.ID_SKILL,player.worldObj,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ());
    }
  }
 else   if (keyPressed == KEY.VISION) {
    VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.VAMPIRE_VISION_TOGGLE,"String_Node_Str"));
  }
 else   if (keyPressed == KEY.BLOOD_POTION) {
    VampirismMod.dispatcher.sendToServer(new InputEventPacket(InputEventPacket.OPEN_BLOOD_POTION,"String_Node_Str"));
  }
}
Program: 12643
Project: 12643
Buggy source:
@SubscribeEvent public void onRenderCrosshair(RenderGameOverlayEvent.Pre event){
  if (event.getType() != RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
    return;
  }
  RayTraceResult p=Minecraft.getMinecraft().objectMouseOver;
  if (p != null && p.typeOfHit == RayTraceResult.Type.ENTITY && p.entityHit != null) {
    IVampirePlayer player=VampirePlayer.get(mc.thePlayer);
    if (player.getLevel() > 0) {
      Entity entity=p.entityHit;
      IBiteableEntity biteable=null;
      if (entity instanceof EntityCreature) {
        biteable=ExtendedCreature.get((EntityCreature)entity);
      }
 else       if (entity instanceof IBiteableEntity) {
        biteable=(IBiteableEntity)entity;
      }
 else       if (entity instanceof EntityPlayer) {
        biteable=VampirePlayer.get((EntityPlayer)entity);
      }
      if (biteable != null && biteable.canBeBitten(player)) {
        this.mc.getTextureManager().bindTexture(icons);
        int left=event.getResolution().getScaledWidth() / 2 - 8;
        int top=event.getResolution().getScaledHeight() / 2 - 4;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(1F,0F,0F,0.8F);
        drawTexturedModalRect(left,top,27,0,16,16);
        GL11.glColor4f(1F,1F,1F,1F);
        GL11.glDisable(GL11.GL_BLEND);
        event.setCanceled(true);
      }
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onRenderCrosshair(RenderGameOverlayEvent.Pre event){
  if (event.getType() != RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
    return;
  }
  RayTraceResult p=Minecraft.getMinecraft().objectMouseOver;
  if (p != null && p.typeOfHit == RayTraceResult.Type.ENTITY && p.entityHit != null) {
    IVampirePlayer player=VampirePlayer.get(mc.thePlayer);
    if (player.getLevel() > 0 && !mc.thePlayer.isSpectator()) {
      Entity entity=p.entityHit;
      IBiteableEntity biteable=null;
      if (entity instanceof EntityCreature) {
        biteable=ExtendedCreature.get((EntityCreature)entity);
      }
 else       if (entity instanceof IBiteableEntity) {
        biteable=(IBiteableEntity)entity;
      }
 else       if (entity instanceof EntityPlayer) {
        biteable=VampirePlayer.get((EntityPlayer)entity);
      }
      if (biteable != null && biteable.canBeBitten(player)) {
        this.mc.getTextureManager().bindTexture(icons);
        int left=event.getResolution().getScaledWidth() / 2 - 8;
        int top=event.getResolution().getScaledHeight() / 2 - 4;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(1F,0F,0F,0.8F);
        drawTexturedModalRect(left,top,27,0,16,16);
        GL11.glColor4f(1F,1F,1F,1F);
        GL11.glDisable(GL11.GL_BLEND);
        event.setCanceled(true);
      }
    }
  }
}
Program: 12644
Project: 12644
Buggy source:
@Override public boolean canBeBitten(IVampire biter){
  return true;
}

Fixed version (ground truth):
@Override public boolean canBeBitten(IVampire biter){
  return !(player.isSpectator() || player.isCreative());
}
Program: 12645
Project: 12645
Buggy source:
/** 
 * Checks if the entity can get sundamage at it's current position. It is recommend to cache the value for a few ticks.
 * @param entity
 * @return
 */
public static boolean gettingSundamge(EntityLivingBase entity){
  if (entity.worldObj != null) {
    entity.worldObj.theProfiler.startSection("String_Node_Str");
    if (VampirismAPI.sundamageRegistry().getSundamageInDim(entity.worldObj.provider.getDimension())) {
      if (!entity.worldObj.isRaining()) {
        float angle=entity.worldObj.getCelestialAngle(1.0F);
        if (angle > 0.78 || angle < 0.24) {
          BlockPos pos=new BlockPos(entity.posX + 0.5,entity.posY + 0,entity.posZ + 0.5);
          if (entity.worldObj.canBlockSeeSky(pos)) {
            ResourceLocation biomeID=null;
            try {
              biomeID=entity.worldObj.getBiomeGenForCoords(pos).getRegistryName();
              if (VampirismAPI.sundamageRegistry().getSundamageInBiome(biomeID)) {
                entity.worldObj.theProfiler.endSection();
                return true;
              }
            }
 catch (            NullPointerException e) {
            }
          }
        }
      }
    }
    entity.worldObj.theProfiler.endSection();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the entity can get sundamage at it's current position. It is recommend to cache the value for a few ticks.
 * @param entity
 * @return
 */
public static boolean gettingSundamge(EntityLivingBase entity){
  if (entity.worldObj != null) {
    entity.worldObj.theProfiler.startSection("String_Node_Str");
    if (entity instanceof EntityPlayer && ((EntityPlayer)entity).isSpectator())     return false;
    if (VampirismAPI.sundamageRegistry().getSundamageInDim(entity.worldObj.provider.getDimension())) {
      if (!entity.worldObj.isRaining()) {
        float angle=entity.worldObj.getCelestialAngle(1.0F);
        if (angle > 0.78 || angle < 0.24) {
          BlockPos pos=new BlockPos(entity.posX + 0.5,entity.posY + 0,entity.posZ + 0.5);
          if (entity.worldObj.canBlockSeeSky(pos)) {
            ResourceLocation biomeID=null;
            try {
              biomeID=entity.worldObj.getBiomeGenForCoords(pos).getRegistryName();
              if (VampirismAPI.sundamageRegistry().getSundamageInBiome(biomeID)) {
                entity.worldObj.theProfiler.endSection();
                return true;
              }
            }
 catch (            NullPointerException e) {
            }
          }
        }
      }
    }
    entity.worldObj.theProfiler.endSection();
  }
  return false;
}
Program: 12646
Project: 12646
Buggy source:
@Override public Multimap<String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot,ItemStack stack){
  Multimap<String,AttributeModifier> multimap=super.getAttributeModifiers(equipmentSlot,stack);
  if (equipmentSlot == this.armorType) {
    TIER tier=getTier(stack);
    multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(),new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()],"String_Node_Str",getSpeedBoost(tier),2));
  }
  return multimap;
}

Fixed version (ground truth):
@Override public Multimap<String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot,ItemStack stack){
  Multimap<String,AttributeModifier> multimap=super.getAttributeModifiers(equipmentSlot,stack);
  if (equipmentSlot == this.armorType) {
    TIER tier=getTier(stack);
    multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(),new AttributeModifier(VAMIRISM_ARMOR_MODIFIER[equipmentSlot.getIndex()],"String_Node_Str",getSpeedBoost(tier),2));
  }
  return multimap;
}
Program: 12647
Project: 12647
Buggy source:
static void buildCategories(){
  VampirismMod.log.d(TAG,"String_Node_Str");
  long start=System.currentTimeMillis();
  guideBook.addCategory(new CategoryItemStack(buildOverview(),"String_Node_Str",new ItemStack(ModItems.vampireFang)));
  guideBook.addCategory(new CategoryItemStack(buildVampire(),"String_Node_Str",new ItemStack(ModItems.bloodBottle,1,ItemBloodBottle.AMOUNT)));
  guideBook.addCategory(new CategoryItemStack(buildHunter(),"String_Node_Str",new ItemStack(ModItems.humanHeart)));
  guideBook.addCategory(new CategoryItemStack(buildCreatures(),"String_Node_Str",new ItemStack(Items.SKULL)));
  guideBook.addCategory(new CategoryItemStack(buildWorld(),"String_Node_Str",new ItemStack(Blocks.GRASS)));
  guideBook.addCategory(new CategoryItemStack(buildItems(),"String_Node_Str",new ItemStack(Items.APPLE)));
  guideBook.addCategory(new CategoryItemStack(buildBlocks(),"String_Node_Str",new ItemStack(Blocks.STONE)));
  VampirismMod.log.d(TAG,"String_Node_Str",System.currentTimeMillis() - start);
}

Fixed version (ground truth):
static void buildCategories(){
  VampirismMod.log.d(TAG,"String_Node_Str");
  long start=System.currentTimeMillis();
  guideBook.addCategory(new CategoryItemStack(buildOverview(),"String_Node_Str",new ItemStack(ModItems.vampireFang)));
  guideBook.addCategory(new CategoryItemStack(buildVampire(),"String_Node_Str",new ItemStack(ModItems.bloodBottle,1,ItemBloodBottle.AMOUNT)));
  guideBook.addCategory(new CategoryItemStack(buildHunter(),"String_Node_Str",new ItemStack(ModItems.humanHeart)));
  guideBook.addCategory(new CategoryItemStack(buildCreatures(),"String_Node_Str",new ItemStack(Items.SKULL)));
  guideBook.addCategory(new CategoryItemStack(buildWorld(),"String_Node_Str",new ItemStack(ModBlocks.cursedEarth)));
  guideBook.addCategory(new CategoryItemStack(buildItems(),"String_Node_Str",new ItemStack(Items.APPLE)));
  guideBook.addCategory(new CategoryItemStack(buildBlocks(),"String_Node_Str",new ItemStack(ModBlocks.castleBlock)));
  VampirismMod.log.d(TAG,"String_Node_Str",System.currentTimeMillis() - start);
}
Program: 12648
Project: 12648
Buggy source:
static void initBook(){
  guideBook=new Book();
  guideBook.setTitle("String_Node_Str");
  guideBook.setDisplayName("String_Node_Str");
  guideBook.setWelcomeMessage("String_Node_Str");
  guideBook.setAuthor("String_Node_Str");
  guideBook.setColor(Color.getHSBColor(0.5f,0.2f,0.5f));
  guideBook.setRegistryName(REFERENCE.MODID,"String_Node_Str");
  guideBook.setOutlineTexture(new ResourceLocation("String_Node_Str","String_Node_Str"));
  GameRegistry.register(guideBook);
  if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
    GuideAPI.setModel(guideBook);
  }
  bookStack=GuideAPI.getStackFromBook(guideBook);
  VampirismMod.log.i(TAG,"String_Node_Str");
}

Fixed version (ground truth):
static void initBook(){
  guideBook=new Book();
  guideBook.setTitle("String_Node_Str");
  guideBook.setDisplayName("String_Node_Str");
  guideBook.setWelcomeMessage("String_Node_Str");
  guideBook.setAuthor("String_Node_Str");
  guideBook.setColor(Color.getHSBColor(0.5f,0.2f,0.5f));
  guideBook.setRegistryName(REFERENCE.MODID,"String_Node_Str");
  guideBook.setOutlineTexture(new ResourceLocation("String_Node_Str","String_Node_Str"));
  guideBook.setSpawnWithBook(true);
  GameRegistry.register(guideBook);
  if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
    GuideAPI.setModel(guideBook);
  }
  bookStack=GuideAPI.getStackFromBook(guideBook);
  VampirismMod.log.i(TAG,"String_Node_Str");
}
Program: 12654
Project: 12654
Buggy source:
@Override public void onLeftClicked(Book book,CategoryAbstract category,EntryAbstract entry,int mouseX,int mouseY,EntityPlayer player,GuiEntry guiEntry){
  if (mouseX > guiEntry.guiLeft + guiEntry.xSize) {
    for (int i=0; i < links.size(); i++) {
      if (GuiHelper.isMouseBetween(mouseX,mouseY,guiEntry.guiLeft + guiEntry.xSize,guiEntry.guiTop + 10 + 20 * i,links.get(i).width,20)) {
        links.get(i).onClicked(book,category,entry,player,guiEntry.bookStack,guiEntry.pageNumber);
        return;
      }
    }
  }
  page.onLeftClicked(book,category,entry,mouseX,mouseY,player,guiEntry);
}

Fixed version (ground truth):
@Override public void onLeftClicked(Book book,CategoryAbstract category,EntryAbstract entry,int mouseX,int mouseY,EntityPlayer player,GuiEntry guiEntry){
  if (mouseX > guiEntry.guiLeft + guiEntry.xSize) {
    long lastClock=System.currentTimeMillis() / 4;
    if (lastClock != lastLinkClick) {
      lastLinkClick=lastClock;
      for (int i=0; i < links.size(); i++) {
        if (GuiHelper.isMouseBetween(mouseX,mouseY,guiEntry.guiLeft + guiEntry.xSize,guiEntry.guiTop + 10 + 20 * i,links.get(i).width,20)) {
          links.get(i).onClicked(book,category,entry,player,guiEntry.bookStack,guiEntry.pageNumber);
          return;
        }
      }
    }
  }
  page.onLeftClicked(book,category,entry,mouseX,mouseY,player,guiEntry);
}
Program: 12656
Project: 12656
Buggy source:
/** 
 * Registers the entity and add a spawn entry for it
 * @param clazz
 * @param name
 * @param probe
 * @param min
 * @param max
 * @param type
 * @param biomes
 */
private static void registerEntity(Class<? extends EntityLiving> clazz,String name,EntityLiving.SpawnPlacementType placementType,int probe,int min,int max,EnumCreatureType type,Biome... biomes){
  registerEntity(clazz,name,placementType,true);
  VampirismMod.log.d("String_Node_Str","String_Node_Str" + probe);
  EntityRegistry.addSpawn(clazz,probe,min,max,type,biomes);
}

Fixed version (ground truth):
/** 
 * Registers the entity and add a spawn entry for it
 * @param clazz
 * @param name
 * @param probe
 * @param min
 * @param max
 * @param type
 * @param biomes
 */
private static void registerEntity(Class<? extends EntityLiving> clazz,String name,EntityLiving.SpawnPlacementType placementType,int probe,int min,int max,EnumCreatureType type,Biome... biomes){
  registerEntity(clazz,name,placementType,true);
  EntityRegistry.addSpawn(clazz,probe,min,max,type,biomes);
}
Program: 12657
Project: 12657
Buggy source:
@Mod.EventHandler public void init(FMLInitializationEvent event){
  versionInfo=VersionChecker.executeVersionCheck(REFERENCE.VERSION_UPDATE_FILE,REFERENCE.VERSION.equals("String_Node_Str") ? "String_Node_Str" : REFERENCE.VERSION);
  ModEventHandler eventHandler=new ModEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  MinecraftForge.TERRAIN_GEN_BUS.register(eventHandler);
  MinecraftForge.EVENT_BUS.register(new ModPlayerEventHandler());
  MinecraftForge.EVENT_BUS.register(new ModEntityEventHandler());
  GameRegistry.registerWorldGenerator(new VampirismWorldGen(),1000);
  HelperRegistry.registerPlayerEventReceivingCapability(VampirePlayer.CAP,VampirePlayer.class);
  HelperRegistry.registerPlayerEventReceivingCapability(HunterPlayer.CAP,HunterPlayer.class);
  HelperRegistry.registerSyncableEntityCapability(ExtendedCreature.CAP,REFERENCE.EXTENDED_CREATURE_KEY,ExtendedCreature.class);
  HelperRegistry.registerSyncablePlayerCapability(VampirePlayer.CAP,REFERENCE.VAMPIRE_PLAYER_KEY,VampirePlayer.class);
  HelperRegistry.registerSyncablePlayerCapability(HunterPlayer.CAP,REFERENCE.HUNTER_PLAYER_KEY,HunterPlayer.class);
  HelperRegistry.registerSyncablePlayerCapability(FactionPlayerHandler.CAP,REFERENCE.FACTION_PLAYER_HANDLER_KEY,FactionPlayerHandler.class);
  Achievements.registerAchievement();
  SupporterManager.getInstance().initAsync();
  BloodPotions.register();
  proxy.onInitStep(IInitListener.Step.INIT,event);
  modCompatLoader.onInitStep(IInitListener.Step.INIT,event);
}

Fixed version (ground truth):
@Mod.EventHandler public void init(FMLInitializationEvent event){
  versionInfo=VersionChecker.executeVersionCheck(REFERENCE.VERSION_UPDATE_FILE,"String_Node_Str".equals(REFERENCE.VERSION) ? "String_Node_Str" : REFERENCE.VERSION);
  ModEventHandler eventHandler=new ModEventHandler();
  MinecraftForge.EVENT_BUS.register(eventHandler);
  MinecraftForge.TERRAIN_GEN_BUS.register(eventHandler);
  MinecraftForge.EVENT_BUS.register(new ModPlayerEventHandler());
  MinecraftForge.EVENT_BUS.register(new ModEntityEventHandler());
  GameRegistry.registerWorldGenerator(new VampirismWorldGen(),1000);
  HelperRegistry.registerPlayerEventReceivingCapability(VampirePlayer.CAP,VampirePlayer.class);
  HelperRegistry.registerPlayerEventReceivingCapability(HunterPlayer.CAP,HunterPlayer.class);
  HelperRegistry.registerSyncableEntityCapability(ExtendedCreature.CAP,REFERENCE.EXTENDED_CREATURE_KEY,ExtendedCreature.class);
  HelperRegistry.registerSyncablePlayerCapability(VampirePlayer.CAP,REFERENCE.VAMPIRE_PLAYER_KEY,VampirePlayer.class);
  HelperRegistry.registerSyncablePlayerCapability(HunterPlayer.CAP,REFERENCE.HUNTER_PLAYER_KEY,HunterPlayer.class);
  HelperRegistry.registerSyncablePlayerCapability(FactionPlayerHandler.CAP,REFERENCE.FACTION_PLAYER_HANDLER_KEY,FactionPlayerHandler.class);
  Achievements.registerAchievement();
  SupporterManager.getInstance().initAsync();
  BloodPotions.register();
  proxy.onInitStep(IInitListener.Step.INIT,event);
  modCompatLoader.onInitStep(IInitListener.Step.INIT,event);
}
Program: 12658
Project: 12658
Buggy source:
/** 
 * Join the given faction and set the faction level to 1. Only successful if   {@link IFactionPlayerHandler#canJoin(IPlayableFaction)}
 * @param faction
 */
void joinFaction(IPlayableFaction faction);

Fixed version (ground truth):
/** 
 * Join the given faction and set the faction level to 1. Only successful if   {@link IFactionPlayerHandler#canJoin(IPlayableFaction)}
 * @param faction
 */
void joinFaction(@Nonnull IPlayableFaction faction);
Program: 12659
Project: 12659
Buggy source:
/** 
 * Set the level for a faction. Only works if the player already is in the given faction. Use   {@link IFactionPlayerHandler#joinFaction(IPlayableFaction)} to join a faction first or {@link IFactionPlayerHandler#setFactionAndLevel(IPlayableFaction,int)} if you are sure what you do
 * @param faction
 * @param level
 * @return If successful
 */
boolean setFactionLevel(IPlayableFaction faction,int level);

Fixed version (ground truth):
/** 
 * Set the level for a faction. Only works if the player already is in the given faction. Use   {@link IFactionPlayerHandler#joinFaction(IPlayableFaction)} to join a faction first or {@link IFactionPlayerHandler#setFactionAndLevel(IPlayableFaction,int)} if you are sure what you do
 * @param faction
 * @param level
 * @return If successful
 */
boolean setFactionLevel(@Nonnull IPlayableFaction faction,int level);
Program: 12660
Project: 12660
Buggy source:
public SkillEvent(IPlayableFaction faction){
  this.faction=faction;
}

Fixed version (ground truth):
private SkillEvent(IPlayableFaction faction){
  this.faction=faction;
}
Program: 12661
Project: 12661
Buggy source:
public AddSkills(IPlayableFaction faction,List<ISkill> skills){
  super(faction);
  this.skills=skills;
}

Fixed version (ground truth):
AddSkills(IPlayableFaction faction,List<ISkill> skills){
  super(faction);
  this.skills=skills;
}
Program: 12662
Project: 12662
Buggy source:
public static EnumFlowerType getType(int meta){
  if (meta >= TYPE_FOR_META.length) {
    meta=0;
  }
  return TYPE_FOR_META[meta];
}

Fixed version (ground truth):
public static EnumFlowerType getType(int meta){
  if (meta >= TYPE_FOR_META.length) {
    return TYPE_FOR_META[0];
  }
  return TYPE_FOR_META[meta];
}
Program: 12663
Project: 12663
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit();
  break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit();
  break;
default :
}
}
Program: 12664
Project: 12664
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    registerBlocks();
  registerTiles();
break;
case INIT:
registerCraftingRecipes();
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    registerBlocks();
  registerTiles();
break;
case INIT:
registerCraftingRecipes();
break;
default :
}
}
Program: 12665
Project: 12665
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
case INIT:
init((FMLInitializationEvent)event);
break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
case INIT:
init((FMLInitializationEvent)event);
break;
default :
}
}
Program: 12666
Project: 12666
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
default :
}
}
Program: 12667
Project: 12667
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    preInit((FMLPreInitializationEvent)event);
  break;
default :
}
}
Program: 12668
Project: 12668
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    registerSounds();
  break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case PRE_INIT:
    registerSounds();
  break;
default :
}
}
Program: 12669
Project: 12669
Buggy source:
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case INIT:
    registerCreationHandlers();
  registerPieces();
break;
}
}

Fixed version (ground truth):
public static void onInitStep(IInitListener.Step step,FMLStateEvent event){
switch (step) {
case INIT:
    registerCreationHandlers();
  registerPieces();
break;
default :
}
}
Program: 12670
Project: 12670
Buggy source:
@SuppressWarnings("String_Node_Str") public static ICapabilityProvider createNewCapability(final EntityCreature creature){
  return new ICapabilitySerializable<NBTTagCompound>(){
    IExtendedCreatureVampirism inst=new ExtendedCreature(creature);
    @Override public void deserializeNBT(    NBTTagCompound nbt){
      CAP.getStorage().readNBT(CAP,inst,null,nbt);
    }
    @Override public <T>T getCapability(    Capability<T> capability,    EnumFacing facing){
      return CAP.equals(capability) ? CAP.<T>cast(inst) : null;
    }
    @Override public boolean hasCapability(    Capability<?> capability,    EnumFacing facing){
      return capability == CAP;
    }
    @Override public NBTTagCompound serializeNBT(){
      return (NBTTagCompound)CAP.getStorage().writeNBT(CAP,inst,null);
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static ICapabilityProvider createNewCapability(final EntityCreature creature){
  return new ICapabilitySerializable<NBTTagCompound>(){
    IExtendedCreatureVampirism inst=new ExtendedCreature(creature);
    @Override public void deserializeNBT(    NBTTagCompound nbt){
      CAP.getStorage().readNBT(CAP,inst,null,nbt);
    }
    @Override public <T>T getCapability(    Capability<T> capability,    EnumFacing facing){
      return CAP.equals(capability) ? CAP.<T>cast(inst) : null;
    }
    @Override public boolean hasCapability(    Capability<?> capability,    EnumFacing facing){
      return CAP.equals(capability);
    }
    @Override public NBTTagCompound serializeNBT(){
      return (NBTTagCompound)CAP.getStorage().writeNBT(CAP,inst,null);
    }
  }
;
}
Program: 12671
Project: 12671
Buggy source:
@Override public boolean hasCapability(Capability<?> capability,EnumFacing facing){
  return capability == CAP;
}

Fixed version (ground truth):
@Override public boolean hasCapability(Capability<?> capability,EnumFacing facing){
  return CAP.equals(capability);
}
Program: 12672
Project: 12672
Buggy source:
@Override public void joinFaction(IPlayableFaction faction){
  if (canJoin(faction)) {
    setFactionAndLevel(faction,1);
  }
}

Fixed version (ground truth):
@Override public void joinFaction(@Nonnull IPlayableFaction faction){
  if (canJoin(faction)) {
    setFactionAndLevel(faction,1);
  }
}
Program: 12673
Project: 12673
Buggy source:
@Override public boolean setFactionLevel(IPlayableFaction faction,int level){
  if (faction == currentFaction) {
    return setFactionAndLevel(faction,level);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean setFactionLevel(@Nonnull IPlayableFaction faction,int level){
  return faction.equals(currentFaction) && setFactionAndLevel(faction,level);
}
Program: 12674
Project: 12674
Buggy source:
@Override public boolean isInFaction(@Nullable IPlayableFaction f){
  return currentFaction == f;
}

Fixed version (ground truth):
@Override public boolean isInFaction(@Nullable IPlayableFaction f){
  return Objects.equals(currentFaction,f);
}
Program: 12675
Project: 12675
Buggy source:
@Override public boolean setFactionAndLevel(IPlayableFaction faction,int level){
  IPlayableFaction old=currentFaction;
  int oldLevel=currentLevel;
  if (currentFaction != null && (currentFaction != faction || level == 0)) {
    if (!currentFaction.getPlayerCapability(player).canLeaveFaction()) {
      VampirismMod.log.i(TAG,"String_Node_Str",currentFaction.getKey());
      return false;
    }
  }
  if (faction == null) {
    currentFaction=null;
    currentLevel=0;
  }
 else {
    if (level < 0 || level > faction.getHighestReachableLevel()) {
      VampirismMod.log.w(TAG,"String_Node_Str",level,faction.getKey());
      return false;
    }
    currentFaction=faction;
    currentLevel=level;
  }
  if (currentFaction == null)   currentLevel=0;
 else   if (currentLevel == 0)   currentFaction=null;
  notifyFaction(old,oldLevel);
  sync(old != currentFaction);
  return true;
}

Fixed version (ground truth):
@Override public boolean setFactionAndLevel(IPlayableFaction faction,int level){
  IPlayableFaction old=currentFaction;
  int oldLevel=currentLevel;
  if (currentFaction != null && (!currentFaction.equals(faction) || level == 0)) {
    if (!currentFaction.getPlayerCapability(player).canLeaveFaction()) {
      VampirismMod.log.i(TAG,"String_Node_Str",currentFaction.getKey());
      return false;
    }
  }
  if (faction == null) {
    currentFaction=null;
    currentLevel=0;
  }
 else {
    if (level < 0 || level > faction.getHighestReachableLevel()) {
      VampirismMod.log.w(TAG,"String_Node_Str",level,faction.getKey());
      return false;
    }
    currentFaction=faction;
    currentLevel=level;
  }
  if (currentFaction == null)   currentLevel=0;
 else   if (currentLevel == 0)   currentFaction=null;
  notifyFaction(old,oldLevel);
  sync(!Objects.equals(old,currentFaction));
  return true;
}
Program: 12676
Project: 12676
Buggy source:
/** 
 * Notify faction about changes.  {@link FactionPlayerHandler#currentFaction} and {@link FactionPlayerHandler#currentLevel} will be used as the new ones
 * @param oldFaction
 * @param oldLevel
 */
private void notifyFaction(IPlayableFaction oldFaction,int oldLevel){
  if (oldFaction != currentFaction && oldFaction != null) {
    VampirismMod.log.d(TAG,"String_Node_Str",oldFaction.getKey());
    oldFaction.getPlayerCapability(player).onLevelChanged(0,oldLevel);
  }
  if (currentFaction != null) {
    VampirismMod.log.d(TAG,"String_Node_Str",currentFaction,currentLevel);
    currentFaction.getPlayerCapability(player).onLevelChanged(currentLevel,oldFaction == currentFaction ? oldLevel : 0);
  }
  if (currentFaction != oldFaction) {
    onChangedFaction();
  }
}

Fixed version (ground truth):
/** 
 * Notify faction about changes.  {@link FactionPlayerHandler#currentFaction} and {@link FactionPlayerHandler#currentLevel} will be used as the new ones
 * @param oldFaction
 * @param oldLevel
 */
private void notifyFaction(IPlayableFaction oldFaction,int oldLevel){
  if (oldFaction != null && !oldFaction.equals(currentFaction)) {
    VampirismMod.log.d(TAG,"String_Node_Str",oldFaction.getKey());
    oldFaction.getPlayerCapability(player).onLevelChanged(0,oldLevel);
  }
  if (currentFaction != null) {
    VampirismMod.log.d(TAG,"String_Node_Str",currentFaction,currentLevel);
    currentFaction.getPlayerCapability(player).onLevelChanged(currentLevel,oldFaction == currentFaction ? oldLevel : 0);
  }
  if (!Objects.equals(currentFaction,oldFaction)) {
    onChangedFaction();
  }
}