nus-yam/ex-repair huggingface dataset:
Program: 95559
Project: 95559
Buggy source:
/** 
 * Event handler to deny bonemeal while sneaking on crops that are not allowed to be bonemealed 
 */
@SubscribeEvent public void denyBonemeal(PlayerInteractEvent event){
  if (event.getAction() != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    return;
  }
  if (!event.getEntityPlayer().isSneaking()) {
    return;
  }
  ItemStack heldItem=event.getEntityPlayer().getActiveItemStack();
  if (heldItem != null && heldItem.getItem() == net.minecraft.init.Items.dye && heldItem.getItemDamage() == 15) {
    TileEntity te=event.getWorld().getTileEntity(event.getPos());
    if (te != null && (te instanceof TileEntityCrop)) {
      TileEntityCrop crop=(TileEntityCrop)te;
      if (!crop.canBonemeal()) {
        this.denyEvent(event,false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Event handler to deny bonemeal while sneaking on crops that are not allowed to be bone mealed 
 */
@SubscribeEvent public void denyBonemeal(PlayerInteractEvent.RightClickBlock event){
  if (!event.getEntityPlayer().isSneaking()) {
    return;
  }
  ItemStack heldItem=event.getEntityPlayer().getActiveItemStack();
  if (heldItem != null && heldItem.getItem() == net.minecraft.init.Items.dye && heldItem.getItemDamage() == 15) {
    TileEntity te=event.getWorld().getTileEntity(event.getPos());
    if (te != null && (te instanceof TileEntityCrop)) {
      TileEntityCrop crop=(TileEntityCrop)te;
      if (!crop.canBonemeal()) {
        this.denyEvent(event,false);
      }
    }
  }
}
Program: 95560
Project: 95560
Buggy source:
/** 
 * This is done with an event because else the player will place the vines as a block instead of applying them to the grate 
 */
@SubscribeEvent public void applyVinesToGrate(PlayerInteractEvent event){
  if (event.getAction() == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    ItemStack stack=event.getEntityPlayer().getActiveItemStack();
    if (stack == null || stack.getItem() == null || stack.getItem() != Item.getItemFromBlock(Blocks.vine)) {
      return;
    }
    Block block=event.getWorld().getBlockState(event.getPos()).getBlock();
    if (!(block instanceof BlockGrate)) {
      return;
    }
    if (event.getWorld().isRemote) {
      denyEvent(event,true);
    }
 else {
      block.onBlockActivated(event.getWorld(),event.getPos(),event.getWorld().getBlockState(event.getPos()),event.getEntityPlayer(),EnumHand.MAIN_HAND,stack,event.getFace(),0,0,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * This is done with an event because else the player will place the vines as a block instead of applying them to the grate 
 */
@SubscribeEvent public void applyVinesToGrate(PlayerInteractEvent.RightClickBlock event){
  ItemStack stack=event.getEntityPlayer().getActiveItemStack();
  if (stack == null || stack.getItem() == null || stack.getItem() != Item.getItemFromBlock(Blocks.vine)) {
    return;
  }
  Block block=event.getWorld().getBlockState(event.getPos()).getBlock();
  if (!(block instanceof BlockGrate)) {
    return;
  }
  if (event.getWorld().isRemote) {
    denyEvent(event,true);
  }
 else {
    block.onBlockActivated(event.getWorld(),event.getPos(),event.getWorld().getBlockState(event.getPos()),event.getEntityPlayer(),EnumHand.MAIN_HAND,stack,event.getFace(),0,0,0);
  }
}
Program: 95561
Project: 95561
Buggy source:
public static void init(){
  if (!AgriCraftConfig.disableWorldGen) {
    if (AgriCraftConfig.villagerEnabled) {
      Collection<Integer> usedIds=VillagerRegistry.getRegisteredVillagers();
      int id=5;
      while (usedIds.contains(id)) {
        id++;
      }
      registerVillager(id);
    }
    MapGenStructureIO.registerStructureComponent(StructureGreenhouse.class,Reference.MOD_ID + "String_Node_Str");
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseHandler());
    if (!AgriCraftConfig.disableIrrigation) {
      MapGenStructureIO.registerStructureComponent(StructureGreenhouseIrrigated.class,Reference.MOD_ID + "String_Node_Str");
      VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseIrrigatedHandler());
    }
  }
}

Fixed version (ground truth):
public static void init(){
  if (!AgriCraftConfig.disableWorldGen) {
    if (AgriCraftConfig.villagerEnabled) {
      int id=5;
      registerVillager(id);
    }
    MapGenStructureIO.registerStructureComponent(StructureGreenhouse.class,Reference.MOD_ID + "String_Node_Str");
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseHandler());
    if (!AgriCraftConfig.disableIrrigation) {
      MapGenStructureIO.registerStructureComponent(StructureGreenhouseIrrigated.class,Reference.MOD_ID + "String_Node_Str");
      VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseIrrigatedHandler());
    }
  }
}
Program: 95562
Project: 95562
Buggy source:
private static void registerVillager(int id){
  VillagerRegistry.instance().registerVillagerId(id);
  AgriCraft.proxy.registerVillagerSkin(id,"String_Node_Str");
  villagerId=id;
}

Fixed version (ground truth):
private static void registerVillager(int id){
  AgriCraft.proxy.registerVillagerSkin(id,"String_Node_Str");
  villagerId=id;
}
Program: 95563
Project: 95563
Buggy source:
/** 
 * This constructor shouldn't be called from anywhere except from the BlockModPlant public constructor, if you create a new BlockModPlant, its contructor will create the seed for you
 */
public ItemModSeed(BlockModPlant plant,String information){
  super(plant,plant.getGrowthRequirement().getSoil() == null ? Blocks.farmland : plant.getGrowthRequirement().getSoil().getBlock());
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
    this.information=information;
  }
  this.setCreativeTab(AgriCraftTab.agriCraftTab);
  this.seedName="String_Node_Str" + plant.getRegistryName().replaceFirst("String_Node_Str","String_Node_Str");
  RegisterHelper.registerSeed(this,plant,this.seedName);
}

Fixed version (ground truth):
/** 
 * This constructor shouldn't be called from anywhere except from the BlockModPlant public constructor, if you create a new BlockModPlant, its contructor will create the seed for you
 */
public ItemModSeed(BlockModPlant plant,String information){
  super(plant,plant.getGrowthRequirement().getSoil() == null ? Blocks.farmland : plant.getGrowthRequirement().getSoil().getBlock());
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
    this.information=information;
  }
  this.setCreativeTab(AgriCraftTab.agriCraftTab);
  this.seedName="String_Node_Str" + plant.getRegistryName().toString().replaceFirst("String_Node_Str","String_Node_Str");
  RegisterHelper.registerSeed(this,plant,this.seedName);
}
Program: 95564
Project: 95564
Buggy source:
@Override public void registerVillagerSkin(int id,String resource){
  VillagerRegistry.instance().registerVillagerSkin(id,new ResourceLocation(Reference.MOD_ID,resource));
}

Fixed version (ground truth):
@Override public void registerVillagerSkin(int id,String resource){
}
Program: 95566
Project: 95566
Buggy source:
/** 
 * Generates an NBTTag for the MATERIAL the CustomWood is mimicking.
 * @return an NBTTag for the CustomWood MATERIAL.
 */
public final NBTTagCompound getMaterialTag(){
  NBTTagCompound tag=new NBTTagCompound();
  tag.setString(AgriCraftNBT.MATERIAL,this.material.getRegistryName());
  tag.setInteger(AgriCraftNBT.MATERIAL_META,this.materialMeta);
  return tag;
}

Fixed version (ground truth):
/** 
 * Generates an NBTTag for the MATERIAL the CustomWood is mimicking.
 * @return an NBTTag for the CustomWood MATERIAL.
 */
public final NBTTagCompound getMaterialTag(){
  NBTTagCompound tag=new NBTTagCompound();
  tag.setString(AgriCraftNBT.MATERIAL,this.material.getRegistryName().toString());
  tag.setInteger(AgriCraftNBT.MATERIAL_META,this.materialMeta);
  return tag;
}
Program: 95567
Project: 95567
Buggy source:
@Override public final void writeTileNBT(NBTTagCompound tag){
  tag.setString(AgriCraftNBT.MATERIAL,this.getMaterial().getRegistryName());
  tag.setInteger(AgriCraftNBT.MATERIAL_META,this.getMaterialMeta());
  this.writeNBT(tag);
}

Fixed version (ground truth):
@Override public final void writeTileNBT(NBTTagCompound tag){
  tag.setString(AgriCraftNBT.MATERIAL,this.getMaterial().getRegistryName().toString());
  tag.setInteger(AgriCraftNBT.MATERIAL_META,this.getMaterialMeta());
  this.writeNBT(tag);
}
Program: 95568
Project: 95568
Buggy source:
public static NBTTagCompound getMaterialTag(ItemStack stack){
  NBTTagCompound tag=null;
  if (stack != null && stack.getItem() != null) {
    Block block=(((ItemBlock)stack.getItem()).block);
    if (block != null) {
      tag=new NBTTagCompound();
      tag.setString(AgriCraftNBT.MATERIAL,block.getRegistryName());
      tag.setInteger(AgriCraftNBT.MATERIAL_META,stack.getMetadata());
    }
  }
  return tag;
}

Fixed version (ground truth):
public static NBTTagCompound getMaterialTag(ItemStack stack){
  NBTTagCompound tag=null;
  if (stack != null && stack.getItem() != null) {
    Block block=(((ItemBlock)stack.getItem()).block);
    if (block != null) {
      tag=new NBTTagCompound();
      tag.setString(AgriCraftNBT.MATERIAL,block.getRegistryName().toString());
      tag.setInteger(AgriCraftNBT.MATERIAL_META,stack.getMetadata());
    }
  }
  return tag;
}
Program: 95569
Project: 95569
Buggy source:
public static TextureAtlasSprite getIcon(final Item item){
  return (item == null) ? getDefaultIcon() : getIcon(item.getRegistryName(),EXPANSION_ITEM);
}

Fixed version (ground truth):
public static TextureAtlasSprite getIcon(final Item item){
  return (item == null) ? getDefaultIcon() : getIcon(item.getRegistryName().toString(),EXPANSION_ITEM);
}
Program: 95570
Project: 95570
Buggy source:
@Override public void registerEventHandlers(){
  super.registerEventHandlers();
  MissingJsonHandler missingJsonHandler=new MissingJsonHandler();
  MinecraftForge.EVENT_BUS.register(missingJsonHandler);
  ItemToolTipHandler itemToolTipHandler=new ItemToolTipHandler();
  MinecraftForge.EVENT_BUS.register(itemToolTipHandler);
  RenderPlayerHooks renderPlayerHooks=new RenderPlayerHooks();
  MinecraftForge.EVENT_BUS.register(renderPlayerHooks);
  SoundHandler soundHandler=new SoundHandler();
  MinecraftForge.EVENT_BUS.register(soundHandler);
}

Fixed version (ground truth):
@Override public void registerEventHandlers(){
  super.registerEventHandlers();
  MissingJsonHandler missingJsonHandler=new MissingJsonHandler();
  MinecraftForge.EVENT_BUS.register(missingJsonHandler);
  ItemToolTipHandler itemToolTipHandler=new ItemToolTipHandler();
  MinecraftForge.EVENT_BUS.register(itemToolTipHandler);
  SoundHandler soundHandler=new SoundHandler();
  MinecraftForge.EVENT_BUS.register(soundHandler);
}
Program: 95571
Project: 95571
Buggy source:
private void initializeCache(IReloadableResourceManager resourceManager){
  this.resourceManager=resourceManager;
  cachedObjects.forEach(INSTANCE::retrieveBlockIcons);
}

Fixed version (ground truth):
private void initializeCache(){
  this.modelLocationsMap=Maps.<IBlockState,ModelResourceLocation>newLinkedHashMap();
  this.variantsMap=Maps.<ModelResourceLocation,ModelBlockDefinition.Variants>newLinkedHashMap();
  this.modelMap=Maps.<ResourceLocation,ModelBlock>newLinkedHashMap();
  this.modelCache=Maps.<IBlockState,List<ModelBlock>>newLinkedHashMap();
  this.textureCache=Maps.<IBlockState,List<TextureAtlasSprite>>newLinkedHashMap();
  cachedObjects.forEach(INSTANCE::retrieveBlockIcons);
}
Program: 95572
Project: 95572
Buggy source:
@Override public void onResourceManagerReload(IResourceManager resourceManager){
  if (resourceManager instanceof IReloadableResourceManager) {
    initializeCache((IReloadableResourceManager)resourceManager);
  }
 else {
    cachedObjects.forEach(INSTANCE::retrieveBlockIcons);
  }
}

Fixed version (ground truth):
@Override public void onResourceManagerReload(IResourceManager resourceManager){
  if (resourceManager instanceof IReloadableResourceManager) {
    this.resourceManager=(IReloadableResourceManager)resourceManager;
  }
  initializeCache();
}
Program: 95573
Project: 95573
Buggy source:
public static TextureCache getInstance(){
  if (INSTANCE == null) {
    INSTANCE=new TextureCache((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager());
  }
  return INSTANCE;
}

Fixed version (ground truth):
public static TextureCache getInstance(){
  if (INSTANCE == null) {
    INSTANCE=new TextureCache((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager());
    INSTANCE.resourceManager.registerReloadListener(INSTANCE);
  }
  return INSTANCE;
}
Program: 95574
Project: 95574
Buggy source:
private TextureCache(IReloadableResourceManager resourceManager){
  this.resourceManager=resourceManager;
  this.defaultMapper=new DefaultStateMapper();
  this.blockStateMap=retrieveBlockStateMap(retrieveModelManager());
  this.modelLocationsMap=Maps.<IBlockState,ModelResourceLocation>newLinkedHashMap();
  this.variantsMap=Maps.<ModelResourceLocation,ModelBlockDefinition.Variants>newLinkedHashMap();
  this.modelMap=Maps.<ResourceLocation,ModelBlock>newLinkedHashMap();
  this.modelCache=Maps.<IBlockState,List<ModelBlock>>newLinkedHashMap();
  this.textureCache=Maps.<IBlockState,List<TextureAtlasSprite>>newLinkedHashMap();
  resourceManager.registerReloadListener(this);
}

Fixed version (ground truth):
private TextureCache(IReloadableResourceManager resourceManager){
  this.resourceManager=resourceManager;
  this.defaultMapper=new DefaultStateMapper();
  this.blockStateMap=retrieveBlockStateMap(retrieveModelManager());
  this.modelLocationsMap=Maps.<IBlockState,ModelResourceLocation>newLinkedHashMap();
  this.variantsMap=Maps.<ModelResourceLocation,ModelBlockDefinition.Variants>newLinkedHashMap();
  this.modelMap=Maps.<ResourceLocation,ModelBlock>newLinkedHashMap();
  this.modelCache=Maps.<IBlockState,List<ModelBlock>>newLinkedHashMap();
  this.textureCache=Maps.<IBlockState,List<TextureAtlasSprite>>newLinkedHashMap();
}
Program: 95575
Project: 95575
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  if (slotsList == null || slot >= slotsList.size()) {
    this.addStackToInventory(inputStack);
    return;
  }
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slotsList.get(slot);
    if (slotAt != null) {
      if (inputStack == null) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
        return;
      }
      slotAt.count=inputStack.stackSize;
      if (slotAt.count <= 0) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
      }
      if (!this.worldObj.isRemote) {
        this.syncSlotToClient(slotAt);
      }
    }
 else {
      this.addStackToInventory(inputStack);
    }
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  if (slotsList == null || slot >= slotsList.size()) {
    this.addStackToInventory(inputStack);
    return;
  }
  if (inputStack == null) {
    inputStack=slotsList.get(slot).getStack(lockedSeed,lockedSeedMeta);
    inputStack.stackSize=0;
  }
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slotsList.get(slot);
    if (slotAt != null) {
      slotAt.count=inputStack.stackSize;
      if (slotAt.count <= 0) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
      }
      if (!this.worldObj.isRemote) {
        this.syncSlotToClient(slotAt);
      }
    }
 else {
      this.addStackToInventory(inputStack);
    }
  }
}
Program: 95576
Project: 95576
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  if (slotsList == null || slot >= slotsList.size()) {
    this.addStackToInventory(inputStack);
    return;
  }
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slotsList.get(slot);
    if (slotAt != null) {
      slotAt.count=inputStack.stackSize;
      if (slotAt.count <= 0) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
      }
      if (!this.worldObj.isRemote) {
        this.syncSlotToClient(slotAt);
      }
    }
 else {
      this.addStackToInventory(inputStack);
    }
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack inputStack){
  if (slotsList == null || slot >= slotsList.size()) {
    this.addStackToInventory(inputStack);
    return;
  }
  if (this.isItemValidForSlot(slot,inputStack)) {
    SeedStorageSlot slotAt=this.slotsList.get(slot);
    if (slotAt != null) {
      if (inputStack == null) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
        return;
      }
      slotAt.count=inputStack.stackSize;
      if (slotAt.count <= 0) {
        slots.remove(slotAt.getId());
        slotsList.remove(slotAt);
      }
      if (!this.worldObj.isRemote) {
        this.syncSlotToClient(slotAt);
      }
    }
 else {
      this.addStackToInventory(inputStack);
    }
  }
}
Program: 95577
Project: 95577
Buggy source:
public static void registerGrowthRequirement(ItemWithMeta item,IGrowthRequirement requirement) throws InvalidSeedException {
  if (CropPlantHandler.isValidSeed(item.toStack())) {
    throw new InvalidSeedException();
  }
  growthRequirements.put(item,requirement);
  BlockWithMeta soil=requirement.getSoil();
  if (soil != null) {
    GrowthRequirementHandler.addSoil(soil);
  }
}

Fixed version (ground truth):
public static void registerGrowthRequirement(ItemWithMeta item,IGrowthRequirement requirement) throws InvalidSeedException {
  if (!CropPlantHandler.isValidSeed(item.toStack())) {
    throw new InvalidSeedException();
  }
  growthRequirements.put(item,requirement);
  BlockWithMeta soil=requirement.getSoil();
  if (soil != null) {
    GrowthRequirementHandler.addSoil(soil);
  }
}
Program: 95578
Project: 95578
Buggy source:
/** 
 * Takes a string input with a specific formatting and parses it as an ItemStack. Syntax: domain:regname:meta#amount IE: minecraft:stone:0#8
 * @param stackString - Formatted string
 * @param input       - Whether the string defines an input or not.
 * @return            - An ItemStack built from the string
 */
public static ItemStack parseItemStack(String stackString,boolean input){
  if (stackString == null)   return null;
  try {
    if (stackString.contains("String_Node_Str")) {
      String[] nameInfo=stackString.split("String_Node_Str");
      String name=nameInfo[0] + "String_Node_Str" + nameInfo[1];
      String[] stackInfo=nameInfo[2].split("String_Node_Str");
      int meta=Integer.parseInt(stackInfo[0]);
      int amount=Integer.parseInt(stackInfo[1]);
      return new ItemStack(GameData.getItemRegistry().getObject(name),amount,meta);
    }
 else     if (stackString.equals("String_Node_Str")) {
      return null;
    }
 else     if (!input) {
      String[] stackInfo=stackString.split("String_Node_Str");
      ItemStack oreStack=OreDictionary.getOres(stackInfo[0]).get(0);
      int amount=Integer.parseInt(stackInfo[1]);
      return new ItemStack(oreStack.getItem(),amount,oreStack.getItemDamage());
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    LogHelper.error("String_Node_Str" + (input ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ stackString+ "String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Takes a string input with a specific formatting and parses it as an ItemStack. Syntax: domain:regname:meta#amount IE: minecraft:stone:0#8
 * @param stackString - Formatted string
 * @param input       - Whether the string defines an input or not.
 * @return            - An ItemStack built from the string
 */
public static ItemStack parseItemStack(String stackString,boolean input){
  if (stackString == null)   return null;
  try {
    if (stackString.contains("String_Node_Str")) {
      String[] nameInfo=stackString.split("String_Node_Str");
      String name=nameInfo[0] + "String_Node_Str" + nameInfo[1];
      String[] stackInfo=nameInfo[2].split("String_Node_Str");
      int meta=Integer.parseInt(stackInfo[0]);
      int amount=Integer.parseInt(stackInfo[1]);
      return new ItemStack(GameData.getItemRegistry().getObject(name),amount,meta);
    }
 else     if (stackString.equals("String_Node_Str")) {
      return null;
    }
 else     if (!input) {
      String[] stackInfo=stackString.split("String_Node_Str");
      ItemStack oreStack=OreDictionary.getOres(stackInfo[0]).get(0);
      int amount=Integer.parseInt(stackInfo[1]);
      return new ItemStack(oreStack.getItem(),amount,oreStack.getItemDamage());
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
  }
  return null;
}
Program: 95579
Project: 95579
Buggy source:
protected void drawScaledFaceDoubleXY(Tessellator tessellator,float minX,float minY,float maxX,float maxY,IIcon icon,float z){
  z=z * 16.0F;
  float minU=0;
  float maxU=icon.getIconWidth();
  float minV=0;
  float maxV=icon.getIconHeight();
  addScaledVertexWithUV(tessellator,maxX,maxY,z,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,minY,z,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,minY,z,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,maxY,z,minU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,maxY,z,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,maxY,z,minU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,minY,z,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,minY,z,maxU,maxV,icon);
}

Fixed version (ground truth):
protected void drawScaledFaceDoubleXY(Tessellator tessellator,float minX,float minY,float maxX,float maxY,IIcon icon,float z){
  z=z * 16.0F;
  float minU=0;
  float maxU=16;
  float minV=0;
  float maxV=16;
  addScaledVertexWithUV(tessellator,maxX,maxY,z,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,minY,z,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,minY,z,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,maxY,z,minU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,maxY,z,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,maxY,z,minU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,minY,z,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,minY,z,maxU,maxV,icon);
}
Program: 95580
Project: 95580
Buggy source:
protected void drawScaledFaceDoubleXZ(Tessellator tessellator,float minX,float minZ,float maxX,float maxZ,IIcon icon,float y){
  y=y * 16.0F;
  float minU=0;
  float maxU=icon.getIconWidth();
  float minV=0;
  float maxV=icon.getIconHeight();
  addScaledVertexWithUV(tessellator,maxX,y,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,minZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,y,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,y,maxZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,y,maxZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,y,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,minZ,maxU,minV,icon);
}

Fixed version (ground truth):
protected void drawScaledFaceDoubleXZ(Tessellator tessellator,float minX,float minZ,float maxX,float maxZ,IIcon icon,float y){
  y=y * 16.0F;
  float minU=0;
  float maxU=16;
  float minV=0;
  float maxV=16;
  addScaledVertexWithUV(tessellator,maxX,y,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,minZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,y,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,minX,y,maxZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,y,maxZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,minX,y,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,maxX,y,minZ,maxU,minV,icon);
}
Program: 95581
Project: 95581
Buggy source:
protected void drawScaledFaceDoubleYZ(Tessellator tessellator,float minY,float minZ,float maxY,float maxZ,IIcon icon,float x){
  x=x * 16.0F;
  float minU=0;
  float maxU=icon.getIconWidth();
  float minV=0;
  float maxV=icon.getIconHeight();
  addScaledVertexWithUV(tessellator,x,maxY,maxZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,x,minY,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,minY,minZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,maxZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,x,minY,minZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,minY,maxZ,maxU,maxV,icon);
}

Fixed version (ground truth):
protected void drawScaledFaceDoubleYZ(Tessellator tessellator,float minY,float minZ,float maxY,float maxZ,IIcon icon,float x){
  x=x * 16.0F;
  float minU=0;
  float maxU=16;
  float minV=0;
  float maxV=16;
  addScaledVertexWithUV(tessellator,x,maxY,maxZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,x,minY,maxZ,maxU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,minY,minZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,maxZ,maxU,minV,icon);
  addScaledVertexWithUV(tessellator,x,maxY,minZ,minU,minV,icon);
  addScaledVertexWithUV(tessellator,x,minY,minZ,minU,maxV,icon);
  addScaledVertexWithUV(tessellator,x,minY,maxZ,maxU,maxV,icon);
}
Program: 95582
Project: 95582
Buggy source:
/** 
 * Event handler to create water pads 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void waterPadCreation(PlayerInteractEvent event){
  if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    boolean flag=false;
    if (event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemSpade) {
      flag=true;
    }
 else     if (ModHelper.allowIntegration(Names.Mods.tconstruct) && TinkersConstructHelper.isShovel(event.entityPlayer.getCurrentEquippedItem())) {
      flag=true;
    }
    if (flag) {
      if (event.world.isRemote) {
        denyEvent(event,true);
      }
      Block block=event.world.getBlock(event.x,event.y,event.z);
      if (block == Blocks.farmland) {
        event.world.setBlock(event.x,event.y,event.z,com.InfinityRaider.AgriCraft.init.Blocks.blockWaterPad,0,3);
        if (!event.entityPlayer.capabilities.isCreativeMode) {
          event.entityPlayer.getCurrentEquippedItem().damageItem(1,event.entityPlayer);
          event.setResult(Event.Result.ALLOW);
        }
        event.world.playSoundEffect((double)((float)event.x + 0.5F),(double)((float)event.y + 0.5F),(double)((float)event.z + 0.5F),block.stepSound.getStepResourcePath(),(block.stepSound.getVolume() + 1.0F) / 2.0F,block.stepSound.getPitch() * 0.8F);
        denyEvent(event,false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Event handler to create water pads 
 */
@SubscribeEvent(priority=EventPriority.HIGHEST) public void waterPadCreation(PlayerInteractEvent event){
  if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
    boolean flag=false;
    if (event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemSpade) {
      flag=true;
    }
 else     if (ModHelper.allowIntegration(Names.Mods.tconstruct) && TinkersConstructHelper.isShovel(event.entityPlayer.getCurrentEquippedItem())) {
      flag=true;
    }
    if (event.world.getBlock(event.x,event.y,event.z) != Blocks.farmland)     flag=false;
    if (flag) {
      if (event.world.isRemote) {
        denyEvent(event,true);
      }
      Block block=event.world.getBlock(event.x,event.y,event.z);
      if (block == Blocks.farmland) {
        event.world.setBlock(event.x,event.y,event.z,com.InfinityRaider.AgriCraft.init.Blocks.blockWaterPad,0,3);
        if (!event.entityPlayer.capabilities.isCreativeMode) {
          event.entityPlayer.getCurrentEquippedItem().damageItem(1,event.entityPlayer);
          event.setResult(Event.Result.ALLOW);
        }
        event.world.playSoundEffect((double)((float)event.x + 0.5F),(double)((float)event.y + 0.5F),(double)((float)event.z + 0.5F),block.stepSound.getStepResourcePath(),(block.stepSound.getVolume() + 1.0F) / 2.0F,block.stepSound.getPitch() * 0.8F);
        denyEvent(event,false);
      }
    }
  }
}
Program: 95583
Project: 95583
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.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;
}

Fixed version (ground truth):
@Override public boolean removeWeeds(World world,int x,int y,int z,ItemStack rake){
  if (world.isRemote) {
    return false;
  }
  if (!ConfigurationHandler.enableWeeds) {
    return false;
  }
  if (rake == null || rake.getItem() == null || !(rake.getItem() instanceof IRake)) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof TileEntityCrop) {
    TileEntityCrop crop=(TileEntityCrop)te;
    if (!crop.hasWeed()) {
      return false;
    }
    return ((IRake)rake.getItem()).removeWeeds(crop,rake);
  }
  return false;
}
Program: 95585
Project: 95585
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return false;
  }
  TileEntity te=world.getTileEntity(x,y,z);
  if (te == null || !(te instanceof TileEntityCrop)) {
    return false;
  }
  TileEntityCrop crop=(TileEntityCrop)te;
  if (crop.hasWeed()) {
    int weedGrowthStage=world.getBlockMetadata(x,y,z);
    int newWeedGrowthStage=calculateGrowthStage(stack.getItemDamage(),weedGrowthStage,world.rand);
    crop.updateWeed(newWeedGrowthStage);
    if (ConfigurationHandler.rakingDrops && !crop.hasWeed() && world.rand.nextInt(100) < dropChance[stack.getItemDamage() % dropChance.length]) {
      ItemStack drop=ItemDropRegistry.instance().getDrop(world.rand);
      if (drop != null && drop.getItem() != null) {
        float f=0.7F;
        double d0=(double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d1=(double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        double d2=(double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
        EntityItem entityitem=new EntityItem(world,(double)x + d0,(double)y + d1,(double)z + d2,drop);
        entityitem.delayBeforeCanPickup=10;
        world.spawnEntityInWorld(entityitem);
      }
    }
    return true;
  }
 else   if (crop.hasPlant()) {
    ((BlockCrop)world.getBlock(x,y,z)).canUproot(world,x,y,z);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  return false;
}
Program: 95586
Project: 95586
Buggy source:
public void updateWeed(int growthStage){
  if (this.hasWeed()) {
    if (growthStage == 0) {
      this.weed=false;
    }
    this.worldObj.setBlockMetadataWithNotify(this.xCoord,this.yCoord,this.zCoord,growthStage,3);
    this.markForUpdate();
  }
}

Fixed version (ground truth):
@Override public void updateWeed(int growthStage){
  if (this.hasWeed()) {
    growthStage=growthStage > 7 ? 7 : growthStage < 0 ? 0 : growthStage;
    if (growthStage == 0) {
      this.weed=false;
    }
    this.worldObj.setBlockMetadataWithNotify(this.xCoord,this.yCoord,this.zCoord,growthStage,3);
    this.markForUpdate();
  }
}
Program: 95587
Project: 95587
Buggy source:
/** 
 * spread the weed 
 */
public void spreadWeed(){
  List<TileEntityCrop> neighbours=this.getNeighbours();
  for (  TileEntityCrop crop : neighbours) {
    if (crop != null && (!crop.weed) && Math.random() < crop.getWeedSpawnChance()) {
      crop.spawnWeed();
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * spread the weed 
 */
@Override public void spreadWeed(){
  List<TileEntityCrop> neighbours=this.getNeighbours();
  for (  TileEntityCrop crop : neighbours) {
    if (crop != null && (!crop.weed) && Math.random() < crop.getWeedSpawnChance()) {
      crop.spawnWeed();
      break;
    }
  }
}
Program: 95588
Project: 95588
Buggy source:
/** 
 * Calculates the stats for a mutation or spread result
 * @param result an ItemStack containing the seed of the new plant
 * @param input a List containing all neighbouring crops
 * @param mutation if a mutation occurred, this is false if the plant simply spread to a cross crop
 * @return an ISeedStats object containing the resulting stats
 */
ISeedStats calculateStats(ItemStack result,List<ICrop> input,boolean mutation);

Fixed version (ground truth):
/** 
 * Calculates the stats for a mutation or spread result
 * @param result an ItemStack containing the seed of the new plant
 * @param input a List containing all neighbouring crops
 * @param mutation if a mutation occurred, this is false if the plant simply spread to a cross crop
 * @return an ISeedStats object containing the resulting stats
 */
ISeedStats calculateStats(ItemStack result,List<? extends ICrop> input,boolean mutation);
Program: 95589
Project: 95589
Buggy source:
@Override public CrossOverResult executeStrategy(){
  List<TileEntityCrop> matureNeighbours=engine.getCrop().getMatureNeighbours();
  if (matureNeighbours.isEmpty()) {
    return null;
  }
  int index=engine.getRandom().nextInt(matureNeighbours.size());
  TileEntityCrop neighbour=matureNeighbours.get(index);
  CrossOverResult result=CrossOverResult.fromTileEntityCrop(neighbour);
  calculator.setResultStats(result,matureNeighbours,false);
  return result;
}

Fixed version (ground truth):
@Override public CrossOverResult executeStrategy(){
  List<TileEntityCrop> matureNeighbours=engine.getCrop().getMatureNeighbours();
  if (matureNeighbours.isEmpty()) {
    return null;
  }
  int index=engine.getRandom().nextInt(matureNeighbours.size());
  TileEntityCrop neighbour=matureNeighbours.get(index);
  CrossOverResult result=CrossOverResult.fromTileEntityCrop(neighbour);
  StatCalculator.setResultStats(result,matureNeighbours,false);
  return result;
}
Program: 95590
Project: 95590
Buggy source:
public abstract ISeedStats calculateStats(ItemStack result,List<ICrop> input,boolean mutation);

Fixed version (ground truth):
public abstract ISeedStats calculateStats(ItemStack result,List<? extends ICrop> input,boolean mutation);
Program: 95591
Project: 95591
Buggy source:
/** 
 * Applies the stats to the resulting crop after a spread or mutation
 * @param result The result from the spread/mutation
 * @param input A list with all the neighbouring crops, any neighbouring crop is in this list (with or without plant, mature or not, with weeds or not, ...)
 * @param mutation if this result comes from a mutation or from a spread
 */
public static void setResultStats(CrossOverResult result,List<ICrop> input,boolean mutation){
  ISeedStats stats=instance.calculateStats(result.toStack(),input,mutation);
}

Fixed version (ground truth):
/** 
 * Applies the stats to the resulting crop after a spread or mutation
 * @param result The result from the spread/mutation
 * @param input A list with all the neighbouring crops, any neighbouring crop is in this list (with or without plant, mature or not, with weeds or not, ...)
 * @param mutation if this result comes from a mutation or from a spread
 */
public static void setResultStats(CrossOverResult result,List<? extends ICrop> input,boolean mutation){
  ISeedStats stats=instance.calculateStats(result.toStack(),input,mutation);
}
Program: 95592
Project: 95592
Buggy source:
protected ICrop[] filterParents(List<ICrop> input){
  ArrayList<ICrop> list=new ArrayList<ICrop>();
  for (  ICrop crop : input) {
    if (crop != null && crop.isMature()) {
      list.add(crop);
    }
  }
  return list.toArray(new ICrop[list.size()]);
}

Fixed version (ground truth):
protected ICrop[] filterParents(List<? extends ICrop> input){
  ArrayList<ICrop> list=new ArrayList<ICrop>();
  for (  ICrop crop : input) {
    if (crop != null && crop.isMature()) {
      list.add(crop);
    }
  }
  return list.toArray(new ICrop[list.size()]);
}
Program: 95593
Project: 95593
Buggy source:
protected boolean canInheritStats(Item child,int childMeta,Item seed,int seedMeta){
  int validParentId=ConfigurationHandler.validParents;
  if (validParentId == 0) {
    return true;
  }
  if (validParentId == 2) {
    return child == seed && childMeta == seedMeta;
  }
  boolean b=child == seed && childMeta == seedMeta;
  if (!b) {
    for (    Mutation mutation : MutationHandler.getMutationsFromChild(child,childMeta)) {
      if (mutation != null) {
        ItemStack parent1Stack=mutation.getParents()[0];
        ItemStack parent2Stack=mutation.getParents()[1];
        if (parent1Stack.getItem() == seed && parent1Stack.getItemDamage() == seedMeta) {
          b=true;
          break;
        }
 else         if (parent2Stack.getItem() == seed && parent2Stack.getItemDamage() == seedMeta) {
          b=true;
          break;
        }
      }
    }
  }
  return b;
}

Fixed version (ground truth):
protected boolean canInheritStats(Item child,int childMeta,Item seed,int seedMeta){
  int validParentId=ConfigurationHandler.validParents;
  if (validParentId == 1) {
    return true;
  }
  if (validParentId == 3) {
    return child == seed && childMeta == seedMeta;
  }
  boolean b=child == seed && childMeta == seedMeta;
  if (!b) {
    for (    Mutation mutation : MutationHandler.getMutationsFromChild(child,childMeta)) {
      if (mutation != null) {
        ItemStack parent1Stack=mutation.getParents()[0];
        ItemStack parent2Stack=mutation.getParents()[1];
        if (parent1Stack.getItem() == seed && parent1Stack.getItemDamage() == seedMeta) {
          b=true;
          break;
        }
 else         if (parent2Stack.getItem() == seed && parent2Stack.getItemDamage() == seedMeta) {
          b=true;
          break;
        }
      }
    }
  }
  return b;
}
Program: 95595
Project: 95595
Buggy source:
@Override public void addDebugInfo(List<String> list){
  formMultiBlock();
  list.add("String_Node_Str");
  list.add("String_Node_Str");
  super.addDebugInfo(list);
  list.add("String_Node_Str" + this.component.isPartOfMultiBlock);
  if (this.component.isPartOfMultiBlock) {
    list.add("String_Node_Str" + this.component.size);
    list.add("String_Node_Str" + this.component.sizeX + "String_Node_Str"+ this.component.sizeY+ "String_Node_Str"+ this.component.sizeZ);
    list.add("String_Node_Str" + this.component.isController);
    list.add("String_Node_Str" + this.component.posY);
    list.add("String_Node_Str");
    list.add("String_Node_Str" + component.posX + "String_Node_Str"+ component.posY+ "String_Node_Str"+ component.posZ+ "String_Node_Str");
    list.add("String_Node_Str" + component.anchorX + "String_Node_Str"+ component.anchorY+ "String_Node_Str"+ component.anchorZ+ "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void addDebugInfo(List<String> list){
  formMultiBlock();
  list.add("String_Node_Str");
  list.add("String_Node_Str");
  super.addDebugInfo(list);
  MultiBlockComponent component=this.getComponent();
  list.add("String_Node_Str" + component.isPartOfMultiBlock);
  if (this.getComponent().isPartOfMultiBlock) {
    list.add("String_Node_Str" + component.size);
    list.add("String_Node_Str" + component.sizeX + "String_Node_Str"+ component.sizeY+ "String_Node_Str"+ component.sizeZ);
    list.add("String_Node_Str" + component.isController);
    list.add("String_Node_Str" + component.posY);
    list.add("String_Node_Str");
    list.add("String_Node_Str" + component.posX + "String_Node_Str"+ component.posY+ "String_Node_Str"+ component.posZ+ "String_Node_Str");
    list.add("String_Node_Str" + component.anchorX + "String_Node_Str"+ component.anchorY+ "String_Node_Str"+ component.anchorZ+ "String_Node_Str");
  }
}
Program: 95596
Project: 95596
Buggy source:
/** 
 * Retrieves the   {@link MultiBlockComponent} tied to this tile entity.<p> This has to be done through a getter to prevent the pointer from being modified in this class. </p>
 * @return the {@link MultiBlockComponent} associated with the entity.
 */
public final MultiBlockComponent getComponent(){
  return this.component;
}

Fixed version (ground truth):
/** 
 * Retrieves the   {@link MultiBlockComponent} tied to this tile entity.<p> This has to be done through a getter to prevent the pointer from being modified in this class. </p>
 * @return the {@link MultiBlockComponent} associated with the entity.
 */
public final MultiBlockComponent getComponent(){
  if (this.component == null) {
    resetComponent();
  }
  return this.component;
}
Program: 95597
Project: 95597
Buggy source:
@Override public void writeToNBT(NBTTagCompound tag){
  super.writeToNBT(tag);
  this.component.writeToNBT(tag);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound tag){
  super.writeToNBT(tag);
  this.getComponent().writeToNBT(tag);
}
Program: 95598
Project: 95598
Buggy source:
@Override public void addDebugInfo(List<String> list){
  super.addDebugInfo(list);
  list.add("String_Node_Str");
  list.add("String_Node_Str" + SINGLE_CAPACITY + "String_Node_Str");
  list.add("String_Node_Str" + this.getFluidLevel() + "String_Node_Str"+ this.getCapacity());
  list.add("String_Node_Str" + (int)Math.floor((this.getFluidLevel() - 0.1F) / (this.getCapacity() * getMultiBlockLogic().sizeX() * getMultiBlockLogic().sizeZ())) + "String_Node_Str");
  list.add("String_Node_Str" + this.getFluidHeight());
  StringBuilder neighbours=new StringBuilder();
  for (  ForgeDirection dir : ForgeDirection.values()) {
    if (this.hasNeighbour(dir)) {
      neighbours.append(dir.name()).append("String_Node_Str");
    }
  }
  list.add("String_Node_Str" + neighbours.toString());
  list.add("String_Node_Str" + getMultiBlockLogic().sizeX() + "String_Node_Str"+ getMultiBlockLogic().sizeY()+ "String_Node_Str"+ getMultiBlockLogic().sizeZ());
}

Fixed version (ground truth):
@Override public void addDebugInfo(List<String> list){
  super.addDebugInfo(list);
  list.add("String_Node_Str");
  list.add("String_Node_Str" + xCoord + "String_Node_Str"+ yCoord+ "String_Node_Str"+ zCoord+ "String_Node_Str");
  list.add("String_Node_Str" + SINGLE_CAPACITY + "String_Node_Str");
  list.add("String_Node_Str" + this.getFluidLevel() + "String_Node_Str"+ this.getCapacity());
  list.add("String_Node_Str" + (int)Math.floor((this.getFluidLevel() - 0.1F) / (this.getCapacity() * getMultiBlockLogic().sizeX() * getMultiBlockLogic().sizeZ())) + "String_Node_Str");
  list.add("String_Node_Str" + this.getFluidHeight());
  StringBuilder neighbours=new StringBuilder();
  for (  ForgeDirection dir : ForgeDirection.values()) {
    if (this.hasNeighbour(dir)) {
      neighbours.append(dir.name()).append("String_Node_Str");
    }
  }
  list.add("String_Node_Str" + neighbours.toString());
  list.add("String_Node_Str" + getMultiBlockLogic().sizeX() + "String_Node_Str"+ getMultiBlockLogic().sizeY()+ "String_Node_Str"+ getMultiBlockLogic().sizeZ());
}
Program: 95599
Project: 95599
Buggy source:
@Override public void breakMultiBlock(){
  if (this.getMultiBlockCount() <= 1) {
    return;
  }
  int[] fluidLevelByLayer=new int[this.sizeY()];
  int fluidLevel=getRootComponent().getFluidLevel();
  int area=this.sizeX() * this.sizeZ();
  int fluidContentByLayer=area * TileEntityTank.SINGLE_CAPACITY;
  int layer=0;
  while (fluidLevel > 0) {
    fluidLevelByLayer[layer]=fluidLevel > fluidContentByLayer ? fluidContentByLayer / area : fluidLevel / area;
    fluidLevel=fluidLevel > fluidContentByLayer ? fluidLevel - fluidContentByLayer : 0;
  }
  TileEntityTank root=getRootComponent();
  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)root.getWorldObj().getTileEntity(x,y,z);
        tank.setMultiBlockLogic(new MultiBlockLogicTank(tank));
        tank.setFluidLevel(fluidLevelByLayer[y - root.yCoord]);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void breakMultiBlock(){
  if (this.getMultiBlockCount() <= 1) {
    return;
  }
  int[] fluidLevelByLayer=new int[this.sizeY()];
  int fluidLevel=getRootComponent().getFluidLevel();
  int area=this.sizeX() * this.sizeZ();
  int fluidContentByLayer=area * TileEntityTank.SINGLE_CAPACITY;
  int layer=0;
  while (fluidLevel > 0) {
    fluidLevelByLayer[layer]=fluidLevel > fluidContentByLayer ? fluidContentByLayer / area : fluidLevel / area;
    fluidLevel=fluidLevel > fluidContentByLayer ? fluidLevel - fluidContentByLayer : 0;
    layer++;
  }
  TileEntityTank root=getRootComponent();
  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)root.getWorldObj().getTileEntity(x,y,z);
        if (tank == null) {
          continue;
        }
        tank.setMultiBlockLogic(new MultiBlockLogicTank(tank));
        tank.setFluidLevel(fluidLevelByLayer[y - root.yCoord]);
      }
    }
  }
}
Program: 95600
Project: 95600
Buggy source:
@Override public boolean checkForMultiBlock(){
  CoordinateIterator iterator=new CoordinateIterator();
  TileEntityTank oldRoot=getRootComponent();
  int xMin=calculateDimensionOffsetBackwards(iterator.setX());
  int yMin=calculateDimensionOffsetBackwards(iterator.setY());
  int zMin=calculateDimensionOffsetBackwards(iterator.setZ());
  int xMax=calculateDimensionOffsetForwards(iterator.setX());
  int yMax=calculateDimensionOffsetForwards(iterator.setY());
  int zMax=calculateDimensionOffsetForwards(iterator.setZ());
  if (!areAllBlocksInRangeValidComponents(xMin,yMin,zMin,xMax,yMax,zMax)) {
    return false;
  }
  TileEntityTank newRoot=(TileEntityTank)oldRoot.getWorldObj().getTileEntity(oldRoot.xCoord - xMin,oldRoot.yCoord - yMin,oldRoot.zCoord - zMin);
  int xSizeNew=xMax + xMin;
  int ySizeNew=yMax + yMin;
  int zSizeNew=zMax + zMin;
  if (oldRoot == newRoot && xSizeNew == this.sizeX && ySizeNew == this.sizeY && zSizeNew == this.sizeZ) {
    return false;
  }
  breakAllMultiBlocksInRange(xMin,yMin,zMin,xMax,yMax,zMax);
  this.rootComponent=newRoot;
  this.sizeX=xSizeNew;
  this.sizeY=ySizeNew;
  this.sizeZ=zSizeNew;
  createMultiBlock();
  return true;
}

Fixed version (ground truth):
@Override public boolean checkForMultiBlock(){
  CoordinateIterator iterator=new CoordinateIterator();
  TileEntityTank oldRoot=getRootComponent();
  int xMin=calculateDimensionOffsetBackwards(iterator.setX());
  int yMin=calculateDimensionOffsetBackwards(iterator.setY());
  int zMin=calculateDimensionOffsetBackwards(iterator.setZ());
  int xMax=calculateDimensionOffsetForwards(iterator.setX());
  int yMax=calculateDimensionOffsetForwards(iterator.setY());
  int zMax=calculateDimensionOffsetForwards(iterator.setZ());
  if (!areAllBlocksInRangeValidComponents(xMin,yMin,zMin,xMax,yMax,zMax)) {
    return false;
  }
  TileEntityTank newRoot=(TileEntityTank)oldRoot.getWorldObj().getTileEntity(oldRoot.xCoord - xMin,oldRoot.yCoord - yMin,oldRoot.zCoord - zMin);
  int xSizeNew=xMax + xMin;
  int ySizeNew=yMax + yMin;
  int zSizeNew=zMax + zMin;
  if (oldRoot == newRoot && xSizeNew == this.sizeX && ySizeNew == this.sizeY && zSizeNew == this.sizeZ) {
    return false;
  }
  breakAllMultiBlocksInRange(xMin,yMin,zMin,xMax,yMax,zMax);
  int fluidLevel=calculateTotalFluidLevelForBlocksInRange(xMin,yMin,zMin,xMax,yMax,zMax);
  this.sizeX=xSizeNew;
  this.sizeY=ySizeNew;
  this.sizeZ=zSizeNew;
  this.rootComponent=newRoot;
  createMultiBlock();
  newRoot.setFluidLevel(fluidLevel);
  return true;
}