nus-yam/ex-repair huggingface dataset:
Program: 95504
Project: 95504
Buggy source:
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  Objects.requireNonNull(crop,"String_Node_Str");
  Objects.requireNonNull(rand,"String_Node_Str");
  final List<IAgriCrop> neighbors=WorldHelper.getTileNeighbors(crop.getCropWorld(),crop.getCropPos(),IAgriCrop.class);
  final List<IAgriPlant> parents=neighbors.stream().filter(IAgriCrop::isMature).map(IAgriCrop::getSeed).filter(Objects::nonNull).map(AgriSeed::getPlant).collect(Collectors.toList());
  if (parents.size() < 2) {
    return Optional.empty();
  }
  final List<IAgriMutation> mutations=AgriApi.getMutationRegistry().stream().filter(m -> m.areParentsIn(parents)).filter(m -> crop.isFertile(m.getChild())).collect(Collectors.toList());
  if (mutations.isEmpty()) {
    return Optional.empty();
  }
  final int index=rand.nextInt(mutations.size());
  final IAgriMutation mutation=mutations.get(index);
  if (mutation.getChance() <= rand.nextDouble()) {
    return Optional.empty();
  }
  Optional<IAgriStat> stat=AgriApi.getStatCalculatorRegistry().valueOf(mutation).map(c -> c.calculateMutationStats(mutation,neighbors));
  return stat.map(s -> new AgriSeed(mutation.getChild(),s));
}

Fixed version (ground truth):
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  Objects.requireNonNull(crop,"String_Node_Str");
  Objects.requireNonNull(rand,"String_Node_Str");
  final List<IAgriCrop> neighbors=WorldHelper.getTileNeighbors(crop.getCropWorld(),crop.getCropPos(),IAgriCrop.class);
  final List<IAgriPlant> parents=neighbors.stream().filter(IAgriCrop::isMature).map(IAgriCrop::getSeed).filter(Objects::nonNull).map(AgriSeed::getPlant).collect(Collectors.toList());
  if (parents.size() < 2) {
    return Optional.empty();
  }
  final List<IAgriMutation> mutations=AgriApi.getMutationRegistry().stream().filter(m -> m.areParentsIn(parents)).filter(m -> crop.isFertile(m.getChild())).collect(Collectors.toList());
  if (mutations.isEmpty()) {
    return Optional.empty();
  }
  final int index=rand.nextInt(mutations.size());
  final IAgriMutation mutation=mutations.get(index);
  if (mutation.getChance() <= rand.nextDouble()) {
    return Optional.empty();
  }
  Optional<IAgriStat> stat=AgriApi.getStatCalculatorRegistry().valueOf(mutation.getChild()).map(c -> c.calculateMutationStats(mutation,neighbors));
  return stat.map(s -> new AgriSeed(mutation.getChild(),s));
}
Program: 95505
Project: 95505
Buggy source:
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  Objects.requireNonNull(crop,"String_Node_Str");
  Objects.requireNonNull(rand,"String_Node_Str");
  final List<IAgriCrop> neighbors=WorldHelper.getTileNeighbors(crop.getWorld(),crop.getPos(),IAgriCrop.class);
  final List<IAgriPlant> parents=neighbors.stream().filter(IAgriCrop::isMature).map(IAgriCrop::getSeed).filter(Objects::nonNull).map(AgriSeed::getPlant).collect(Collectors.toList());
  if (parents.size() < 2) {
    return Optional.empty();
  }
  final List<IAgriMutation> mutations=AgriApi.getMutationRegistry().stream().filter(m -> m.areParentsIn(parents)).filter(m -> crop.isFertile(m.getChild())).collect(Collectors.toList());
  if (mutations.isEmpty()) {
    return Optional.empty();
  }
  final int index=rand.nextInt(mutations.size());
  final IAgriMutation mutation=mutations.get(index);
  if (mutation.getChance() <= rand.nextDouble()) {
    return Optional.empty();
  }
  Optional<IAgriStat> stat=AgriApi.getStatCalculatorRegistry().valueOf(mutation).map(c -> c.calculateMutationStats(mutation,neighbors));
  return stat.map(s -> new AgriSeed(mutation.getChild(),s));
}

Fixed version (ground truth):
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  Objects.requireNonNull(crop,"String_Node_Str");
  Objects.requireNonNull(rand,"String_Node_Str");
  final List<IAgriCrop> neighbors=WorldHelper.getTileNeighbors(crop.getCropWorld(),crop.getCropPos(),IAgriCrop.class);
  final List<IAgriPlant> parents=neighbors.stream().filter(IAgriCrop::isMature).map(IAgriCrop::getSeed).filter(Objects::nonNull).map(AgriSeed::getPlant).collect(Collectors.toList());
  if (parents.size() < 2) {
    return Optional.empty();
  }
  final List<IAgriMutation> mutations=AgriApi.getMutationRegistry().stream().filter(m -> m.areParentsIn(parents)).filter(m -> crop.isFertile(m.getChild())).collect(Collectors.toList());
  if (mutations.isEmpty()) {
    return Optional.empty();
  }
  final int index=rand.nextInt(mutations.size());
  final IAgriMutation mutation=mutations.get(index);
  if (mutation.getChance() <= rand.nextDouble()) {
    return Optional.empty();
  }
  Optional<IAgriStat> stat=AgriApi.getStatCalculatorRegistry().valueOf(mutation).map(c -> c.calculateMutationStats(mutation,neighbors));
  return stat.map(s -> new AgriSeed(mutation.getChild(),s));
}
Program: 95506
Project: 95506
Buggy source:
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  List<IAgriCrop> matureNeighbours=WorldHelper.getTileNeighbors(crop.getWorld(),crop.getPos(),IAgriCrop.class);
  matureNeighbours.removeIf(c -> !c.isMature());
  if (!matureNeighbours.isEmpty()) {
    int index=rand.nextInt(matureNeighbours.size());
    AgriSeed seed=matureNeighbours.get(index).getSeed();
    if (seed != null && rand.nextDouble() < seed.getPlant().getSpreadChance()) {
      return AgriApi.getStatCalculatorRegistry().valueOf(seed.getPlant()).map(calc -> calc.calculateSpreadStats(seed.getPlant(),matureNeighbours)).map(stat -> new AgriSeed(seed.getPlant(),stat));
    }
  }
  return Optional.empty();
}

Fixed version (ground truth):
@Override public Optional<AgriSeed> executeStrategy(IAgriCrop crop,Random rand){
  List<IAgriCrop> matureNeighbours=WorldHelper.getTileNeighbors(crop.getCropWorld(),crop.getCropPos(),IAgriCrop.class);
  matureNeighbours.removeIf(c -> !c.isMature());
  if (!matureNeighbours.isEmpty()) {
    int index=rand.nextInt(matureNeighbours.size());
    AgriSeed seed=matureNeighbours.get(index).getSeed();
    if (seed != null && rand.nextDouble() < seed.getPlant().getSpreadChance()) {
      return AgriApi.getStatCalculatorRegistry().valueOf(seed.getPlant()).map(calc -> calc.calculateSpreadStats(seed.getPlant(),matureNeighbours)).map(stat -> new AgriSeed(seed.getPlant(),stat));
    }
  }
  return Optional.empty();
}
Program: 95507
Project: 95507
Buggy source:
public ContainerSeedAnalyzer(InventoryPlayer inventory,TileEntitySeedAnalyzer seedAnalyzer,int x,int y){
  super(inventory,x,y);
  this.seedAnalyzer=seedAnalyzer;
  this.addSlots();
}

Fixed version (ground truth):
public ContainerSeedAnalyzer(TileEntitySeedAnalyzer analyzer,InventoryPlayer inventory,SeedAnalyzerLayout layout){
  super(analyzer,inventory,layout.offsetX,layout.offsetY);
  this.addSlotToContainer(new SlotSeedAnalyzerSeed(this.tile,this.seedSlotId,layout.seedSlotX,layout.seedSlotY));
  this.addSlotToContainer(new SlotSeedAnalyzerJournal(this.tile,this.journalSlotId,layout.journalSlotX,layout.journalSlotY));
}
Program: 95508
Project: 95508
Buggy source:
@Override public void detectAndSendChanges(){
  super.detectAndSendChanges();
  for (  IContainerListener listener : this.listeners) {
    if (this.progress != this.seedAnalyzer.getProgress()) {
      listener.sendProgressBarUpdate(this,0,this.seedAnalyzer.getProgress());
    }
  }
  this.progress=this.seedAnalyzer.getProgress();
}

Fixed version (ground truth):
@Override public void detectAndSendChanges(){
  super.detectAndSendChanges();
  for (  IContainerListener listener : this.listeners) {
    if (this.progress != this.tile.getProgress()) {
      listener.sendProgressBarUpdate(this,0,this.tile.getProgress());
    }
  }
  this.progress=this.tile.getProgress();
}
Program: 95509
Project: 95509
Buggy source:
@Override @SideOnly(Side.CLIENT) public void updateProgressBar(int type,int newValue){
  if (type == 0) {
    this.seedAnalyzer.setProgress(newValue);
  }
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public void updateProgressBar(int type,int newValue){
  if (type == 0) {
    this.tile.setProgress(newValue);
  }
}
Program: 95510
Project: 95510
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public List<ItemStack> getSeedEntries(){
  return this.te.getInventory();
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public List<ItemStack> getSeedEntries(){
  return this.tile.getInventory();
}
Program: 95511
Project: 95511
Buggy source:
public ContainerSeedStorage(InventoryPlayer inventory,TileEntitySeedStorage te){
  super(inventory,invOffsetX,invOffsetY);
  this.te=te;
}

Fixed version (ground truth):
public ContainerSeedStorage(TileEntitySeedStorage tile,InventoryPlayer inventory){
  super(tile,inventory,invOffsetX,invOffsetY);
}
Program: 95512
Project: 95512
Buggy source:
@Override public boolean addSeedToStorage(ItemStack seedStack){
  return this.te.addStackToInventory(seedStack);
}

Fixed version (ground truth):
@Override public boolean addSeedToStorage(ItemStack seedStack){
  return this.tile.addStackToInventory(seedStack);
}
Program: 95513
Project: 95513
Buggy source:
@Override public List<SeedStorageSlot> getSeedSlots(AgriSeed seed){
  return this.te.getSlots();
}

Fixed version (ground truth):
@Override public List<SeedStorageSlot> getSeedSlots(AgriSeed seed){
  return this.tile.getSlots();
}
Program: 95514
Project: 95514
Buggy source:
public ContainerSeedStorageBase(InventoryPlayer inventory,int xOffset,int yOffset){
  super(inventory,xOffset,yOffset);
}

Fixed version (ground truth):
public ContainerSeedStorageBase(T tile,InventoryPlayer inventory,int xOffset,int yOffset){
  super(tile,inventory,xOffset,yOffset);
}
Program: 95515
Project: 95515
Buggy source:
public Optional<ISeedStorageControllable> getControllable(ItemStack stack){
  TileEntity te=this.getTileEntity();
  if (te instanceof ISeedStorageController) {
    return ((ISeedStorageController)te).getControllable(stack);
  }
 else   if (te instanceof ISeedStorageControllable) {
    return Optional.of((ISeedStorageControllable)te);
  }
 else {
    return Optional.empty();
  }
}

Fixed version (ground truth):
public Optional<ISeedStorageControllable> getControllable(ItemStack stack){
  if (this.tile instanceof ISeedStorageController) {
    return ((ISeedStorageController)this.tile).getControllable(stack);
  }
 else   if (this.tile instanceof ISeedStorageControllable) {
    return Optional.of((ISeedStorageControllable)tile);
  }
 else {
    return Optional.empty();
  }
}
Program: 95516
Project: 95516
Buggy source:
public ContainerSeedStorageController(InventoryPlayer inventory,TileEntitySeedStorageController te){
  super(inventory,invOffsetX,invOffsetY);
  this.te=te;
}

Fixed version (ground truth):
public ContainerSeedStorageController(TileEntitySeedStorageController tile,InventoryPlayer inventory){
  super(tile,inventory,invOffsetX,invOffsetY);
}
Program: 95517
Project: 95517
Buggy source:
@Override public List<ItemStack> getSeedEntries(){
  return this.te.getControlledSeeds();
}

Fixed version (ground truth):
@Override public List<ItemStack> getSeedEntries(){
  return this.tile.getControlledSeeds();
}
Program: 95518
Project: 95518
Buggy source:
@Override public boolean addSeedToStorage(ItemStack stack){
  return this.te.addStackToInventory(stack);
}

Fixed version (ground truth):
@Override public boolean addSeedToStorage(ItemStack stack){
  return this.tile.addStackToInventory(stack);
}
Program: 95519
Project: 95519
Buggy source:
@Override public List<SeedStorageSlot> getSeedSlots(AgriSeed seed){
  final ItemStack stack=seed.toStack();
  return this.te.getSlots(stack.getItem(),stack.getItemDamage());
}

Fixed version (ground truth):
@Override public List<SeedStorageSlot> getSeedSlots(AgriSeed seed){
  final ItemStack stack=seed.toStack();
  return this.tile.getSlots(stack.getItem(),stack.getItemDamage());
}
Program: 95520
Project: 95520
Buggy source:
public GuiPeripheral(InventoryPlayer inventory,TileEntityPeripheral peripheral){
  super(new ContainerPeripheral(inventory,peripheral));
  this.xSize=172;
  this.ySize=176;
  this.peripheral=peripheral;
  this.methods=peripheral.getMethods();
  guideOffset=this.xSize - 4;
}

Fixed version (ground truth):
public GuiPeripheral(InventoryPlayer inventory,TileEntityPeripheral peripheral){
  super(new ContainerSeedAnalyzer(peripheral,inventory,ContainerSeedAnalyzer.SeedAnalyzerLayout.PERIPHERAL));
  this.xSize=172;
  this.ySize=176;
  this.peripheral=peripheral;
  this.methods=peripheral.getMethods();
  guideOffset=this.xSize - 4;
}
Program: 95521
Project: 95521
Buggy source:
public GuiSeedAnalyzer(InventoryPlayer inventory,TileEntitySeedAnalyzer seedAnalyzer){
  super(176,176,new ContainerSeedAnalyzer(inventory,seedAnalyzer));
  this.seedAnalyzer=seedAnalyzer;
}

Fixed version (ground truth):
public GuiSeedAnalyzer(InventoryPlayer inventory,TileEntitySeedAnalyzer seedAnalyzer){
  super(176,176,new ContainerSeedAnalyzer(seedAnalyzer,inventory,ContainerSeedAnalyzer.SeedAnalyzerLayout.NORMAL));
  this.seedAnalyzer=seedAnalyzer;
}
Program: 95522
Project: 95522
Buggy source:
public GuiSeedStorage(InventoryPlayer inventory,TileEntitySeedStorage te){
  super(new ContainerSeedStorage(inventory,te),0,14,170,48,-1,-1,5,7);
  this.activeSeed=te.getLockedSeed();
}

Fixed version (ground truth):
public GuiSeedStorage(InventoryPlayer inventory,TileEntitySeedStorage te){
  super(new ContainerSeedStorage(te,inventory),0,14,170,48,-1,-1,5,7);
  this.activeSeed=te.getLockedSeed();
}
Program: 95523
Project: 95523
Buggy source:
protected void getActiveSeed(){
  TileEntity tile=this.getContainer().getTileEntity();
  if (tile instanceof ISeedStorageControllable) {
    this.activeSeed=((ISeedStorageControllable)tile).getLockedSeed().orElse(null);
  }
}

Fixed version (ground truth):
protected void getActiveSeed(){
  TileEntity tile=this.getContainer().getTile();
  if (tile instanceof ISeedStorageControllable) {
    this.activeSeed=((ISeedStorageControllable)tile).getLockedSeed().orElse(null);
  }
}
Program: 95524
Project: 95524
Buggy source:
public GuiSeedStorageController(InventoryPlayer inventory,TileEntitySeedStorageController te){
  super(new ContainerSeedStorageController(inventory,te),10,6,184,7,7,8,82,8);
}

Fixed version (ground truth):
public GuiSeedStorageController(InventoryPlayer inventory,TileEntitySeedStorageController te){
  super(new ContainerSeedStorageController(te,inventory),10,6,184,7,7,8,82,8);
}
Program: 95525
Project: 95525
Buggy source:
@Override public boolean isMet(IBlockAccess world,BlockPos pos){
  return new BlockRange(this.range,pos).stream().map(loc -> FuzzyStack.fromBlockState(world.getBlockState(loc)).orElse(null)).skip(this.amount - 1).findAny().isPresent();
}

Fixed version (ground truth):
@Override public boolean isMet(IBlockAccess world,BlockPos pos){
  return new BlockRange(this.range,pos).stream().map(world::getBlockState).map(FuzzyStack::fromBlockState).map(o -> o.orElse(null)).filter(this.stack::equals).skip(this.amount - 1).findAny().isPresent();
}
Program: 95526
Project: 95526
Buggy source:
/** 
 * Handles the block drops. Called when the block is broken (not left clicked).
 */
@Override public void dropBlockAsItemWithChance(World world,BlockPos pos,IBlockState state,float chance,int fortune){
  if (!world.isRemote) {
    WorldHelper.spawnItemInWorld(world,pos,new ItemStack((Item)null,1,0,new NBTTagCompound()));
    this.getCrop(world,pos).ifPresent(crop -> crop.getDrops(drop -> WorldHelper.spawnItemInWorld(world,pos,drop)));
  }
}

Fixed version (ground truth):
/** 
 * Handles the block drops. Called when the block is broken (not left clicked).
 */
@Override public void dropBlockAsItemWithChance(World world,BlockPos pos,IBlockState state,float chance,int fortune){
  if (!world.isRemote) {
    this.getCrop(world,pos).ifPresent(crop -> crop.getDrops(drop -> WorldHelper.spawnItemInWorld(world,pos,drop)));
  }
}
Program: 95527
Project: 95527
Buggy source:
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  final int relMouseX=mouseX - this.guiLeft;
  final int relMouseY=mouseY - this.guiTop;
  final List<String> toolTips=new ArrayList<>();
  this.guis.getLast().onUpdateMouse(this,toolTips,relMouseX,relMouseY);
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  this.guis.getLast().onRenderForeground(this,toolTips,relMouseX,relMouseY);
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
  if (toolTips.size() > 0) {
    drawHoveringText(toolTips,relMouseX,relMouseY,fontRendererObj);
  }
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
}

Fixed version (ground truth):
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  final int relMouseX=mouseX - this.guiLeft;
  final int relMouseY=mouseY - this.guiTop;
  final List<String> toolTips=new ArrayList<>();
  this.guis.getLast().onUpdateMouse(this,toolTips,relMouseX,relMouseY);
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  for (  Slot s : this.getGui().getContainer().inventorySlots) {
    fontRendererObj.drawString("String_Node_Str" + s.slotNumber,s.xDisplayPosition,s.yDisplayPosition,Color.WHITE.getRGB());
  }
  this.guis.getLast().onRenderForeground(this,toolTips,relMouseX,relMouseY);
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
  if (toolTips.size() > 0) {
    drawHoveringText(toolTips,relMouseX,relMouseY,fontRendererObj);
  }
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
}
Program: 95528
Project: 95528
Buggy source:
public static void renderComponentProgressBar(AgriGuiWrapper gui,GuiComponent<Supplier<Integer>> component){
  final int width=component.getBounds().width;
  final int height=component.getBounds().height;
  final double progress=component.getComponent().get();
  GuiUtils.drawContinuousTexturedBox(WIDGETS,0,0,100,25,width,height,16,16,2,0);
  GuiUtils.drawContinuousTexturedBox(WIDGETS,0,0,125,25,(int)((width * progress) / 100),height,16,16,2,0);
}

Fixed version (ground truth):
public static void renderComponentProgressBar(AgriGuiWrapper gui,GuiComponent<Supplier<Integer>> component){
  final int width=component.getBounds().width;
  final int height=component.getBounds().height;
  final double progress=MathHelper.inRange(component.getComponent().get(),0.0,1.0);
  GuiUtils.drawContinuousTexturedBox(WIDGETS,0,0,100,25,width,height,16,16,2,0);
  GuiUtils.drawContinuousTexturedBox(WIDGETS,0,0,125,25,(int)((width * progress) / 100),height,16,16,2,0);
}
Program: 95529
Project: 95529
Buggy source:
@Override public ItemStack decrStackSize(int slot,int amount){
  slot=slot % 2;
  ItemStack output=null;
  if (slot == 0 && this.specimen != null) {
    if (amount < this.specimen.stackSize) {
      output=this.specimen.splitStack(amount);
    }
 else {
      output=this.specimen.copy();
      this.specimen=null;
      this.markForUpdate();
    }
  }
 else   if (slot == 1 && this.journal != null) {
    output=this.journal.copy();
    this.journal=null;
    this.markForUpdate();
  }
  this.progress=0;
  return output;
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  ItemStack output=null;
switch (slot) {
case SPECIMEN_SLOT_ID:
    if (this.specimen != null) {
      if (amount < this.specimen.stackSize) {
        output=this.specimen.splitStack(amount);
      }
 else {
        output=this.specimen.copy();
        this.specimen=null;
        this.markForUpdate();
      }
    }
  break;
case JOURNAL_SLOT_ID:
if (this.journal != null) {
  output=this.journal.copy();
  this.journal=null;
  this.markForUpdate();
}
break;
}
this.progress=0;
return output;
}
Program: 95530
Project: 95530
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack stack){
  slot=slot % 2;
  if (slot == 0) {
    this.specimen=stack;
    if (stack != null && stack.stackSize > getInventoryStackLimit()) {
      stack.stackSize=getInventoryStackLimit();
    }
    progress=isSpecimenAnalyzed() ? maxProgress() : 0;
  }
 else   if (slot == 1) {
    this.journal=stack;
  }
  this.markForUpdate();
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack stack){
switch (slot) {
case SPECIMEN_SLOT_ID:
    this.specimen=stack;
  if (stack != null && stack.stackSize > getInventoryStackLimit()) {
    stack.stackSize=getInventoryStackLimit();
  }
this.progress=isSpecimenAnalyzed() ? maxProgress() : 0;
this.markForUpdate();
return;
case JOURNAL_SLOT_ID:
this.journal=stack;
this.markForUpdate();
return;
}
}
Program: 95531
Project: 95531
Buggy source:
@Override public boolean canExtractItem(int slot,ItemStack itemStackIn,EnumFacing direction){
  slot=slot % 2;
  if (slot == 0 && this.specimen != null && this.specimen.hasTagCompound()) {
    return this.isSpecimenAnalyzed();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canExtractItem(int slot,ItemStack itemStackIn,EnumFacing direction){
  if (slot == SPECIMEN_SLOT_ID && this.specimen != null && this.specimen.hasTagCompound()) {
    return this.isSpecimenAnalyzed();
  }
  return false;
}
Program: 95532
Project: 95532
Buggy source:
/** 
 * Checks if a stack is valid for a slot.
 * @param slot
 * @param stack
 * @return if the item is valid.
 */
@Override public boolean isItemValidForSlot(int slot,ItemStack stack){
  slot=slot % 2;
switch (slot) {
case 0:
    return TileEntitySeedAnalyzer.isValid(stack);
case 1:
  return (stack != null && stack.getItem() != null && stack.getItem() instanceof ItemJournal);
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Checks if a stack is valid for a slot.
 * @param slot
 * @param stack
 * @return if the item is valid.
 */
@Override public boolean isItemValidForSlot(int slot,ItemStack stack){
switch (slot) {
case SPECIMEN_SLOT_ID:
    return TileEntitySeedAnalyzer.isValid(stack);
case JOURNAL_SLOT_ID:
  return StackHelper.isValid(stack,ItemJournal.class);
default :
return false;
}
}
Program: 95533
Project: 95533
Buggy source:
@Override public ItemStack getStackInSlot(int slot){
  slot=slot % 2;
switch (slot) {
case 0:
    return this.specimen;
case 1:
  return this.journal;
default :
return null;
}
}

Fixed version (ground truth):
@Override public ItemStack getStackInSlot(int slot){
switch (slot) {
case SPECIMEN_SLOT_ID:
    return this.specimen;
case JOURNAL_SLOT_ID:
  return this.journal;
default :
return null;
}
}
Program: 95534
Project: 95534
Buggy source:
@Override public ItemStack removeStackFromSlot(int slot){
  slot=slot % 2;
  ItemStack stackInSlot;
switch (slot) {
case 0:
    stackInSlot=this.specimen;
  break;
case 1:
stackInSlot=this.journal;
break;
default :
return null;
}
if (stackInSlot != null) {
setInventorySlotContents(slot,null);
}
return stackInSlot;
}

Fixed version (ground truth):
@Override public ItemStack removeStackFromSlot(int slot){
  ItemStack result;
switch (slot) {
case SPECIMEN_SLOT_ID:
    result=this.specimen;
  this.specimen=null;
this.progress=0;
break;
case JOURNAL_SLOT_ID:
result=this.journal;
this.journal=null;
break;
default :
return null;
}
this.markForUpdate();
return result;
}
Program: 95535
Project: 95535
Buggy source:
@Override public boolean canInsertItem(int slot,ItemStack stack,EnumFacing direction){
  slot=slot % 2;
  if (slot == 0) {
    return isValid(stack);
  }
 else   if (slot == 1) {
    return (this.journal == null && this.isItemValidForSlot(slot,stack));
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canInsertItem(int slot,ItemStack stack,EnumFacing direction){
switch (slot) {
case SPECIMEN_SLOT_ID:
    return isValid(stack);
case JOURNAL_SLOT_ID:
  return this.journal == null && this.isItemValidForSlot(slot,stack);
default :
return false;
}
}
Program: 95536
Project: 95536
Buggy source:
public static void init(){
  EntityRegistry.registerModEntity(EntityLeashKnotAgricraft.class,"String_Node_Str",1,AgriCraft.instance,16,100,false);
}

Fixed version (ground truth):
public static void init(){
  EntityRegistry.registerModEntity(EntityVillagerFarmer.class,"String_Node_Str",0,AgriCraft.instance,64,1,true);
  VillagerRegistry.instance().register(EntityVillagerFarmer.PROFESSION);
  EntityRegistry.registerModEntity(EntityLeashKnotAgricraft.class,"String_Node_Str",1,AgriCraft.instance,16,100,false);
}
Program: 95537
Project: 95537
Buggy source:
@Override protected List<DebugMode> getDebugModes(){
  List<DebugMode> list=new ArrayList<>();
  list.add(new DebugModeCheckSoil());
  list.add(new DebugModeClearGrass());
  list.add(new DebugModeCoreInfo());
  return list;
}

Fixed version (ground truth):
@Override protected List<DebugMode> getDebugModes(){
  List<DebugMode> list=new ArrayList<>();
  list.add(new DebugModeCheckSoil());
  list.add(new DebugModeClearGrass());
  list.add(new DebugModeCoreInfo());
  list.add(new DebugModeSpawnFarmer());
  return list;
}
Program: 95538
Project: 95538
Buggy source:
@Override public void debugActionBlockClicked(ItemStack stack,EntityPlayer player,World world,BlockPos pos,EnumHand hand,EnumFacing side,float hitX,float hitY,float hitZ){
  if (!world.isRemote) {
    EntityVillagerFarmer entityvillager=new EntityVillagerFarmer(world,WorldGen.getVillagerId());
    entityvillager.setLocationAndAngles((double)pos.getX() + 0.5D,(double)pos.getY() + 1,(double)pos.getZ() + 0.5D,0.0F,0.0F);
    world.spawnEntityInWorld(entityvillager);
  }
}

Fixed version (ground truth):
@Override public void debugActionBlockClicked(ItemStack stack,EntityPlayer player,World world,BlockPos pos,EnumHand hand,EnumFacing side,float hitX,float hitY,float hitZ){
  if (!world.isRemote) {
    EntityVillagerFarmer entityvillager=new EntityVillagerFarmer(world);
    entityvillager.setLocationAndAngles((double)pos.getX() + 0.5D,(double)pos.getY() + 1,(double)pos.getZ() + 0.5D,0.0F,0.0F);
    world.spawnEntityInWorld(entityvillager);
  }
}
Program: 95539
Project: 95539
Buggy source:
@Override protected void spawnVillagers(World world,StructureBoundingBox boundingBox,int x,int y,int z,int limit){
  if (AgriCraftConfig.villagerEnabled) {
    int nrVillagersSpawned=getNumberOfSpawnedVillagers(world);
    if (nrVillagersSpawned < limit) {
      for (int i1=nrVillagersSpawned; i1 < limit; ++i1) {
        int j1=this.getXWithOffset(x + i1,z);
        int k1=this.getYWithOffset(y);
        int l1=this.getZWithOffset(x + i1,z);
        if (!boundingBox.isVecInside(new Vec3i(j1,k1,l1))) {
          break;
        }
        ++nrVillagersSpawned;
        EntityVillager entityvillager=new EntityVillagerFarmer(world,this.chooseProfession(nrVillagersSpawned,i1));
        entityvillager.setLocationAndAngles((double)j1 + 0.5D,(double)k1 + 1,(double)l1 + 0.5D,0.0F,0.0F);
        world.spawnEntityInWorld(entityvillager);
      }
    }
    setNumberOfSpawnedVillagers(world,nrVillagersSpawned);
  }
}

Fixed version (ground truth):
@Override protected void spawnVillagers(World world,StructureBoundingBox boundingBox,int x,int y,int z,int limit){
  if (AgriCraftConfig.villagerEnabled) {
    int nrVillagersSpawned=getNumberOfSpawnedVillagers(world);
    if (nrVillagersSpawned < limit) {
      for (int i1=nrVillagersSpawned; i1 < limit; ++i1) {
        int j1=this.getXWithOffset(x + i1,z);
        int k1=this.getYWithOffset(y);
        int l1=this.getZWithOffset(x + i1,z);
        if (!boundingBox.isVecInside(new Vec3i(j1,k1,l1))) {
          break;
        }
        ++nrVillagersSpawned;
        EntityVillager villager=new EntityVillagerFarmer(world);
        villager.setLocationAndAngles((double)j1 + 0.5D,(double)k1 + 1,(double)l1 + 0.5D,0.0F,0.0F);
        world.spawnEntityInWorld(villager);
      }
    }
    setNumberOfSpawnedVillagers(world,nrVillagersSpawned);
  }
}
Program: 95540
Project: 95540
Buggy source:
protected boolean generateStructureCrop(World world,StructureBoundingBox boundingBox,int x,int y,int z,boolean crosscrop,List<IAgriPlant> plants){
  int xCoord=this.getXWithOffset(x,z);
  int yCoord=this.getYWithOffset(y);
  int zCoord=this.getZWithOffset(x,z);
  AgriCore.getLogger("String_Node_Str").debug("String_Node_Str" + xCoord + "String_Node_Str"+ yCoord+ "String_Node_Str"+ zCoord+ "String_Node_Str");
  if (boundingBox.isVecInside(new Vec3i(xCoord,yCoord,zCoord))) {
    BlockPos pos=new BlockPos(xCoord,yCoord,zCoord);
    world.setBlockState(pos,AgriProperties.GROWTHSTAGE.applyToBlockState(AgriBlocks.getInstance().CROP.getDefaultState(),0),2);
    TileEntityCrop crop=(TileEntityCrop)world.getTileEntity(pos);
    if (crop != null) {
      if (crosscrop) {
        crop.setCrossCrop(true);
      }
 else {
        crop.setSeed(WorldGenerationHelper.getRandomSeed(world.rand,false,plants));
      }
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
protected boolean generateStructureCrop(World world,StructureBoundingBox boundingBox,int x,int y,int z,boolean crosscrop,List<IAgriPlant> plants){
  int xCoord=this.getXWithOffset(x,z);
  int yCoord=this.getYWithOffset(y);
  int zCoord=this.getZWithOffset(x,z);
  AgriCore.getLogger("String_Node_Str").debug("String_Node_Str" + xCoord + "String_Node_Str"+ yCoord+ "String_Node_Str"+ zCoord+ "String_Node_Str");
  if (boundingBox.isVecInside(new Vec3i(xCoord,yCoord,zCoord))) {
    BlockPos pos=new BlockPos(xCoord,yCoord,zCoord);
    world.setBlockState(pos,AgriProperties.GROWTHSTAGE.applyToBlockState(AgriBlocks.getInstance().CROP.getDefaultState(),0),2);
    TileEntityCrop crop=(TileEntityCrop)world.getTileEntity(pos);
    if (crop != null) {
      if (crosscrop) {
        crop.setCrossCrop(true);
      }
 else {
        if (plants.size() > 0) {
          crop.setSeed(WorldGenerationHelper.getRandomSeed(world.rand,false,plants));
        }
 else {
          AgriCore.getLogger("String_Node_Str").debug("String_Node_Str");
        }
      }
    }
    return true;
  }
 else {
    return false;
  }
}
Program: 95541
Project: 95541
Buggy source:
IAgriSoil getSoil(String id);

Fixed version (ground truth):
default IAgriSoil getSoil(FuzzyStack stack){
  return this.getSoils().stream().filter(s -> s.isVarient(stack)).findFirst().orElse(null);
}
Program: 95542
Project: 95542
Buggy source:
boolean isSoil(IAgriSoil plant);

Fixed version (ground truth):
default boolean isSoil(FuzzyStack soil){
  return this.getSoils().stream().anyMatch(s -> s.isVarient(soil));
}
Program: 95543
Project: 95543
Buggy source:
private static void registerCustomEntries(){
  AgriCore.getLogger("String_Node_Str").info("String_Node_Str");
  String[] data=new String[]{"String_Node_Str"};
  String total="String_Node_Str" + data.length + "String_Node_Str";
  for (  String line : data) {
    AgriCore.getLogger("String_Node_Str").debug("String_Node_Str" + line + total);
    ItemStack stack=((FuzzyStack)AgriCore.getConverter().toStack(line)).toStack();
    Block block=(stack != null && stack.getItem() instanceof ItemBlock) ? ((ItemBlock)stack.getItem()).block : null;
    if (block != null) {
      addDefaultSoil(new FuzzyStack(new ItemStack(block,stack.getItemDamage())));
    }
 else {
      AgriCore.getLogger("String_Node_Str").info("String_Node_Str" + line + "String_Node_Str");
    }
  }
  soils.removeIf(TypeHelper::isNull);
  AgriCore.getLogger("String_Node_Str").info("String_Node_Str");
  for (  FuzzyStack soil : soils) {
    AgriCore.getLogger("String_Node_Str").info("String_Node_Str" + Item.REGISTRY.getNameForObject(soil.getItem()) + "String_Node_Str"+ soil.getMeta());
  }
}

Fixed version (ground truth):
private static void registerCustomEntries(){
  AgriCore.getLogger("String_Node_Str").info("String_Node_Str");
  String[] data=new String[]{"String_Node_Str"};
  String total="String_Node_Str" + data.length + "String_Node_Str";
  for (  String line : data) {
    AgriCore.getLogger("String_Node_Str").debug("String_Node_Str" + line + total);
    ItemStack stack=((FuzzyStack)AgriCore.getConverter().toStack(line)).toStack();
    Block block=(stack != null && stack.getItem() instanceof ItemBlock) ? ((ItemBlock)stack.getItem()).block : null;
    if (block != null) {
      addDefaultSoil(new FuzzyStack(new ItemStack(block,stack.getItemDamage())));
    }
 else {
      AgriCore.getLogger("String_Node_Str").info("String_Node_Str" + line + "String_Node_Str");
    }
  }
  AgriCore.getLogger("String_Node_Str").info("String_Node_Str");
}
Program: 95544
Project: 95544
Buggy source:
public static boolean isSoilValid(IBlockAccess world,BlockPos pos){
  FuzzyStack soil=new FuzzyStack(world.getBlockState(pos));
  return soils.contains(soil) || defaultSoils.contains(soil);
}

Fixed version (ground truth):
public static boolean isSoilValid(IBlockAccess world,BlockPos pos){
  FuzzyStack soil=new FuzzyStack(world.getBlockState(pos));
  return SoilRegistry.getInstance().isSoil(soil) || defaultSoils.contains(soil);
}
Program: 95545
Project: 95545
Buggy source:
public static void renderComponentStack(GuiBase gui,GuiComponent<ItemStack> component){
  RenderHelper.enableGUIStandardItemLighting();
  gui.getRenderItem().renderItemAndEffectIntoGUI(component.getComponent(),0,0);
  RenderHelper.disableStandardItemLighting();
}

Fixed version (ground truth):
public static void renderComponentStack(GuiBase gui,GuiComponent<ItemStack> component){
  gui.getRenderItem().renderItemAndEffectIntoGUI(component.getComponent(),0,0);
  GlStateManager.enableAlpha();
}
Program: 95546
Project: 95546
Buggy source:
public final void renderComponent(GuiBase gui){
  if (this.isVisible && this.renderAction != null) {
    GlStateManager.pushAttrib();
    GlStateManager.pushMatrix();
    GlStateManager.translate(this.bounds.x,this.bounds.y,0);
    GlStateManager.scale(scale,scale,scale);
    this.renderAction.accept(gui,this);
    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
  }
}

Fixed version (ground truth):
public final void renderComponent(GuiBase gui){
  if (this.isVisible && this.renderAction != null) {
    GlStateManager.pushAttrib();
    GlStateManager.pushMatrix();
    GlStateManager.translate(this.bounds.x,this.bounds.y,0);
    GlStateManager.scale(scale,scale,scale);
    GlStateManager.color(1,1,1,1);
    this.renderAction.accept(gui,this);
    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
  }
}
Program: 95547
Project: 95547
Buggy source:
@Override public void registerMessages(INetworkWrapper wrapper){
  wrapper.registerMessage(MessageContainerSeedStorage.class);
  wrapper.registerMessage(MessageFertilizerApplied.class);
  wrapper.registerMessage(MessageGuiSeedStorageClearSeed.class);
  wrapper.registerMessage(MessagePeripheralCheckNeighbours.class);
  wrapper.registerMessage(MessageSendNEISetting.class);
  wrapper.registerMessage(MessageSyncFluidLevel.class);
  wrapper.registerMessage(MessageTileEntitySeedStorage.class);
}

Fixed version (ground truth):
@Override public void registerMessages(INetworkWrapper wrapper){
  wrapper.registerMessage(MessageContainerSeedStorage.class);
  wrapper.registerMessage(MessageFertilizerApplied.class);
  wrapper.registerMessage(MessageGuiSeedStorageClearSeed.class);
  wrapper.registerMessage(MessagePeripheralCheckNeighbours.class);
  wrapper.registerMessage(MessageSendNEISetting.class);
  wrapper.registerMessage(MessageSyncFluidLevel.class);
  wrapper.registerMessage(MessageTileEntitySeedStorage.class);
  wrapper.registerMessage(MessageSyncSoilJson.class);
  wrapper.registerMessage(MessageSyncPlantJson.class);
  wrapper.registerMessage(MessageSyncMutationJson.class);
}
Program: 95548
Project: 95548
Buggy source:
/** 
 * Handles right-clicks from the player. Allows the player to 'use' the block. TODO: Clean up this horrible mess of a method.
 * @return if the right-click was consumed.
 */
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return true;
  }
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (AgriItems.getInstance().HAND_RAKE.isEnabled() && heldItem == null) {
      return false;
    }
 else     if (player.isSneaking() || heldItem == null || heldItem.getItem() == null) {
      this.harvest(world,pos,state,player,crop);
    }
 else     if (TypeHelper.isAnyType(heldItem.getItem(),ITEM_EXCLUDES)) {
      return false;
    }
 else     if (FertilizerRegistry.getInstance().hasAdapter(heldItem)) {
      IAgriFertilizer fert=FertilizerRegistry.getInstance().getValue(heldItem);
      return fert == null ? false : fert.applyFertilizer(player,world,pos,crop,heldItem,RANDOM);
    }
 else     if (plantSeed(heldItem,world,pos)) {
      return true;
    }
 else     if (heldItem.getItem() == AgriItems.getInstance().CROPS) {
      this.setCrossCrop(world,pos,state,player,heldItem);
    }
 else {
      this.harvest(world,pos,state,player,crop);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Handles right-clicks from the player. Allows the player to 'use' the block. TODO: Clean up this horrible mess of a method.
 * @return if the right-click was consumed.
 */
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return true;
  }
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (AgriItems.getInstance().HAND_RAKE.isEnabled() && heldItem == null && crop.canWeed()) {
      return false;
    }
 else     if (player.isSneaking() || heldItem == null || heldItem.getItem() == null) {
      this.harvest(world,pos,state,player,crop);
    }
 else     if (TypeHelper.isAnyType(heldItem.getItem(),ITEM_EXCLUDES)) {
      return false;
    }
 else     if (FertilizerRegistry.getInstance().hasAdapter(heldItem)) {
      IAgriFertilizer fert=FertilizerRegistry.getInstance().getValue(heldItem);
      return fert == null ? false : fert.applyFertilizer(player,world,pos,crop,heldItem,RANDOM);
    }
 else     if (plantSeed(heldItem,world,pos)) {
      return true;
    }
 else     if (heldItem.getItem() == AgriItems.getInstance().CROPS) {
      this.setCrossCrop(world,pos,state,player,heldItem);
    }
 else {
      this.harvest(world,pos,state,player,crop);
    }
  }
  return true;
}
Program: 95549
Project: 95549
Buggy source:
@Override public final void renderInventoryBlock(ITessellator tessellator,World world,IBlockState state,B block,@Nullable T tile,ItemStack stack,EntityLivingBase entity,ItemCameraTransforms.TransformType type){
}

Fixed version (ground truth):
@Override public final void renderInventoryBlock(ITessellator tessellator,World world,IBlockState state,B block,@Nullable T tile,ItemStack stack,EntityLivingBase entity,ItemCameraTransforms.TransformType type){
  if (tile != null) {
    tile.setMaterial(stack);
    this.renderInventoryBlockWood(tessellator,world,state,block,tile,stack,entity,type,getIcon(tile));
  }
}
Program: 95551
Project: 95551
Buggy source:
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack,EntityPlayer player,List<String> list,boolean flag){
  if (stack == null || stack.getItem() == null) {
    list.add("String_Node_Str");
    return;
  }
  if (stack.getItem() instanceof ItemClipping) {
    stack=ItemStack.loadItemStackFromNBT(stack.getTagCompound());
  }
  if (stack == null || stack.getItem() == null) {
    list.add("String_Node_Str");
  }
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack,EntityPlayer player,List<String> list,boolean flag){
}
Program: 95552
Project: 95552
Buggy source:
/** 
 * @return a list with only mature neighbours of type<code>TileEntityCrop</code>
 */
@Override public List<IAgriCrop> getMatureNeighbours(){
  List<IAgriCrop> neighbours=getNeighbours();
  for (Iterator<IAgriCrop> iterator=neighbours.iterator(); iterator.hasNext(); ) {
    IAgriCrop crop=iterator.next();
    if (!crop.hasPlant() || !crop.isMature()) {
      iterator.remove();
    }
  }
  return neighbours;
}

Fixed version (ground truth):
/** 
 * @return a list with only mature neighbours of type<code>TileEntityCrop</code>
 */
@Override public List<IAgriCrop> getMatureNeighbours(){
  List<IAgriCrop> neighbours=getNeighbours();
  neighbours.removeIf((p) -> {
    return !(p.hasPlant() && p.isMature());
  }
);
  return neighbours;
}
Program: 95553
Project: 95553
Buggy source:
@Override public void setGrowthStage(int stage){
  if (this.hasPlant() || this.hasWeed()) {
    stage&=Constants.MATURE;
    IBlockState state=worldObj.getBlockState(pos);
    state.withProperty(AgriCraftProperties.GROWTHSTAGE,stage);
    this.worldObj.setBlockState(pos,state,3);
  }
}

Fixed version (ground truth):
@Override public void setGrowthStage(int stage){
  if (this.hasPlant() || this.hasWeed()) {
    stage=MathHelper.inRange(stage,0,Constants.MATURE);
    IBlockState state=worldObj.getBlockState(pos);
    state=state.withProperty(AgriCraftProperties.GROWTHSTAGE,stage);
    this.worldObj.setBlockState(pos,state,3);
  }
}
Program: 95554
Project: 95554
Buggy source:
/** 
 * @return a list with all neighbours of type <code>TileEntityCrop</code> inthe NORTH, SOUTH, EAST and WEST DIRECTION
 */
@Override public List<IAgriCrop> getNeighbours(){
  List<IAgriCrop> neighbours=new ArrayList<>();
  addNeighbour(neighbours,AgriForgeDirection.NORTH);
  addNeighbour(neighbours,AgriForgeDirection.SOUTH);
  addNeighbour(neighbours,AgriForgeDirection.EAST);
  addNeighbour(neighbours,AgriForgeDirection.WEST);
  return neighbours;
}

Fixed version (ground truth):
/** 
 * @return a list with all neighbours of type <code>TileEntityCrop</code> inthe NORTH, SOUTH, EAST and WEST DIRECTION
 */
@Override public List<IAgriCrop> getNeighbours(){
  return WorldHelper.getTileNeighbors(worldObj,pos,IAgriCrop.class);
}
Program: 95555
Project: 95555
Buggy source:
public CropPlantAgriCraft(IAgriCraftPlant plant){
  super();
  this.plant=plant;
  this.setTier(plant.getSeed().tier());
  this.setGrowthRequirement(plant.getGrowthRequirement());
  this.setSpreadChance(100 / getTier());
  AgriCraftItems.clipping.addPlant(this,plant.getBlock().getRegistryName().replaceFirst("String_Node_Str","String_Node_Str") + 4);
}

Fixed version (ground truth):
public CropPlantAgriCraft(IAgriCraftPlant plant){
  super();
  this.plant=plant;
  this.setTier(plant.getSeed().tier());
  this.setGrowthRequirement(plant.getGrowthRequirement());
  this.setSpreadChance(100 / getTier());
  AgriCraftItems.clipping.addPlant(this,plant.getBlock().getRegistryName().toString().replaceFirst("String_Node_Str","String_Node_Str") + 4);
}
Program: 95556
Project: 95556
Buggy source:
private void denyEvent(PlayerInteractEvent event,boolean sendToServer){
  event.setResult(Event.Result.DENY);
  event.setUseItem(Event.Result.DENY);
  event.setUseBlock(Event.Result.DENY);
  if (sendToServer && event.getWorld().isRemote) {
    FMLClientHandler.instance().getClientPlayerEntity().sendQueue.addToSendQueue(new CPacketPlayerBlockPlacement());
  }
  event.setCanceled(true);
}

Fixed version (ground truth):
private void denyEvent(PlayerInteractEvent.RightClickBlock event,boolean sendToServer){
  event.setResult(Event.Result.DENY);
  event.setUseItem(Event.Result.DENY);
  event.setUseBlock(Event.Result.DENY);
  if (sendToServer && event.getWorld().isRemote) {
    FMLClientHandler.instance().getClientPlayerEntity().sendQueue.addToSendQueue(new CPacketPlayerBlockPlacement());
  }
  event.setCanceled(true);
}
Program: 95557
Project: 95557
Buggy source:
/** 
 * Event handler to disable vanilla farming 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void vanillaSeedPlanting(PlayerInteractEvent event){
  if (event.getAction() == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    EntityPlayer player=event.getEntityPlayer();
    ItemStack stack=player.getActiveItemStack();
    if (stack != null && stack.stackSize > 0 && stack.getItem() != null && stack.getItem() instanceof IPlantable) {
      if (GrowthRequirementHandler.isSoilValid(event.getWorld(),event.getPos())) {
        if (AgriCraftConfig.disableVanillaFarming) {
          if (!allowVanillaPlanting(stack)) {
            this.denyEvent(event,false);
            return;
          }
        }
        if (stack.hasTagCompound()) {
          NBTTagCompound tag=(NBTTagCompound)stack.getTagCompound().copy();
          if (tag.hasKey(AgriCraftNBT.GROWTH) && tag.hasKey(AgriCraftNBT.GAIN) && tag.hasKey(AgriCraftNBT.STRENGTH)) {
            this.denyEvent(event,false);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Event handler to disable vanilla farming 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void vanillaSeedPlanting(PlayerInteractEvent.RightClickBlock event){
  EntityPlayer player=event.getEntityPlayer();
  ItemStack stack=player.getActiveItemStack();
  if (stack != null && stack.stackSize > 0 && stack.getItem() != null && stack.getItem() instanceof IPlantable) {
    if (GrowthRequirementHandler.isSoilValid(event.getWorld(),event.getPos())) {
      if (AgriCraftConfig.disableVanillaFarming) {
        if (!allowVanillaPlanting(stack)) {
          this.denyEvent(event,false);
          return;
        }
      }
      if (stack.hasTagCompound()) {
        NBTTagCompound tag=(NBTTagCompound)stack.getTagCompound().copy();
        if (tag.hasKey(AgriCraftNBT.GROWTH) && tag.hasKey(AgriCraftNBT.GAIN) && tag.hasKey(AgriCraftNBT.STRENGTH)) {
          this.denyEvent(event,false);
        }
      }
    }
  }
}
Program: 95558
Project: 95558
Buggy source:
/** 
 * Event handler to create water pads 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void waterPadCreation(PlayerInteractEvent event){
  if (event.getAction() == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    IBlockState state=event.getWorld().getBlockState(event.getPos());
    Block block=state.getBlock();
    if (block != Blocks.farmland) {
      return;
    }
    boolean flag=false;
    EntityPlayer player=event.getEntityPlayer();
    ItemStack stack=player.getActiveItemStack();
    if (stack != null && stack.getItem() != null && stack.getItem() instanceof ItemSpade) {
      flag=true;
    }
    if (flag) {
      if (event.getWorld().isRemote) {
        denyEvent(event,true);
      }
      event.getWorld().setBlockState(event.getPos(),com.infinityraider.agricraft.init.AgriCraftBlocks.blockWaterPad.getDefaultState(),3);
      if (!player.capabilities.isCreativeMode) {
        stack.damageItem(1,player);
        event.setResult(Event.Result.ALLOW);
      }
      SoundType sound=block.getStepSound();
      event.getWorld().playSound(null,(double)((float)event.getPos().getX() + 0.5F),(double)((float)event.getPos().getY() + 0.5F),(double)((float)event.getPos().getZ() + 0.5F),sound.getBreakSound(),SoundCategory.BLOCKS,(sound.getVolume() + 1.0F) / 2.0F,sound.getPitch() * 0.8F);
      denyEvent(event,false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Event handler to create water pads 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void waterPadCreation(PlayerInteractEvent.RightClickBlock event){
  IBlockState state=event.getWorld().getBlockState(event.getPos());
  Block block=state.getBlock();
  if (block != Blocks.farmland) {
    return;
  }
  boolean flag=false;
  EntityPlayer player=event.getEntityPlayer();
  ItemStack stack=player.getActiveItemStack();
  if (stack != null && stack.getItem() != null && stack.getItem() instanceof ItemSpade) {
    flag=true;
  }
  if (flag) {
    if (event.getWorld().isRemote) {
      denyEvent(event,true);
    }
    event.getWorld().setBlockState(event.getPos(),com.infinityraider.agricraft.init.AgriCraftBlocks.blockWaterPad.getDefaultState(),3);
    if (!player.capabilities.isCreativeMode) {
      stack.damageItem(1,player);
      event.setResult(Event.Result.ALLOW);
    }
    SoundType sound=block.getStepSound();
    event.getWorld().playSound(null,(double)((float)event.getPos().getX() + 0.5F),(double)((float)event.getPos().getY() + 0.5F),(double)((float)event.getPos().getZ() + 0.5F),sound.getBreakSound(),SoundCategory.BLOCKS,(sound.getVolume() + 1.0F) / 2.0F,sound.getPitch() * 0.8F);
    denyEvent(event,false);
  }
}