nus-yam/ex-repair huggingface dataset:
Program: 95601
Project: 95601
Buggy source:
@Override public void createMultiBlock(){
  int fluidLevel=0;
  TileEntityTank root=getRootComponent();
  World world=root.getWorldObj();
  for (int x=root.xCoord; x < root.xCoord + sizeX; x++) {
    for (int y=root.yCoord; y < root.yCoord + sizeY; y++) {
      for (int z=root.zCoord; z < root.zCoord + sizeZ; z++) {
        TileEntityTank tank=(TileEntityTank)world.getTileEntity(x,y,z);
        fluidLevel=fluidLevel + tank.getFluidLevel();
        tank.setMultiBlockLogic(this);
      }
    }
  }
  this.getRootComponent().setFluidLevel(fluidLevel);
}

Fixed version (ground truth):
@Override public void createMultiBlock(){
  TileEntityTank root=getRootComponent();
  World world=root.getWorldObj();
  for (int x=root.xCoord; x < root.xCoord + sizeX; x++) {
    for (int y=root.yCoord; y < root.yCoord + sizeY; y++) {
      for (int z=root.zCoord; z < root.zCoord + sizeZ; z++) {
        IMultiBlockComponent component=(IMultiBlockComponent)world.getTileEntity(x,y,z);
        component.setMultiBlockLogic(this);
      }
    }
  }
}
Program: 95602
Project: 95602
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,entity,stack);
  if (world.getTileEntity(x,y,z) != null && world.getTileEntity(x,y,z) instanceof TileEntityCustomWood) {
    TileEntityCustomWood tileEntity=(TileEntityCustomWood)world.getTileEntity(x,y,z);
    tileEntity.setMaterial(stack);
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity,ItemStack stack){
  if (world.getTileEntity(x,y,z) != null && world.getTileEntity(x,y,z) instanceof TileEntityCustomWood) {
    TileEntityCustomWood tileEntity=(TileEntityCustomWood)world.getTileEntity(x,y,z);
    tileEntity.setMaterial(stack);
  }
  super.onBlockPlacedBy(world,x,y,z,entity,stack);
}
Program: 95603
Project: 95603
Buggy source:
@Override public void syncMultiBlockToClient(){
  if (!worldObj.isRemote) {
    NetworkWrapperAgriCraft.wrapper.sendToDimension(new MessageSyncMultiBlock(this),worldObj.provider.dimensionId);
  }
}

Fixed version (ground truth):
@Override public void syncMultiBlockToClient(){
  if (!worldObj.isRemote) {
    NetworkWrapperAgriCraft.wrapper.sendToDimension(new MessageSyncMultiBlock(this),worldObj.provider.dimensionId);
    this.worldObj.getChunkFromBlockCoords(this.xCoord,this.zCoord).setChunkModified();
  }
}
Program: 95604
Project: 95604
Buggy source:
/** 
 * Reads NBT data from an NBTTagCompound
 * @param tag the NBTTagCompound to read data from
 */
public void readFromNBT(NBTTagCompound tag){
  this.sizeX=tag.getInteger(Names.NBT.x);
  this.sizeY=tag.getInteger(Names.NBT.y);
  this.sizeZ=tag.getInteger(Names.NBT.z);
  int x=tag.getInteger(Names.NBT.x2);
  int y=tag.getInteger(Names.NBT.y2);
  int z=tag.getInteger(Names.NBT.z2);
  World world=this.getRootComponent().getTileEntity().getWorldObj();
  if (world == null) {
    MultiBlockCache.getCache().addToCache(this.rootComponent,x,y,z,sizeX() * sizeY() * sizeZ());
  }
 else {
  }
}

Fixed version (ground truth):
/** 
 * Reads NBT data from an NBTTagCompound
 * @param tag the NBTTagCompound to read data from
 */
public void readFromNBT(NBTTagCompound tag){
  this.sizeX=tag.getInteger(Names.NBT.x);
  this.sizeY=tag.getInteger(Names.NBT.y);
  this.sizeZ=tag.getInteger(Names.NBT.z);
  int x=tag.getInteger(Names.NBT.x2);
  int y=tag.getInteger(Names.NBT.y2);
  int z=tag.getInteger(Names.NBT.z2);
  TileEntity tile=this.getRootComponent().getTileEntity();
  World world=this.getRootComponent().getTileEntity().getWorldObj();
  if (world != null) {
    if (tile.xCoord == x && tile.yCoord == y && tile.zCoord == z) {
      this.createMultiBlock();
    }
  }
}
Program: 95605
Project: 95605
Buggy source:
@Override public Object[] call(World world,int x,int y,int z,ItemStack journal,Object... args) throws MethodException {
  return new Object[]{journal != null};
}

Fixed version (ground truth):
@Override public Object[] call(TileEntityPeripheral peripheral,World world,int x,int y,int z,ItemStack journal,Object... args) throws MethodException {
  return new Object[]{journal != null};
}
Program: 95606
Project: 95606
Buggy source:
@Override public String getInformation(){
  return getSeed().getUnlocalizedName();
}

Fixed version (ground truth):
@Override public String getInformation(){
  String name=getSeed().getUnlocalizedName();
  if (name.indexOf('_') >= 0) {
    name=name.substring(name.indexOf('_') + 1);
  }
  if (name.indexOf('.') >= 0) {
    name=name.substring(name.indexOf('.') + 1);
  }
  return "String_Node_Str" + name;
}
Program: 95607
Project: 95607
Buggy source:
@Override public boolean onBlockEventReceived(World world,int x,int y,int z,int id,int data){
  super.onBlockEventReceived(world,x,y,z,id,data);
  TileEntity tileentity=world.getTileEntity(x,y,z);
  return tileentity != null && tileentity.receiveClientEvent(id,data);
}

Fixed version (ground truth):
@Override public boolean onBlockEventReceived(World world,int x,int y,int z,int id,int data){
  TileEntity tileentity=world.getTileEntity(x,y,z);
  return tileentity != null && tileentity.receiveClientEvent(id,data);
}
Program: 95608
Project: 95608
Buggy source:
@Override public List<ItemStack> getSeedEntries(){
  return null;
}

Fixed version (ground truth):
@Override public List<ItemStack> getSeedEntries(){
  ArrayList<ItemStack> list=this.te.getInventory();
  return list;
}
Program: 95609
Project: 95609
Buggy source:
/** 
 * Handles shift clicking in the inventory, return the stack that was transferred
 */
@Override public ItemStack transferStackInSlot(EntityPlayer player,int clickedSlot){
  ItemStack itemstack=null;
  Slot slot=(Slot)this.inventorySlots.get(clickedSlot);
  if (slot != null && slot.getHasStack()) {
    ItemStack itemstack1=slot.getStack();
    itemstack=itemstack1.copy();
    if (slot != null) {
      if (SeedHelper.isAnalyzedSeed(itemstack1)) {
        if (this.addSeedToStorage(itemstack1)) {
          itemstack1.stackSize=0;
        }
 else {
          return null;
        }
      }
    }
    if (itemstack1.stackSize == 0) {
      slot.putStack(null);
    }
 else {
      slot.onSlotChanged();
    }
    if (itemstack1.stackSize == itemstack.stackSize) {
      return null;
    }
    slot.onPickupFromSlot(player,itemstack1);
  }
  return itemstack;
}

Fixed version (ground truth):
/** 
 * Handles shift clicking in the inventory, return the stack that was transferred
 */
@Override public ItemStack transferStackInSlot(EntityPlayer player,int clickedSlot){
  ItemStack originalStackInSlot=null;
  Slot slot=(Slot)this.inventorySlots.get(clickedSlot);
  if (slot != null && slot.getHasStack()) {
    ItemStack notMergedStack=slot.getStack();
    originalStackInSlot=notMergedStack.copy();
    if (slot != null) {
      if (SeedHelper.isAnalyzedSeed(notMergedStack)) {
        if (this.addSeedToStorage(notMergedStack)) {
          notMergedStack.stackSize=0;
        }
 else {
          return null;
        }
      }
    }
    if (notMergedStack.stackSize == 0) {
      slot.putStack(null);
    }
 else {
      slot.onSlotChanged();
    }
    if (notMergedStack.stackSize == originalStackInSlot.stackSize) {
      return null;
    }
    slot.onPickupFromSlot(player,notMergedStack);
  }
  return originalStackInSlot;
}
Program: 95610
Project: 95610
Buggy source:
/** 
 * Tries to move an item stack form the correct tile entity to the player's inventory
 */
public void moveStackFromTileEntityToPlayer(int slotId,ItemStack stack){
  ISeedStorageControllable controllable=this.getControllable(stack);
  if (controllable != null) {
    ItemStack stackToMove=controllable.getStackInSlot(slotId);
    stackToMove.stackSize=stack.stackSize;
    stackToMove.stackTagCompound=controllable.getStackInSlot(slotId).stackTagCompound;
    if (this.mergeItemStack(stackToMove,0,PLAYER_INVENTORY_SIZE,false)) {
      if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        LogHelper.debug("String_Node_Str");
        NetworkWrapperAgriCraft.wrapper.sendToServer(new MessageContainerSeedStorage(stack,Minecraft.getMinecraft().thePlayer,slotId));
      }
      LogHelper.debug("String_Node_Str");
      controllable.decrStackSize(slotId,stack.stackSize - stackToMove.stackSize);
    }
  }
}

Fixed version (ground truth):
/** 
 * Tries to move an item stack form the correct tile entity to the player's inventory
 */
public void moveStackFromTileEntityToPlayer(int slotId,ItemStack stack){
  ISeedStorageControllable controllable=this.getControllable(stack);
  if (controllable != null) {
    ItemStack stackToMove=controllable.getStackInSlot(slotId);
    if (stack == null) {
      return;
    }
    stackToMove.stackSize=stack.stackSize;
    stackToMove.stackTagCompound=controllable.getStackInSlot(slotId).stackTagCompound;
    if (this.mergeItemStack(stackToMove,0,PLAYER_INVENTORY_SIZE,false)) {
      if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        LogHelper.debug("String_Node_Str");
        NetworkWrapperAgriCraft.wrapper.sendToServer(new MessageContainerSeedStorage(stack,Minecraft.getMinecraft().thePlayer,slotId));
      }
 else {
        LogHelper.debug("String_Node_Str");
        controllable.decrStackSize(slotId,stack.stackSize - stackToMove.stackSize);
      }
    }
  }
}
Program: 95611
Project: 95611
Buggy source:
@Override public void setLockedSeed(Item seed,int meta){
  if (!this.hasLockedSeed()) {
    this.lockedSeed=seed;
    this.lockedSeedMeta=meta;
    this.markForUpdate();
  }
}

Fixed version (ground truth):
@Override public void setLockedSeed(Item seed,int meta){
  if (!this.hasLockedSeed()) {
    this.lockedSeed=seed;
    this.lockedSeedMeta=meta;
  }
}
Program: 95612
Project: 95612
Buggy source:
@Override public ItemStack decrStackSize(int slot,int amount){
  slot=slot % 1000;
  ItemStack stackInSlot=null;
  if (this.slots != null) {
    SeedStorageSlot slotAt=this.slots.get(slot);
    if (slotAt != null) {
      stackInSlot=slotAt.getStack(this.lockedSeed,this.lockedSeedMeta);
      if (slotAt.count <= amount) {
        this.slots.remove(slot);
      }
 else {
        slotAt.count=slotAt.count - amount;
      }
    }
  }
  if (!worldObj.isRemote) {
    this.worldObj.addBlockEvent(this.xCoord,this.yCoord,this.zCoord,this.getBlockType(),slot,amount);
  }
  return stackInSlot;
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  if (!worldObj.isRemote) {
    slot=slot % 1000;
    ItemStack stackInSlot=null;
    if (this.slots != null) {
      SeedStorageSlot slotAt=this.slots.get(slot);
      if (slotAt != null) {
        stackInSlot=slotAt.getStack(this.lockedSeed,this.lockedSeedMeta);
        stackInSlot.stackSize=Math.min(amount,slotAt.count);
        if (slotAt.count <= amount) {
          this.slots.remove(slot);
          slotAt.count=0;
        }
 else {
          slotAt.count=slotAt.count - amount;
        }
      }
      this.syncSlotToClient(slotAt);
    }
    return stackInSlot;
  }
  return null;
}
Program: 95613
Project: 95613
Buggy source:
@Override public boolean addStackToInventory(ItemStack stack){
  boolean success=false;
  if (!this.worldObj.isRemote) {
    if (this.hasLockedSeed() && SeedHelper.isAnalyzedSeed(stack) && this.lockedSeed == stack.getItem() && this.lockedSeedMeta == stack.getItemDamage()) {
      int lastId=0;
      for (      Map.Entry<Integer,SeedStorageSlot> entry : this.slots.entrySet()) {
        lastId=entry.getKey() > lastId ? entry.getKey() : lastId;
        if (entry.getValue() != null) {
          if (ItemStack.areItemStackTagsEqual(entry.getValue().getStack(this.lockedSeed,this.lockedSeedMeta),stack)) {
            this.setInventorySlotContents(entry.getKey(),stack);
            success=true;
            break;
          }
        }
      }
      if (!success) {
        this.setInventorySlotContents(lastId + 1,stack);
        success=true;
      }
    }
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean addStackToInventory(ItemStack stack){
  boolean success=false;
  if (!this.worldObj.isRemote) {
    if (this.hasLockedSeed() && SeedHelper.isAnalyzedSeed(stack) && this.lockedSeed == stack.getItem() && this.lockedSeedMeta == stack.getItemDamage()) {
      int lastId=0;
      for (      Map.Entry<Integer,SeedStorageSlot> entry : this.slots.entrySet()) {
        lastId=entry.getKey() > lastId ? entry.getKey() : lastId;
        if (entry.getValue() != null) {
          if (ItemStack.areItemStackTagsEqual(entry.getValue().getStack(this.lockedSeed,this.lockedSeedMeta),stack)) {
            this.setInventorySlotContents(entry.getKey(),stack);
            success=true;
            break;
          }
        }
      }
      if (!success) {
        if (this.slots.size() == 0) {
          this.setInventorySlotContents(0,stack);
        }
 else {
          this.setInventorySlotContents(lastId + 1,stack);
        }
        success=true;
      }
    }
  }
  return success;
}
Program: 95614
Project: 95614
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  slot=slot % 1000;
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slots.get(slot);
    if (slotAt != null) {
      slotAt.count=slotAt.count + inputStack.stackSize;
    }
 else {
      this.slots.put(slot,new SeedStorageSlot(inputStack.getTagCompound(),inputStack.stackSize,slot,this.getControllableID()));
    }
    if (!this.worldObj.isRemote) {
      this.syncSlotToClient(slot);
    }
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  slot=slot % 1000;
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slots.get(slot);
    if (slotAt != null) {
      slotAt.count=inputStack.stackSize;
      if (slotAt.count <= 0) {
        slots.remove(slot);
      }
    }
 else {
      slotAt=new SeedStorageSlot(inputStack.getTagCompound(),inputStack.stackSize,slot,this.getControllableID());
      if (slotAt.count > 0) {
        this.slots.put(slot,slotAt);
      }
    }
    if (!this.worldObj.isRemote) {
      this.syncSlotToClient(slotAt);
    }
 else {
      this.markForUpdate();
    }
  }
}
Program: 95615
Project: 95615
Buggy source:
public void syncSlotToClient(int slot){
  NetworkWrapperAgriCraft.wrapper.sendToDimension(new MessageTileEntitySeedStorage(this.xCoord,this.yCoord,this.zCoord,slots.get(slot)),this.worldObj.provider.dimensionId);
}

Fixed version (ground truth):
public void syncSlotToClient(SeedStorageSlot slot){
  NetworkWrapperAgriCraft.wrapper.sendToDimension(new MessageTileEntitySeedStorage(this.xCoord,this.yCoord,this.zCoord,slot),this.worldObj.provider.dimensionId);
  this.worldObj.getChunkFromBlockCoords(this.xCoord,this.zCoord).setChunkModified();
}
Program: 95616
Project: 95616
Buggy source:
@Override public ItemStack getStackInSlotOnClosing(int slot){
  slot=slot % 1000;
  ItemStack stackInSlot=null;
  if (this.slots != null) {
    stackInSlot=this.getStackInSlot(slot).copy();
  }
  return stackInSlot;
}

Fixed version (ground truth):
@Override public ItemStack getStackInSlotOnClosing(int slot){
  slot=slot % 1000;
  ItemStack stackInSlot=null;
  if (this.slots != null) {
    stackInSlot=this.getStackInSlot(slot).copy();
    this.slots.remove(slot);
  }
  return stackInSlot;
}
Program: 95617
Project: 95617
Buggy source:
private static void findHelpers(){
  Class[] classes={AppleCoreHelper.class,BluePowerHelper.class,ChocoCraftHelper.class,ExNihiloHelper.class,HarvestcraftHelper.class,HungerOverhaulHelper.class,MagicalCropsHelper.class,MFRHelper.class,MinetweakerHelper.class,NaturaHelper.class,PlantMegaPackHelper.class,PsychedelicraftHelper.class,ThaumcraftHelper.class,WailaHelper.class};
  for (  Class clazz : classes) {
    if (ModHelper.class.isAssignableFrom(clazz)) {
      createInstance(clazz);
    }
  }
}

Fixed version (ground truth):
private static void findHelpers(){
  Class[] classes={AppleCoreHelper.class,BluePowerHelper.class,ChocoCraftHelper.class,ExNihiloHelper.class,HarvestcraftHelper.class,HungerOverhaulHelper.class,MagicalCropsHelper.class,MFRHelper.class,MinetweakerHelper.class,NaturaHelper.class,PlantMegaPackHelper.class,PsychedelicraftHelper.class,ThaumcraftHelper.class,WailaHelper.class,WeeeFlowersHelper.class};
  for (  Class clazz : classes) {
    if (ModHelper.class.isAssignableFrom(clazz)) {
      createInstance(clazz);
    }
  }
}
Program: 95618
Project: 95618
Buggy source:
private void getDropMeta(){
  try {
    Block plant=getPlant();
    Method[] methods=plant.getClass().getDeclaredMethods();
    for (    Method method : methods) {
      if (method.getReturnType() != int.class) {
        continue;
      }
      Class[] params=method.getParameterTypes();
      if (params == null || params.length != 1) {
        continue;
      }
      if (params[0] != int.class) {
        continue;
      }
      LogHelper.debug("String_Node_Str" + method.toString());
      Object result=method.invoke(plant,7);
      this.meta=(Integer)result;
      break;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    this.meta=-1;
  }
}

Fixed version (ground truth):
private void getDropMeta(){
  try {
    Block plant=getPlant();
    Method[] methods=plant.getClass().getDeclaredMethods();
    for (    Method method : methods) {
      if (method.getReturnType() != int.class) {
        continue;
      }
      Class[] params=method.getParameterTypes();
      if (params == null || params.length != 1) {
        continue;
      }
      if (params[0] != int.class) {
        continue;
      }
      Object result=method.invoke(plant,7);
      this.meta=(Integer)result;
      break;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    this.meta=-1;
  }
}
Program: 95621
Project: 95621
Buggy source:
public static void initModdedResources(){
  modCrops=new ArrayList<BlockModPlant>();
  modSeeds=new ArrayList<ItemModSeed>();
  for (  String[] data : Data.modResources) {
    Block base=OreDictHelper.getOreBlockForName(data[0]);
    if (base != null) {
      Object[] args={data[1],OreDictHelper.getNuggetForName(data[0]),OreDictHelper.getNuggetMetaForName(data[0]),null,OreDictHelper.getOreBlockForName(data[0]),OreDictHelper.getOreMetaForName(data[0]),0,4,6};
      String name=(String)args[0];
      BlockModPlant plant=new BlockModPlant(args);
      modCrops.add(plant);
      RegisterHelper.registerCrop(plant,name);
      ItemModSeed seed=new ItemModSeed(plant,"String_Node_Str" + Character.toLowerCase(name.charAt(0)) + name.substring(1));
      modSeeds.add(seed);
      RegisterHelper.registerSeed(seed,plant);
    }
  }
}

Fixed version (ground truth):
public static void initModdedResources(){
  modCrops=new ArrayList<BlockModPlant>();
  modSeeds=new ArrayList<ItemModSeed>();
  for (  String[] data : Data.modResources) {
    Block base=OreDictHelper.getOreBlockForName(data[0]);
    if (base != null) {
      Object[] args={data[1],OreDictHelper.getNuggetForName(data[0]),OreDictHelper.getNuggetMetaForName(data[0]),null,OreDictHelper.getOreBlockForName(data[0]),OreDictHelper.getOreMetaForName(data[0]),4,6};
      String name=(String)args[0];
      BlockModPlant plant=new BlockModPlant(args);
      modCrops.add(plant);
      RegisterHelper.registerCrop(plant,name);
      ItemModSeed seed=new ItemModSeed(plant,"String_Node_Str" + Character.toLowerCase(name.charAt(0)) + name.substring(1));
      modSeeds.add(seed);
      RegisterHelper.registerSeed(seed,plant);
    }
  }
}
Program: 95622
Project: 95622
Buggy source:
@Override public void addDebugInfo(List<String> list){
  list.add("String_Node_Str");
  if (this.crossCrop) {
    list.add("String_Node_Str");
  }
 else   if (this.hasPlant()) {
    list.add("String_Node_Str");
    list.add("String_Node_Str" + (this.plant.getSeed().getItem()).getUnlocalizedName());
    list.add("String_Node_Str" + Item.itemRegistry.getNameForObject((this.plant.getSeed().getItem())) + "String_Node_Str"+ this.plant.getSeed().getItemDamage());
    list.add("String_Node_Str" + this.getBlockMetadata());
    list.add("String_Node_Str" + this.growth);
    list.add("String_Node_Str" + this.gain);
    list.add("String_Node_Str" + this.strength);
    list.add("String_Node_Str" + this.isFertile());
    list.add("String_Node_Str" + this.isMature());
  }
 else   if (this.weed) {
    list.add("String_Node_Str");
    list.add("String_Node_Str" + this.getBlockMetadata());
  }
 else {
    list.add("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void addDebugInfo(List<String> list){
  list.add("String_Node_Str");
  if (this.crossCrop) {
    list.add("String_Node_Str");
  }
 else   if (this.hasPlant()) {
    list.add("String_Node_Str");
    list.add("String_Node_Str" + (this.plant.getSeed().getItem()).getUnlocalizedName());
    list.add("String_Node_Str" + Item.itemRegistry.getNameForObject((this.plant.getSeed().getItem())) + "String_Node_Str"+ this.plant.getSeed().getItemDamage());
    list.add("String_Node_Str" + plant.getTier());
    list.add("String_Node_Str" + this.getBlockMetadata());
    list.add("String_Node_Str" + this.growth);
    list.add("String_Node_Str" + this.gain);
    list.add("String_Node_Str" + this.strength);
    list.add("String_Node_Str" + this.isFertile());
    list.add("String_Node_Str" + this.isMature());
  }
 else   if (this.weed) {
    list.add("String_Node_Str");
    list.add("String_Node_Str" + this.getBlockMetadata());
  }
 else {
    list.add("String_Node_Str");
  }
}
Program: 95623
Project: 95623
Buggy source:
public int getProgressScaled(int scale){
  return (int)Math.round(((float)this.progress * scale) / ((float)this.maxProgress()));
}

Fixed version (ground truth):
public int getProgressScaled(int scale){
  return Math.round(((float)this.progress * scale) / ((float)this.maxProgress()));
}
Program: 95624
Project: 95624
Buggy source:
public boolean hasSeed(){
  return this.seed != null && this.seed.getItem() instanceof ItemSeeds;
}

Fixed version (ground truth):
public boolean hasSeed(){
  return CropPlantHandler.isValidSeed(this.seed);
}
Program: 95625
Project: 95625
Buggy source:
@Mod.EventHandler public static void preInit(FMLPreInitializationEvent event){
  LogHelper.debug("String_Node_Str");
  LoadedMods.init();
  proxy.registerEventHandlers();
  NetworkWrapperAgriCraft.init();
  ConfigurationHandler.init(event);
  FMLCommonHandler.instance().bus().register(new ConfigurationHandler());
  if (ConfigurationHandler.debug) {
    FMLCommonHandler.instance().bus().register(new RenderLogger());
  }
  Blocks.init();
  Crops.initDefaults();
  Items.init();
  APISelector.init();
  LogHelper.debug("String_Node_Str");
}

Fixed version (ground truth):
@Mod.EventHandler public static void preInit(FMLPreInitializationEvent event){
  LogHelper.debug("String_Node_Str");
  LoadedMods.init();
  proxy.registerEventHandlers();
  NetworkWrapperAgriCraft.init();
  ConfigurationHandler.init(event);
  FMLCommonHandler.instance().bus().register(new ConfigurationHandler());
  if (ConfigurationHandler.debug) {
    FMLCommonHandler.instance().bus().register(new RenderLogger());
  }
  Blocks.init();
  Crops.init();
  Items.init();
  APISelector.init();
  LogHelper.debug("String_Node_Str");
}
Program: 95626
Project: 95626
Buggy source:
@Mod.EventHandler public static void postInit(FMLPostInitializationEvent event){
  LogHelper.debug("String_Node_Str");
  ResourceCrops.init();
  CustomCrops.initCustomCrops();
  Crops.initBotaniaCrops();
  ModHelper.initHelpers();
  Recipes.init();
  SeedHelper.init();
  GrowthRequirementHandler.init();
  CustomCrops.initGrassSeeds();
  CropPlantHandler.init();
  MutationHandler.init();
  if (!ConfigurationHandler.disableWorldGen) {
    WorldGen.init();
  }
  proxy.initNEI();
  LogHelper.debug("String_Node_Str");
}

Fixed version (ground truth):
@Mod.EventHandler public static void postInit(FMLPostInitializationEvent event){
  LogHelper.debug("String_Node_Str");
  ResourceCrops.init();
  CustomCrops.init();
  ModHelper.initHelpers();
  Recipes.init();
  SeedHelper.init();
  GrowthRequirementHandler.init();
  CustomCrops.initGrassSeeds();
  CropPlantHandler.init();
  MutationHandler.init();
  if (!ConfigurationHandler.disableWorldGen) {
    WorldGen.init();
  }
  proxy.initNEI();
  LogHelper.debug("String_Node_Str");
}
Program: 95627
Project: 95627
Buggy source:
private static void findHelpers(){
  Class[] classes={AppleCoreHelper.class,BluePowerHelper.class,ChocoCraftHelper.class,ExNihiloHelper.class,HarvestcraftHelper.class,HungerOverhaulHelper.class,MagicalCropsHelper.class,MFRHelper.class,MinetweakerHelper.class,MobDropCropsHelper.class,NaturaHelper.class,PlantMegaPackHelper.class,PsychedelicraftHelper.class,ThaumcraftHelper.class,WailaHelper.class,WeeeFlowersHelper.class};
  for (  Class clazz : classes) {
    if (ModHelper.class.isAssignableFrom(clazz)) {
      createInstance(clazz);
    }
  }
}

Fixed version (ground truth):
private static void findHelpers(){
  Class[] classes={AppleCoreHelper.class,BluePowerHelper.class,BotaniaHelper.class,ChocoCraftHelper.class,ExNihiloHelper.class,HarvestcraftHelper.class,HungerOverhaulHelper.class,MagicalCropsHelper.class,MFRHelper.class,MinetweakerHelper.class,MobDropCropsHelper.class,NaturaHelper.class,PlantMegaPackHelper.class,PsychedelicraftHelper.class,ThaumcraftHelper.class,WailaHelper.class,WeeeFlowersHelper.class,WitcheryHelper.class};
  for (  Class clazz : classes) {
    if (ModHelper.class.isAssignableFrom(clazz)) {
      try {
        createInstance(clazz);
      }
 catch (      Exception e) {
        if (ConfigurationHandler.debug) {
          e.printStackTrace();
        }
      }
    }
  }
}
Program: 95628
Project: 95628
Buggy source:
private static void hideItems(){
  LogHelper.debug("String_Node_Str");
  for (int i=0; i < 16; i++) {
    AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockCrop,1,i));
    AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockSprinkler,1,i));
    for (    BlockModPlant plant : Crops.crops) {
      AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
    }
    if (ConfigurationHandler.integration_Botania) {
      for (      BlockModPlant plant : Crops.botaniaCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
    }
    if (ConfigurationHandler.resourcePlants) {
      for (      BlockModPlant plant : ResourceCrops.vanillaCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
      for (      BlockModPlant plant : ResourceCrops.modCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
    }
    if (ConfigurationHandler.customCrops) {
      for (      BlockModPlant customCrop : CustomCrops.customCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(customCrop,1,i));
      }
    }
    if (ConfigurationHandler.debug) {
      AgriCraft.proxy.hideItemInNEI(new ItemStack(Items.debugItem,1,i));
    }
  }
}

Fixed version (ground truth):
private static void hideItems(){
  LogHelper.debug("String_Node_Str");
  for (int i=0; i < 16; i++) {
    AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockCrop,1,i));
    AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockSprinkler,1,i));
    for (    BlockModPlant plant : Crops.crops) {
      AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
    }
    if (ConfigurationHandler.integration_Botania) {
      for (      BlockModPlant plant : BotaniaHelper.botaniaCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
    }
    if (ConfigurationHandler.resourcePlants) {
      for (      BlockModPlant plant : ResourceCrops.vanillaCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
      for (      BlockModPlant plant : ResourceCrops.modCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(plant,1,i));
      }
    }
    if (ConfigurationHandler.customCrops) {
      for (      BlockModPlant customCrop : CustomCrops.customCrops) {
        AgriCraft.proxy.hideItemInNEI(new ItemStack(customCrop,1,i));
      }
    }
    if (ConfigurationHandler.debug) {
      AgriCraft.proxy.hideItemInNEI(new ItemStack(Items.debugItem,1,i));
    }
  }
}
Program: 95630
Project: 95630
Buggy source:
@Override protected void initPlants(){
}

Fixed version (ground truth):
@Override protected void initPlants(){
  Aspects.registerAspects();
}
Program: 95631
Project: 95631
Buggy source:
@Override protected void init(){
  FMLInterModComms.sendMessage(Names.Mods.thaumcraft,"String_Node_Str",new ItemStack(Blocks.blockCrop,1,7));
  Aspects.registerAspects();
}

Fixed version (ground truth):
@Override protected void init(){
  FMLInterModComms.sendMessage(Names.Mods.thaumcraft,"String_Node_Str",new ItemStack(Blocks.blockCrop,1,7));
}
Program: 95633
Project: 95633
Buggy source:
public static void renderStemPlant(int x,int y,int z,RenderBlocks renderer,IIcon icon,int meta,Block vine,Block block,boolean mature){
  Tessellator tessellator=Tessellator.instance;
  int translation=meta >= 6 ? 0 : 5 - meta;
  tessellator.setBrightness(vine.getMixedBrightnessForBlock(renderer.blockAccess,x,y,z));
  int l=vine.getRenderColor(7);
  float f=(float)(l >> 16 & 255) / 255.0F;
  float f1=(float)(l >> 8 & 255) / 255.0F;
  float f2=(float)(l & 255) / 255.0F;
  tessellator.setColorOpaque_F(f,f1,f2);
  tessellator.addTranslation(x,y - Constants.unit * 2 * translation,z);
  if (mature) {
    renderStemPattern(tessellator,icon);
  }
 else {
    renderCrossPattern(tessellator,icon,0);
  }
  tessellator.addTranslation(-x,-y + Constants.unit * 2 * translation,-z);
  if (mature) {
    float u=Constants.unit;
    boolean renderFacesSetting=renderer.renderAllFaces;
    renderer.renderAllFaces=true;
    renderer.setRenderBounds(7 * u,0,2 * u,11 * u,4 * u,6 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(10 * u,0,7 * u,14 * u,4 * u,11 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(5 * u,0,10 * u,9 * u,4 * u,14 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(2 * u,0,5 * u,6 * u,4 * u,9 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.renderAllFaces=renderFacesSetting;
  }
}

Fixed version (ground truth):
public static void renderStemPlant(int x,int y,int z,RenderBlocks renderer,IIcon icon,int meta,Block vine,Block block,boolean mature){
  Tessellator tessellator=Tessellator.instance;
  int translation=meta >= 6 ? 0 : 5 - meta;
  tessellator.setBrightness(vine.getMixedBrightnessForBlock(renderer.blockAccess,x,y,z));
  int l=vine.getRenderColor(meta);
  float f=(float)(l >> 16 & 255) / 255.0F;
  float f1=(float)(l >> 8 & 255) / 255.0F;
  float f2=(float)(l & 255) / 255.0F;
  tessellator.setColorOpaque_F(f,f1,f2);
  tessellator.addTranslation(x,y - Constants.unit * 2 * translation,z);
  if (mature) {
    renderStemPattern(tessellator,icon);
  }
 else {
    renderCrossPattern(tessellator,icon,0);
  }
  tessellator.addTranslation(-x,-y + Constants.unit * 2 * translation,-z);
  if (mature) {
    float u=Constants.unit;
    boolean renderFacesSetting=renderer.renderAllFaces;
    renderer.renderAllFaces=true;
    renderer.setRenderBounds(7 * u,0,2 * u,11 * u,4 * u,6 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(10 * u,0,7 * u,14 * u,4 * u,11 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(5 * u,0,10 * u,9 * u,4 * u,14 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.setRenderBounds(2 * u,0,5 * u,6 * u,4 * u,9 * u);
    renderer.renderStandardBlock(block,x,y,z);
    renderer.renderAllFaces=renderFacesSetting;
  }
}
Program: 95636
Project: 95636
Buggy source:
public void addProduce(ItemStack stack,int weight,boolean overwrite){
  if (overwrite) {
    this.removeProduce(stack);
  }
  this.products.add(new Product(stack,weight));
  this.totalWeight=this.totalWeight + weight;
}

Fixed version (ground truth):
public void addProduce(ItemStack stack,int weight,int minGain,boolean overwrite){
  if (overwrite) {
    this.removeProduce(stack);
  }
  this.products.add(new Product(stack,weight,minGain));
  this.totalWeight=this.totalWeight + weight;
}
Program: 95637
Project: 95637
Buggy source:
public Product(ItemStack product,int weight){
  this.product=product.copy();
  this.product.stackSize=1;
  this.weight=weight;
}

Fixed version (ground truth):
public Product(ItemStack product,int weight,int minGain){
  this.product=product.copy();
  this.product.stackSize=1;
  this.weight=weight;
  this.minGain=minGain;
}
Program: 95638
Project: 95638
Buggy source:
@SubscribeEvent(priority=EventPriority.HIGHEST) public void onPlayerUseItemEvent(PlayerInteractEvent event){
  if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    Block block=event.world.getBlock(event.x,event.y,event.z);
    if (event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().stackSize > 0 && event.entityPlayer.getCurrentEquippedItem().getItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof IPlantable) {
      if (GrowthRequirements.isSoilValid(event.world,event.x,event.y,event.z) || block == Blocks.farmland) {
        if (ConfigurationHandler.disableVanillaFarming) {
          this.denyEvent(event,false);
        }
 else         if (event.entityPlayer.getCurrentEquippedItem().hasTagCompound()) {
          NBTTagCompound tag=(NBTTagCompound)event.entityPlayer.getCurrentEquippedItem().getTagCompound().copy();
          if (tag.hasKey(Names.NBT.growth) && tag.hasKey(Names.NBT.gain) && tag.hasKey(Names.NBT.strength)) {
            this.denyEvent(event,false);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent(priority=EventPriority.HIGHEST) public void onPlayerUseItemEvent(PlayerInteractEvent event){
  if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    Block block=event.world.getBlock(event.x,event.y,event.z);
    if (event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().stackSize > 0 && event.entityPlayer.getCurrentEquippedItem().getItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof IPlantable) {
      if (GrowthRequirements.isSoilValid(event.world,event.x,event.y,event.z) || block == Blocks.farmland) {
        if (ConfigurationHandler.disableVanillaFarming) {
          if (!(event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemSeeds) || SeedHelper.isValidSeed((ItemSeeds)event.entityPlayer.getCurrentEquippedItem().getItem(),event.entityPlayer.getCurrentEquippedItem().getItemDamage())) {
            this.denyEvent(event,false);
          }
        }
 else         if (event.entityPlayer.getCurrentEquippedItem().hasTagCompound()) {
          NBTTagCompound tag=(NBTTagCompound)event.entityPlayer.getCurrentEquippedItem().getTagCompound().copy();
          if (tag.hasKey(Names.NBT.growth) && tag.hasKey(Names.NBT.gain) && tag.hasKey(Names.NBT.strength)) {
            this.denyEvent(event,false);
          }
        }
      }
    }
  }
}
Program: 95643
Project: 95643
Buggy source:
/** 
 * Depending on the block type either irrigates farmland or forces plant growth (based on chance) 
 */
private void irrigate(int x,int y,int z){
  Block block=this.worldObj.getBlock(x,y,z);
  if (block != null) {
    if (block instanceof BlockFarmland && this.worldObj.getBlockMetadata(x,y,z) < 7) {
      this.worldObj.setBlockMetadataWithNotify(x,y,z,7,2);
    }
 else     if (block instanceof BlockBush) {
      if (counter == 0 && Constants.rand.nextDouble() <= ConfigurationHandler.sprinklerGrowthChancePercent) {
        block.updateTick(this.worldObj,x,y,z,Constants.rand);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Depending on the block type either irrigates farmland or forces plant growth (based on chance) 
 */
private void irrigate(int x,int y,int z){
  Block block=this.worldObj.getBlock(x,y,z);
  if (block != null) {
    if (block instanceof BlockFarmland && this.worldObj.getBlockMetadata(x,y,z) < 7) {
      int flag=counter == 0 ? 2 : 6;
      this.worldObj.setBlockMetadataWithNotify(x,y,z,7,flag);
    }
 else     if (block instanceof BlockBush) {
      if (counter == 0 && Constants.rand.nextDouble() <= ConfigurationHandler.sprinklerGrowthChancePercent) {
        block.updateTick(this.worldObj,x,y,z,Constants.rand);
      }
    }
  }
}
Program: 95644
Project: 95644
Buggy source:
public static ArrayList<ItemStack> getPlantFruits(ItemSeeds seed,World world,int x,int y,int z,int gain,int meta){
  int nr=(int)(Math.ceil((gain + 0.00) / 3));
  Block plant=getPlant(seed);
  ArrayList<ItemStack> items=new ArrayList<ItemStack>();
  if (plant == Blocks.nether_wart) {
    LogHelper.debug("String_Node_Str");
    items.add(new ItemStack(seed,nr,0));
  }
 else   if (plant instanceof BlockModPlant) {
    LogHelper.debug("String_Node_Str");
    items.addAll(((BlockModPlant)plant).getFruit(nr,world.rand));
  }
 else   if (ModIntegration.LoadedMods.natura && getPlantDomain(seed).equalsIgnoreCase("String_Node_Str")) {
    LogHelper.debug("String_Node_Str");
    items.add(new ItemStack(NContent.plantItem,nr,meta * 3));
  }
 else   if (ModIntegration.LoadedMods.chococraft && seed instanceof ItemGysahlSeeds) {
    LogHelper.debug("String_Node_Str");
    items.add(ChococraftHelper.getFruit(gain,nr));
  }
 else {
    LogHelper.debug("String_Node_Str");
    addFruitsFromOreDict(items,seed,meta,world.rand,nr);
  }
  if (items.size() == 0) {
    LogHelper.debug("String_Node_Str");
    int harvestMeta=7;
    if (ModIntegration.LoadedMods.plantMegaPack && getPlantDomain(seed).equalsIgnoreCase("String_Node_Str")) {
      harvestMeta=PlantMegaPackHelper.getTextureIndex(seed,harvestMeta);
    }
    addFruitsFromPlant(items,plant,world,x,y,z,harvestMeta,nr);
  }
  return items;
}

Fixed version (ground truth):
public static ArrayList<ItemStack> getPlantFruits(ItemSeeds seed,World world,int x,int y,int z,int gain,int meta){
  int nr=(int)(Math.ceil((gain + 0.00) / 3));
  Block plant=getPlant(seed);
  ArrayList<ItemStack> items=new ArrayList<ItemStack>();
  Random rand=world != null ? world.rand : new Random();
  if (plant == Blocks.nether_wart) {
    LogHelper.debug("String_Node_Str");
    items.add(new ItemStack(seed,nr,0));
  }
 else   if (plant instanceof BlockModPlant) {
    LogHelper.debug("String_Node_Str");
    items.addAll(((BlockModPlant)plant).getFruit(nr,rand));
  }
 else   if (ModIntegration.LoadedMods.natura && getPlantDomain(seed).equalsIgnoreCase("String_Node_Str")) {
    LogHelper.debug("String_Node_Str");
    items.add(new ItemStack(NContent.plantItem,nr,meta * 3));
  }
 else   if (ModIntegration.LoadedMods.chococraft && seed instanceof ItemGysahlSeeds) {
    LogHelper.debug("String_Node_Str");
    items.add(ChococraftHelper.getFruit(gain,nr));
  }
 else {
    LogHelper.debug("String_Node_Str");
    addFruitsFromOreDict(items,seed,meta,rand,nr);
  }
  if (items.size() == 0) {
    LogHelper.debug("String_Node_Str");
    int harvestMeta=7;
    if (ModIntegration.LoadedMods.plantMegaPack && getPlantDomain(seed).equalsIgnoreCase("String_Node_Str")) {
      harvestMeta=PlantMegaPackHelper.getTextureIndex(seed,harvestMeta);
    }
    addFruitsFromPlant(items,plant,world,x,y,z,harvestMeta,nr);
  }
  return items;
}
Program: 95646
Project: 95646
Buggy source:
@Override public boolean removeWeeds(World world,int x,int y,int z,ItemStack rake){
  if (!ConfigurationHandler.enableWeeds) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (!crop.weed) {
      return false;
    }
    int weedGrowthStage=world.getBlockMetadata(x,y,z);
    int toolMeta=rake.getItemDamage();
    while (!world.isRemote && weedGrowthStage > 0) {
      weedGrowthStage=(toolMeta == 1) ? 0 : Math.max(random.nextInt(weedGrowthStage / 2 + 1) - 1,0) + weedGrowthStage / 2;
      crop.updateWeed(weedGrowthStage);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean removeWeeds(World world,int x,int y,int z,ItemStack rake){
  if (!ConfigurationHandler.enableWeeds) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (!crop.hasWeed()) {
      return false;
    }
    int weedGrowthStage=world.getBlockMetadata(x,y,z);
    int toolMeta=rake.getItemDamage();
    while (!world.isRemote && weedGrowthStage > 0) {
      weedGrowthStage=(toolMeta == 1) ? 0 : Math.max(random.nextInt(weedGrowthStage / 2 + 1) - 1,0) + weedGrowthStage / 2;
      crop.updateWeed(weedGrowthStage);
    }
    return true;
  }
  return false;
}
Program: 95647
Project: 95647
Buggy source:
@Override public boolean applyFertilizer(World world,int x,int y,int z,ItemStack fertilizer){
  if (world.isRemote || !isValidFertilizer(world,x,y,z,fertilizer)) {
    return false;
  }
  TileEntityCrop crop=(TileEntityCrop)world.getTileEntity(x,y,z);
  if (fertilizer.getItem() == net.minecraft.init.Items.dye && fertilizer.getItemDamage() == 15) {
    Blocks.blockCrop.func_149853_b(world,random,x,y,z);
    fertilizer.stackSize--;
    world.playAuxSFX(2005,x,y,z,0);
    return true;
  }
 else   if (ModIntegration.LoadedMods.magicalCrops && ConfigurationHandler.integration_allowMagicFertiliser && fertilizer.getItem() == Item.itemRegistry.getObject("String_Node_Str")) {
    if (ConfigurationHandler.integration_instantMagicFertiliser) {
      world.setBlockMetadataWithNotify(x,y,z,7,2);
    }
 else {
      Blocks.blockCrop.func_149853_b(world,random,x,y,z);
    }
    fertilizer.stackSize--;
    world.playAuxSFX(2005,x,y,z,0);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applyFertilizer(World world,int x,int y,int z,ItemStack fertilizer){
  if (world.isRemote || !isValidFertilizer(world,x,y,z,fertilizer)) {
    return false;
  }
  if (fertilizer.getItem() == net.minecraft.init.Items.dye && fertilizer.getItemDamage() == 15) {
    Blocks.blockCrop.func_149853_b(world,random,x,y,z);
    fertilizer.stackSize--;
    world.playAuxSFX(2005,x,y,z,0);
    return true;
  }
 else   if (ModIntegration.LoadedMods.magicalCrops && ConfigurationHandler.integration_allowMagicFertiliser && fertilizer.getItem() == Item.itemRegistry.getObject("String_Node_Str")) {
    if (ConfigurationHandler.integration_instantMagicFertiliser) {
      world.setBlockMetadataWithNotify(x,y,z,7,2);
    }
 else {
      Blocks.blockCrop.func_149853_b(world,random,x,y,z);
    }
    fertilizer.stackSize--;
    world.playAuxSFX(2005,x,y,z,0);
    return true;
  }
  return false;
}
Program: 95648
Project: 95648
Buggy source:
@Override public boolean isHandledByAgricraft(ItemStack seed){
  return SeedHelper.isValidSeedStack(seed);
}

Fixed version (ground truth):
@Override public boolean isHandledByAgricraft(ItemStack seed){
  return CropPlantHandler.isValidSeed(seed);
}
Program: 95649
Project: 95649
Buggy source:
@Override public ItemStack removeCrossCrops(World world,int x,int y,int z){
  if (world.isRemote) {
    return null;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (crop.crossCrop) {
      crop.crossCrop=false;
      crop.markForUpdate();
      return new ItemStack(Items.crops,1);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ItemStack removeCrossCrops(World world,int x,int y,int z){
  if (world.isRemote) {
    return null;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (crop.isCrossCrop()) {
      crop.setCrossCrop(false);
      crop.markForUpdate();
      return new ItemStack(Items.crops,1);
    }
  }
  return null;
}
Program: 95650
Project: 95650
Buggy source:
@Override public List<ItemStack> harvest(World world,int x,int y,int z){
  if (world.isRemote) {
    return null;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (crop.isMature()) {
      crop.getWorldObj().setBlockMetadataWithNotify(crop.xCoord,crop.yCoord,crop.zCoord,2,2);
      crop.markForUpdate();
      return SeedHelper.getPlantFruits(crop.seed,world,x,y,z,crop.gain,crop.seedMeta);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public List<ItemStack> harvest(World world,int x,int y,int z){
  if (world.isRemote) {
    return null;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (crop.isMature()) {
      crop.getWorldObj().setBlockMetadataWithNotify(crop.xCoord,crop.yCoord,crop.zCoord,2,2);
      crop.markForUpdate();
      return CropPlantHandler.getPlantFromStack(crop.getSeedStack()).getFruitsOnHarvest(crop.getGain(),world.rand);
    }
  }
  return null;
}
Program: 95651
Project: 95651
Buggy source:
@Override public boolean placeCrossCrops(World world,int x,int y,int z,ItemStack crops){
  if (world.isRemote) {
    return false;
  }
  if (crops == null || crops.getItem() == null || crops.getItem() != Items.crops || crops.stackSize < 1) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (!crop.weed && !crop.crossCrop && !crop.hasPlant()) {
      crop.crossCrop=true;
      crops.stackSize--;
      crop.markForUpdate();
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean placeCrossCrops(World world,int x,int y,int z,ItemStack crops){
  if (world.isRemote) {
    return false;
  }
  if (crops == null || crops.getItem() == null || crops.getItem() != Items.crops || crops.stackSize < 1) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (!crop.hasWeed() && !crop.isCrossCrop() && !crop.hasPlant()) {
      crop.setCrossCrop(true);
      crops.stackSize--;
      crop.markForUpdate();
      return true;
    }
  }
  return false;
}
Program: 95652
Project: 95652
Buggy source:
@Override public boolean isCrossCrops(World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    return crop.crossCrop;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isCrossCrops(World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    return crop.isCrossCrop();
  }
  return false;
}