nus-yam/ex-repair huggingface dataset:
Program: 161338
Project: 161338
Buggy source:
private void checkAdjacentInventory(ForgeDirection dir){
  int side=dir.ordinal();
  TileEntity te=worldObj.getTileEntity(xCoord + dir.offsetX,yCoord + dir.offsetY,zCoord + dir.offsetZ);
  if (adjacentInvs[dir.ordinal()].set(te)) {
    distributeSide(dir);
  }
}

Fixed version (ground truth):
private void checkAdjacentInventory(ForgeDirection dir){
  TileEntity te=worldObj.getTileEntity(xCoord + dir.offsetX,yCoord + dir.offsetY,zCoord + dir.offsetZ);
  if (adjacentInvs[dir.ordinal()].set(te)) {
    distributeSide(dir);
  }
}
Program: 161339
Project: 161339
Buggy source:
public void setLabelText(String newText){
  if (newText == labelText) {
    return;
  }
  labelText=newText;
  recalculateSize();
}

Fixed version (ground truth):
public void setLabelText(String newText){
  if (newText.equals(labelText)) {
    return;
  }
  labelText=newText;
  recalculateSize();
}
Program: 161340
Project: 161340
Buggy source:
public GuiSelectableButton(int id,int x,int y,IIcon icon,int selectedColor,BeefGuiBase containingWindow){
  super(id,x,y,24,24,"String_Node_Str");
  selected=false;
  this.icon=icon;
  this.selectedColor=selectedColor;
  window=containingWindow;
  relativeX=x - window.getGuiLeft();
  relativeY=y - window.getGuiTop();
}

Fixed version (ground truth):
public GuiSelectableButton(int id,int x,int y,IIcon icon,int selectedColor,BeefGuiBase containingWindow){
  super(id,x,y,24,24,"String_Node_Str");
  selected=false;
  this.icon=icon;
  this.selectedColor=selectedColor;
  window=containingWindow;
}
Program: 161341
Project: 161341
Buggy source:
@Override public void onSlotSet(){
  currentCircuitType=((RedNetConfigGrabbable)this.grabbable).GetCircuitType();
  tooltip=((RedNetConfigGrabbable)this.grabbable).getName();
  if (guiContainer instanceof GuiReactorRedNetPort) {
    ((GuiReactorRedNetPort)guiContainer).onChannelChanged(this.channel);
  }
}

Fixed version (ground truth):
@Override public void onSlotSet(){
  currentCircuitType=((RedNetConfigGrabbable)this.grabbable).getCircuitType();
  tooltip=((RedNetConfigGrabbable)this.grabbable).getName();
  if (guiContainer instanceof GuiReactorRedNetPort) {
    ((GuiReactorRedNetPort)guiContainer).onChannelChanged(this.channel);
  }
}
Program: 161342
Project: 161342
Buggy source:
@Override public void init(){
  super.init();
  CommonPacketHandler.initClient();
  FMLCommonHandler.instance().bus().register(new MultiblockClientTickHandler());
  FMLCommonHandler.instance().bus().register(new BRRenderTickHandler());
  BlockFuelRod.renderId=RenderingRegistry.getNextAvailableRenderId();
  ISimpleBlockRenderingHandler fuelRodISBRH=new SimpleRendererFuelRod();
  RenderingRegistry.registerBlockHandler(BlockFuelRod.renderId,fuelRodISBRH);
  BlockTurbineRotorPart.renderId=RenderingRegistry.getNextAvailableRenderId();
  ISimpleBlockRenderingHandler rotorISBRH=new RotorSimpleRenderer();
  RenderingRegistry.registerBlockHandler(BlockTurbineRotorPart.renderId,rotorISBRH);
  if (BigReactors.blockTurbinePart != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurbineRotorBearing.class,new RotorSpecialRenderer());
  }
}

Fixed version (ground truth):
@Override public void init(){
  super.init();
  FMLCommonHandler.instance().bus().register(new MultiblockClientTickHandler());
  FMLCommonHandler.instance().bus().register(new BRRenderTickHandler());
  BlockFuelRod.renderId=RenderingRegistry.getNextAvailableRenderId();
  ISimpleBlockRenderingHandler fuelRodISBRH=new SimpleRendererFuelRod();
  RenderingRegistry.registerBlockHandler(BlockFuelRod.renderId,fuelRodISBRH);
  BlockTurbineRotorPart.renderId=RenderingRegistry.getNextAvailableRenderId();
  ISimpleBlockRenderingHandler rotorISBRH=new RotorSimpleRenderer();
  RenderingRegistry.registerBlockHandler(BlockTurbineRotorPart.renderId,rotorISBRH);
  if (BigReactors.blockTurbinePart != null) {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurbineRotorBearing.class,new RotorSpecialRenderer());
  }
}
Program: 161343
Project: 161343
Buggy source:
public void init(){
  BigReactors.registerTileEntities();
  CommonPacketHandler.initServer();
  NetworkRegistry.INSTANCE.registerGuiHandler(BRLoader.instance,new BigReactorsGUIHandler());
  BigReactors.tickHandler=new BigReactorsTickHandler();
  FMLCommonHandler.instance().bus().register(BigReactors.tickHandler);
  FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
  sendInterModAPIMessages();
}

Fixed version (ground truth):
public void init(){
  BigReactors.registerTileEntities();
  CommonPacketHandler.init();
  NetworkRegistry.INSTANCE.registerGuiHandler(BRLoader.instance,new BigReactorsGUIHandler());
  BigReactors.tickHandler=new BigReactorsTickHandler();
  FMLCommonHandler.instance().bus().register(BigReactors.tickHandler);
  FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
  sendInterModAPIMessages();
}
Program: 161344
Project: 161344
Buggy source:
public static void initClient(){
  INSTANCE.registerMessage(DeviceUpdateMessage.Handler.class,DeviceUpdateMessage.class,1,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateRotationMessage.Handler.class,DeviceUpdateRotationMessage.class,3,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateInvExposureMessage.Handler.class,DeviceUpdateInvExposureMessage.class,5,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateFluidExposureMessage.Handler.class,DeviceUpdateFluidExposureMessage.class,7,Side.CLIENT);
  INSTANCE.registerMessage(ControlRodUpdateMessage.Handler.class,ControlRodUpdateMessage.class,9,Side.CLIENT);
  INSTANCE.registerMessage(ReactorUpdateMessage.Handler.class,ReactorUpdateMessage.class,11,Side.CLIENT);
  INSTANCE.registerMessage(ReactorUpdateWasteEjectionMessage.Handler.class,ReactorUpdateWasteEjectionMessage.class,13,Side.CLIENT);
  INSTANCE.registerMessage(TurbineUpdateMessage.Handler.class,TurbineUpdateMessage.class,15,Side.CLIENT);
}

Fixed version (ground truth):
protected static void initClient(){
  INSTANCE.registerMessage(DeviceUpdateMessage.Handler.class,DeviceUpdateMessage.class,1,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateRotationMessage.Handler.class,DeviceUpdateRotationMessage.class,3,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateInvExposureMessage.Handler.class,DeviceUpdateInvExposureMessage.class,5,Side.CLIENT);
  INSTANCE.registerMessage(DeviceUpdateFluidExposureMessage.Handler.class,DeviceUpdateFluidExposureMessage.class,7,Side.CLIENT);
  INSTANCE.registerMessage(ControlRodUpdateMessage.Handler.class,ControlRodUpdateMessage.class,9,Side.CLIENT);
  INSTANCE.registerMessage(ReactorUpdateMessage.Handler.class,ReactorUpdateMessage.class,11,Side.CLIENT);
  INSTANCE.registerMessage(ReactorUpdateWasteEjectionMessage.Handler.class,ReactorUpdateWasteEjectionMessage.class,13,Side.CLIENT);
  INSTANCE.registerMessage(TurbineUpdateMessage.Handler.class,TurbineUpdateMessage.class,15,Side.CLIENT);
}
Program: 161346
Project: 161346
Buggy source:
public static boolean isFuel(String name){
  if (name == null) {
    return false;
  }
 else {
    ReactantData data=getReactant(name);
    return data != null && data.isFuel();
  }
}

Fixed version (ground truth):
/** 
 * Returns true if a given name represents a reactant.
 * @param name
 * @return
 */
public static boolean isFuel(String name){
  if (name == null) {
    return false;
  }
 else {
    ReactantData data=getReactant(name);
    return data != null && data.isFuel();
  }
}
Program: 161347
Project: 161347
Buggy source:
public static ItemStack registerIngots(int id){
  if (BigReactors.ingotGeneric == null) {
    BRConfig.CONFIGURATION.load();
    registerYelloriumAsUranium=BRConfig.CONFIGURATION.get("String_Node_Str","String_Node_Str",true,"String_Node_Str").getBoolean(true);
    BigReactors.ingotGeneric=new ItemIngot();
    GameRegistry.registerItem(ingotGeneric,"String_Node_Str");
    String itemName;
    for (int i=0; i < ItemIngot.TYPES.length; i++) {
      itemName=ItemIngot.TYPES[i];
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType(itemName),itemName);
    }
    if (registerYelloriumAsUranium) {
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType("String_Node_Str"),"String_Node_Str");
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType("String_Node_Str"),"String_Node_Str");
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType("String_Node_Str"),"String_Node_Str");
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType("String_Node_Str"),"String_Node_Str");
    }
    BRConfig.CONFIGURATION.save();
  }
  return new ItemStack(ingotGeneric);
}

Fixed version (ground truth):
public static ItemStack registerIngots(int id){
  if (BigReactors.ingotGeneric == null) {
    BRConfig.CONFIGURATION.load();
    registerYelloriumAsUranium=BRConfig.CONFIGURATION.get("String_Node_Str","String_Node_Str",true,"String_Node_Str").getBoolean(true);
    BigReactors.ingotGeneric=new ItemIngot();
    GameRegistry.registerItem(ingotGeneric,"String_Node_Str");
    String itemName;
    for (int i=0; i < ItemIngot.TYPES.length; i++) {
      itemName=ItemIngot.TYPES[i];
      OreDictionaryArbiter.registerOreDictionaryEntry(ingotGeneric.getItemStackForType(itemName),itemName);
    }
    if (registerYelloriumAsUranium) {
      OreDictionary.registerOre("String_Node_Str",ingotGeneric.getItemStackForType("String_Node_Str"));
      OreDictionary.registerOre("String_Node_Str",ingotGeneric.getItemStackForType("String_Node_Str"));
      OreDictionary.registerOre("String_Node_Str",ingotGeneric.getItemStackForType("String_Node_Str"));
      OreDictionary.registerOre("String_Node_Str",ingotGeneric.getItemStackForType("String_Node_Str"));
    }
    BRConfig.CONFIGURATION.save();
  }
  return new ItemStack(ingotGeneric);
}
Program: 161348
Project: 161348
Buggy source:
public static void registerTurbineParts(){
  if (BigReactors.blockTurbinePart == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockTurbinePart=new BlockTurbinePart(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockTurbinePart,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbinePart.getItemStack("String_Node_Str"),"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbinePart.getItemStack("String_Node_Str"),"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbinePart.getItemStack("String_Node_Str"),"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbinePart.getItemStack("String_Node_Str"),"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbinePart.getItemStack("String_Node_Str"),"String_Node_Str");
    BRConfig.CONFIGURATION.save();
  }
  if (BigReactors.blockTurbineRotorPart == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockTurbineRotorPart=new BlockTurbineRotorPart(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockTurbineRotorPart,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbineRotorPart.getItemStack("String_Node_Str"),"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(BigReactors.blockTurbineRotorPart.getItemStack("String_Node_Str"),"String_Node_Str");
    BRConfig.CONFIGURATION.save();
  }
}

Fixed version (ground truth):
public static void registerTurbineParts(){
  if (BigReactors.blockTurbinePart == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockTurbinePart=new BlockTurbinePart(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockTurbinePart,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbinePart.getItemStack("String_Node_Str"));
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbinePart.getItemStack("String_Node_Str"));
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbinePart.getItemStack("String_Node_Str"));
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbinePart.getItemStack("String_Node_Str"));
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbinePart.getItemStack("String_Node_Str"));
    BRConfig.CONFIGURATION.save();
  }
  if (BigReactors.blockTurbineRotorPart == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockTurbineRotorPart=new BlockTurbineRotorPart(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockTurbineRotorPart,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbineRotorPart.getItemStack("String_Node_Str"));
    OreDictionary.registerOre("String_Node_Str",BigReactors.blockTurbineRotorPart.getItemStack("String_Node_Str"));
    BRConfig.CONFIGURATION.save();
  }
}
Program: 161350
Project: 161350
Buggy source:
public static void registerDevices(int id,boolean require){
  if (BigReactors.blockDevice == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockDevice=new BlockBRDevice(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockDevice,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionaryArbiter.registerOreDictionaryEntry(((BlockBRDevice)BigReactors.blockDevice).getCyaniteReprocessorItemStack(),"String_Node_Str");
    BRConfig.CONFIGURATION.save();
  }
}

Fixed version (ground truth):
public static void registerDevices(int id,boolean require){
  if (BigReactors.blockDevice == null) {
    BRConfig.CONFIGURATION.load();
    BigReactors.blockDevice=new BlockBRDevice(Material.iron);
    GameRegistry.registerBlock(BigReactors.blockDevice,ItemBlockBigReactors.class,"String_Node_Str");
    OreDictionary.registerOre("String_Node_Str",((BlockBRDevice)BigReactors.blockDevice).getCyaniteReprocessorItemStack());
    BRConfig.CONFIGURATION.save();
  }
}
Program: 161352
Project: 161352
Buggy source:
public void registerOreDictEntries(){
  for (int i=0; i < NUM_BLOCKS; i++) {
    OreDictionaryArbiter.registerOreDictionaryEntry(new ItemStack(this,1,i),_subBlocks[i]);
  }
}

Fixed version (ground truth):
public void registerOreDictEntries(){
  for (int i=0; i < NUM_BLOCKS; i++) {
    OreDictionary.registerOre(_subBlocks[i],new ItemStack(this,1,i));
  }
}
Program: 161353
Project: 161353
Buggy source:
@Override public int[] getAccessibleSlotsFromSide(int side){
  int metadata=this.getBlockMetadata();
  if (isInlet()) {
    return new int[]{SLOT_INLET};
  }
 else {
    return new int[]{SLOT_OUTLET};
  }
}

Fixed version (ground truth):
@Override public int[] getAccessibleSlotsFromSide(int side){
  int metadata=this.getBlockMetadata();
  if (isInlet()) {
    return kInletExposed;
  }
 else {
    return kOutletExposed;
  }
}
Program: 161354
Project: 161354
Buggy source:
@Override public boolean isItemValid(ItemStack stack){
  FluidStack data;
  if (fuel)   return Reactants.isFuel(stack);
 else   return Reactants.isWaste(stack);
}

Fixed version (ground truth):
@Override public boolean isItemValid(ItemStack stack){
  if (stack == null) {
    return false;
  }
  if (fuel) {
    return Reactants.isFuel(stack);
  }
 else {
    return Reactants.isWaste(stack);
  }
}
Program: 161355
Project: 161355
Buggy source:
@EventHandler public void preInit(FMLPreInitializationEvent event){
  BigReactors.registerOres(0,true);
  BigReactors.registerIngots(0);
  BigReactors.registerFuelRods(0,true);
  BigReactors.registerReactorPartBlocks(0,true);
  BigReactors.registerTurbineParts();
  BigReactors.registerDevices(0,true);
  BigReactors.registerFluids(0,true);
  BigReactors.registerCreativeParts(0,true);
  BigReactors.eventHandler=new BREventHandler();
  MinecraftForge.EVENT_BUS.register(BigReactors.eventHandler);
  MinecraftForge.EVENT_BUS.register(proxy);
  multiblockEventHandler=new MultiblockEventHandler();
  MinecraftForge.EVENT_BUS.register(multiblockEventHandler);
  proxy.preInit();
  Fluid waterFluid=FluidRegistry.WATER;
}

Fixed version (ground truth):
@EventHandler public void preInit(FMLPreInitializationEvent event){
  BigReactors.registerOres(0,true);
  BigReactors.registerIngots(0);
  BigReactors.registerFuelRods(0,true);
  BigReactors.registerReactorPartBlocks(0,true);
  BigReactors.registerTurbineParts();
  BigReactors.registerDevices(0,true);
  BigReactors.registerFluids(0,true);
  BigReactors.registerCreativeParts(0,true);
  StandardReactants.register();
  BigReactors.eventHandler=new BREventHandler();
  MinecraftForge.EVENT_BUS.register(BigReactors.eventHandler);
  MinecraftForge.EVENT_BUS.register(proxy);
  multiblockEventHandler=new MultiblockEventHandler();
  MinecraftForge.EVENT_BUS.register(multiblockEventHandler);
  proxy.preInit();
  Fluid waterFluid=FluidRegistry.WATER;
}
Program: 161357
Project: 161357
Buggy source:
public void preInit(){
  StandardReactants.register();
}

Fixed version (ground truth):
public void preInit(){
}
Program: 161358
Project: 161358
Buggy source:
public static ReactantStack createFromNBT(NBTTagCompound tag){
  String name=null;
  int amount=0;
  if (tag.hasKey("String_Node_Str")) {
    name=tag.getString("String_Node_Str");
  }
 else {
    BRLog.warning("String_Node_Str");
    return null;
  }
  if (tag.hasKey("String_Node_Str")) {
    amount=tag.getInteger("String_Node_Str");
  }
  return new ReactantStack(name,amount);
}

Fixed version (ground truth):
public static ReactantStack createFromNBT(NBTTagCompound tag){
  String name=null;
  int amount=0;
  if (tag.hasKey("String_Node_Str")) {
    name=tag.getString("String_Node_Str");
  }
 else {
    return null;
  }
  if (tag.hasKey("String_Node_Str")) {
    amount=tag.getInteger("String_Node_Str");
  }
  return new ReactantStack(name,amount);
}
Program: 161359
Project: 161359
Buggy source:
public static void register(){
  Reactants.registerReactant(yellorium,0,colorYellorium);
  Reactants.registerReactant(cyanite,0,colorCyanite);
  Reactants.registerReactant(blutonium,0,colorYellorium);
}

Fixed version (ground truth):
public static void register(){
  Reactants.registerReactant(yellorium,0,colorYellorium);
  Reactants.registerReactant(cyanite,1,colorCyanite);
  Reactants.registerReactant(blutonium,0,colorYellorium);
}
Program: 161360
Project: 161360
Buggy source:
@Override public boolean isReactantValidForStack(int idx,String name){
switch (idx) {
case FUEL:
    return Reactants.isFuel(name);
case WASTE:
  return Reactants.isWaste(name);
default :
return false;
}
}

Fixed version (ground truth):
@Override public boolean isReactantValidForStack(int idx,String name){
switch (idx) {
case FUEL:
    return Reactants.isFuel(name);
case WASTE:
  return true;
default :
return false;
}
}
Program: 161361
Project: 161361
Buggy source:
public int addFuel(String name,int amount,boolean doAdd){
  if (name == null || amount <= 0) {
    return 0;
  }
 else {
    return fill(FUEL,name,amount,doAdd);
  }
}

Fixed version (ground truth):
/** 
 * Add some fuel to the current pile, if possible.
 * @param name The name of the reactant to add.
 * @param amount The quantity of reactant to add.
 * @param doAdd If true, this will only simulate a fill and will not alter the fuel amount.
 * @return The amount of reactant actually added
 */
public int addFuel(String name,int amount,boolean doAdd){
  if (name == null || amount <= 0) {
    return 0;
  }
 else {
    return fill(FUEL,name,amount,doAdd);
  }
}
Program: 161362
Project: 161362
Buggy source:
protected void readFromNBT(NBTTagCompound data){
  for (int i=0; i < tankNames.length; i++) {
    if (data.hasKey(tankNames[i])) {
      tanks[i]=ReactantStack.createFromNBT(data.getCompoundTag(tankNames[i]));
      levelAtLastUpdate[i]=tanks[i].amount;
    }
 else {
      tanks[i]=null;
      levelAtLastUpdate[i]=0;
    }
  }
}

Fixed version (ground truth):
protected void readFromNBT(NBTTagCompound data){
  for (int i=0; i < tankNames.length; i++) {
    if (data.hasKey(tankNames[i])) {
      tanks[i]=ReactantStack.createFromNBT(data.getCompoundTag(tankNames[i]));
      levelAtLastUpdate[i]=tanks[i] != null ? tanks[i].amount : FORCE_UPDATE;
    }
 else {
      tanks[i]=null;
      levelAtLastUpdate[i]=FORCE_UPDATE;
    }
  }
}
Program: 161363
Project: 161363
Buggy source:
public int fill(int idx,ReactantStack incoming,boolean doFill){
  if (incoming == null) {
    return 0;
  }
  return fill(idx,incoming.getName(),incoming.amount,doFill);
}

Fixed version (ground truth):
public int fill(int idx,String reactantName,int amount,boolean doFill){
  assert(idx >= 0 && idx < tanks.length);
  if (reactantName == null || amount <= 0) {
    return 0;
  }
  if (!canAddToStack(idx,reactantName)) {
    return 0;
  }
  int amtToAdd=Math.min(amount,getRemainingSpace());
  if (amtToAdd <= 0) {
    return 0;
  }
  if (!doFill) {
    return amtToAdd;
  }
  if (tanks[idx] == null) {
    tanks[idx]=new ReactantStack(reactantName,amtToAdd);
  }
 else {
    tanks[idx].amount+=amtToAdd;
  }
  return amtToAdd;
}
Program: 161364
Project: 161364
Buggy source:
public void serialize(ByteBuf buffer){
  for (int i=0; i < tankNames.length; i++) {
    if (getReactantAmount(i) <= 0) {
      buffer.writeBoolean(false);
    }
 else {
      ByteBufUtils.writeUTF8String(buffer,tanks[i].getName());
      buffer.writeInt(tanks[i].amount);
    }
  }
}

Fixed version (ground truth):
public void serialize(ByteBuf buffer){
  buffer.writeInt(capacity);
  for (int i=0; i < tankNames.length; i++) {
    boolean hasReactant=getReactantAmount(i) > 0;
    buffer.writeBoolean(hasReactant);
    if (hasReactant) {
      ByteBufUtils.writeUTF8String(buffer,tanks[i].getName());
      buffer.writeInt(tanks[i].amount);
    }
  }
}
Program: 161365
Project: 161365
Buggy source:
public void deserialize(ByteBuf buffer){
  for (int i=0; i < tankNames.length; i++) {
    boolean hasData=buffer.readBoolean();
    if (hasData) {
      String reactantName=ByteBufUtils.readUTF8String(buffer);
      int amount=buffer.readInt();
      if (!Reactants.isKnown(reactantName)) {
        BRLog.warning("String_Node_Str",reactantName,tankNames[i]);
      }
 else {
        tanks[i]=new ReactantStack(reactantName,amount);
        levelAtLastUpdate[i]=amount;
      }
    }
  }
}

Fixed version (ground truth):
public void deserialize(ByteBuf buffer){
  capacity=buffer.readInt();
  for (int i=0; i < tankNames.length; i++) {
    tanks[i]=null;
    boolean hasReactant=buffer.readBoolean();
    if (hasReactant) {
      String reactantName=ByteBufUtils.readUTF8String(buffer);
      int amount=buffer.readInt();
      if (!Reactants.isKnown(reactantName)) {
        BRLog.warning("String_Node_Str",reactantName,tankNames[i]);
      }
 else {
        tanks[i]=new ReactantStack(reactantName,amount);
        levelAtLastUpdate[i]=amount;
      }
    }
  }
}
Program: 161366
Project: 161366
Buggy source:
@Override public void decodeDescriptionPacket(NBTTagCompound data){
  if (data.hasKey("String_Node_Str")) {
    this.wasteEjection=s_EjectionSettings[data.getInteger("String_Node_Str")];
  }
  if (data.hasKey("String_Node_Str")) {
    this.setActive(data.getBoolean("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    this.energyStored=data.getFloat("String_Node_Str");
  }
  if (data.hasKey("String_Node_Str")) {
    setReactorHeat(data.getFloat("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    setFuelHeat(data.getFloat("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    fuelContainer.readFromNBT(data.getCompoundTag("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    radiationHelper.readFromNBT(data.getCompoundTag("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    coolantContainer.readFromNBT(data.getCompoundTag("String_Node_Str"));
  }
  onFuelStatusChanged();
}

Fixed version (ground truth):
@Override public void decodeDescriptionPacket(NBTTagCompound data){
  readFromNBT(data);
  onFuelStatusChanged();
}
Program: 161367
Project: 161367
Buggy source:
@Override public void formatDescriptionPacket(NBTTagCompound data){
  data.setInteger("String_Node_Str",this.wasteEjection.ordinal());
  data.setFloat("String_Node_Str",this.energyStored);
  data.setFloat("String_Node_Str",this.reactorHeat);
  data.setBoolean("String_Node_Str",this.getActive());
  data.setFloat("String_Node_Str",fuelHeat);
  data.setTag("String_Node_Str",fuelContainer.writeToNBT(new NBTTagCompound()));
  data.setTag("String_Node_Str",radiationHelper.writeToNBT(new NBTTagCompound()));
  data.setTag("String_Node_Str",coolantContainer.writeToNBT(new NBTTagCompound()));
}

Fixed version (ground truth):
@Override public void formatDescriptionPacket(NBTTagCompound data){
  writeToNBT(data);
}
Program: 161368
Project: 161368
Buggy source:
public void setActive(boolean act){
  if (act == this.active) {
    return;
  }
  this.active=act;
  for (  IMultiblockPart part : connectedParts) {
    if (this.active) {
      part.onMachineActivated();
    }
 else {
      part.onMachineDeactivated();
    }
  }
}

Fixed version (ground truth):
public void setActive(boolean act){
  if (act == this.active) {
    return;
  }
  this.active=act;
  for (  IMultiblockPart part : connectedParts) {
    if (this.active) {
      part.onMachineActivated();
    }
 else {
      part.onMachineDeactivated();
    }
  }
  if (worldObj.isRemote) {
    for (    IMultiblockPart part : attachedControllers) {
      worldObj.markBlockForUpdate(part.xCoord,part.yCoord,part.zCoord);
    }
  }
}
Program: 161369
Project: 161369
Buggy source:
@Override public void readFromNBT(NBTTagCompound tag){
  super.readFromNBT(tag);
  _inventories=new ItemStack[getSizeInventory()];
  if (tag.hasKey("String_Node_Str")) {
    NBTTagList tagList=tag.getTagList("String_Node_Str",10);
    for (int i=0; i < tagList.tagCount(); i++) {
      NBTTagCompound itemTag=(NBTTagCompound)tagList.getCompoundTagAt(i);
      int slot=itemTag.getByte("String_Node_Str") & 0xff;
      if (slot >= 0 && slot <= _inventories.length) {
        ItemStack itemStack=new ItemStack((Block)null,0,0);
        itemStack.readFromNBT(itemTag);
        _inventories[slot]=itemStack;
      }
    }
  }
  if (tag.hasKey("String_Node_Str")) {
    setInlet(tag.getBoolean("String_Node_Str"),false);
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound tag){
  super.readFromNBT(tag);
  _inventories=new ItemStack[getSizeInventory()];
  if (tag.hasKey("String_Node_Str")) {
    NBTTagList tagList=tag.getTagList("String_Node_Str",10);
    for (int i=0; i < tagList.tagCount(); i++) {
      NBTTagCompound itemTag=(NBTTagCompound)tagList.getCompoundTagAt(i);
      int slot=itemTag.getByte("String_Node_Str") & 0xff;
      if (slot >= 0 && slot <= _inventories.length) {
        ItemStack itemStack=new ItemStack((Block)null,0,0);
        itemStack.readFromNBT(itemTag);
        _inventories[slot]=itemStack;
      }
    }
  }
  if (tag.hasKey("String_Node_Str")) {
    this.isInlet=tag.getBoolean("String_Node_Str");
  }
}
Program: 161370
Project: 161370
Buggy source:
protected void setInlet(boolean shouldBeInlet,boolean markDirty){
  if (isInlet == shouldBeInlet) {
    return;
  }
  isInlet=shouldBeInlet;
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  if (markDirty && !worldObj.isRemote) {
    markDirty();
  }
}

Fixed version (ground truth):
public void setInlet(boolean shouldBeInlet){
  if (isInlet == shouldBeInlet) {
    return;
  }
  isInlet=shouldBeInlet;
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  if (!worldObj.isRemote) {
    markDirty();
  }
 else {
    notifyNeighborsOfTileChange();
  }
}
Program: 161371
Project: 161371
Buggy source:
@Override protected void isBlockGoodForInterior(World world,int x,int y,int z) throws MultiblockValidationException {
  if (world.isAirBlock(x,y,z)) {
    return;
  }
  Material material=world.getBlock(x,y,z).getMaterial();
  if (material == net.minecraft.block.material.MaterialLiquid.water) {
    return;
  }
  Block block=world.getBlock(x,y,z);
  if (block == Blocks.iron_block || block == Blocks.gold_block || block == Blocks.diamond_block || block == Blocks.emerald_block) {
    return;
  }
  int metadata=world.getBlockMetadata(x,y,z);
  int oreId=OreDictionary.getOreID(new ItemStack(block,1,metadata));
  if (oreId >= 0 && BRRegistry.getReactorInteriorBlockData(OreDictionary.getOreName(oreId)) != null) {
    return;
  }
  if (block != null) {
    if (block instanceof IFluidBlock) {
      Fluid fluid=((IFluidBlock)block).getFluid();
      String fluidName=fluid.getName();
      if (BRRegistry.getReactorInteriorFluidData(fluidName) != null) {
        return;
      }
      throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z,fluidName));
    }
 else {
      throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z,block.getLocalizedName()));
    }
  }
 else {
    throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z,block.getLocalizedName()));
  }
}

Fixed version (ground truth):
@Override protected void isBlockGoodForInterior(World world,int x,int y,int z) throws MultiblockValidationException {
  if (world.isAirBlock(x,y,z)) {
    return;
  }
  Material material=world.getBlock(x,y,z).getMaterial();
  if (material == net.minecraft.block.material.MaterialLiquid.water) {
    return;
  }
  Block block=world.getBlock(x,y,z);
  if (block == Blocks.iron_block || block == Blocks.gold_block || block == Blocks.diamond_block || block == Blocks.emerald_block) {
    return;
  }
  int metadata=world.getBlockMetadata(x,y,z);
  int oreId=OreDictionary.getOreID(new ItemStack(block,1,metadata));
  if (oreId >= 0 && BRRegistry.getReactorInteriorBlockData(OreDictionary.getOreName(oreId)) != null) {
    return;
  }
  if (block != null) {
    if (block instanceof IFluidBlock) {
      Fluid fluid=((IFluidBlock)block).getFluid();
      String fluidName=fluid.getName();
      if (BRRegistry.getReactorInteriorFluidData(fluidName) != null) {
        return;
      }
      throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z,fluidName));
    }
 else {
      throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z,block.getLocalizedName()));
    }
  }
 else {
    throw new MultiblockValidationException(String.format("String_Node_Str",x,y,z));
  }
}
Program: 161372
Project: 161372
Buggy source:
@Override public void onNeighborTileChange(World world,int x,int y,int z,int neighborX,int neighborY,int neighborZ){
  checkForAdjacentTank();
}

Fixed version (ground truth):
@Override public void onNeighborTileChange(IBlockAccess world,int x,int y,int z,int neighborX,int neighborY,int neighborZ){
  checkForAdjacentTank();
}
Program: 161373
Project: 161373
Buggy source:
@Override protected void onBlockAdded(IMultiblockPart part){
  if (part instanceof TileEntityReactorAccessPort) {
    attachedAccessPorts.add((TileEntityReactorAccessPort)part);
  }
  if (part instanceof TileEntityReactorControlRod) {
    TileEntityReactorControlRod controlRod=(TileEntityReactorControlRod)part;
    attachedControlRods.add(controlRod);
    if (controlRod.getCachedFuel() != null) {
      fuelContainer.addFuel(controlRod.getCachedFuel());
      worldObj.markTileEntityChunkModified(controlRod.xCoord,controlRod.yCoord,controlRod.zCoord,controlRod);
    }
  }
  if (part instanceof TileEntityReactorPowerTap) {
    attachedPowerTaps.add((TileEntityReactorPowerTap)part);
  }
  if (part instanceof TileEntityReactorPart) {
    TileEntityReactorPart reactorPart=(TileEntityReactorPart)part;
    if (BlockReactorPart.isController(reactorPart.getBlockMetadata())) {
      attachedControllers.add(reactorPart);
    }
  }
  if (part instanceof ITickableMultiblockPart) {
    attachedTickables.add((ITickableMultiblockPart)part);
  }
  if (part instanceof TileEntityReactorFuelRod) {
    TileEntityReactorFuelRod fuelRod=(TileEntityReactorFuelRod)part;
    attachedFuelRods.add(fuelRod);
    currentFuelRod=attachedFuelRods.iterator();
    if (worldObj.isRemote) {
      worldObj.markBlockForRenderUpdate(fuelRod.xCoord,fuelRod.yCoord,fuelRod.zCoord);
    }
  }
  if (part instanceof TileEntityReactorCoolantPort) {
    attachedCoolantPorts.add((TileEntityReactorCoolantPort)part);
  }
}

Fixed version (ground truth):
@Override protected void onBlockAdded(IMultiblockPart part){
  if (part instanceof TileEntityReactorAccessPort) {
    attachedAccessPorts.add((TileEntityReactorAccessPort)part);
  }
  if (part instanceof TileEntityReactorControlRod) {
    TileEntityReactorControlRod controlRod=(TileEntityReactorControlRod)part;
    attachedControlRods.add(controlRod);
    if (controlRod.getCachedFuel() != null) {
      fuelContainer.addFuel(controlRod.getCachedFuel());
      worldObj.markTileEntityChunkModified(controlRod.xCoord,controlRod.yCoord,controlRod.zCoord,controlRod);
    }
  }
  if (part instanceof TileEntityReactorPowerTap) {
    attachedPowerTaps.add((TileEntityReactorPowerTap)part);
  }
  if (part instanceof TileEntityReactorPart) {
    TileEntityReactorPart reactorPart=(TileEntityReactorPart)part;
    if (BlockReactorPart.isController(reactorPart.getBlockMetadata())) {
      attachedControllers.add(reactorPart);
    }
  }
  if (part instanceof ITickableMultiblockPart) {
    attachedTickables.add((ITickableMultiblockPart)part);
  }
  if (part instanceof TileEntityReactorFuelRod) {
    TileEntityReactorFuelRod fuelRod=(TileEntityReactorFuelRod)part;
    attachedFuelRods.add(fuelRod);
    currentFuelRod=attachedFuelRods.iterator();
    if (worldObj.isRemote) {
      worldObj.markBlockForUpdate(fuelRod.xCoord,fuelRod.yCoord,fuelRod.zCoord);
    }
  }
  if (part instanceof TileEntityReactorCoolantPort) {
    attachedCoolantPorts.add((TileEntityReactorCoolantPort)part);
  }
}
Program: 161374
Project: 161374
Buggy source:
@Override protected void decodeDescriptionPacket(NBTTagCompound packet){
  super.decodeDescriptionPacket(packet);
  if (packet.hasKey("String_Node_Str")) {
    NBTTagCompound localData=packet.getCompoundTag("String_Node_Str");
    this.readLocalDataFromNBT(localData);
    if (this.worldObj != null) {
      this.worldObj.markBlockForRenderUpdate(xCoord,yCoord,zCoord);
    }
  }
}

Fixed version (ground truth):
@Override protected void decodeDescriptionPacket(NBTTagCompound packet){
  super.decodeDescriptionPacket(packet);
  if (packet.hasKey("String_Node_Str")) {
    NBTTagCompound localData=packet.getCompoundTag("String_Node_Str");
    this.readLocalDataFromNBT(localData);
    if (worldObj != null && worldObj.isRemote) {
      this.worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
    }
  }
}
Program: 161375
Project: 161375
Buggy source:
@Override public void onNeighborBlockChange(World world,int x,int y,int z,int neighborBlockID){
  if (isConnected()) {
    checkForConnections(world,x,y,z);
  }
}

Fixed version (ground truth):
@Override public void onNeighborBlockChange(World world,int x,int y,int z,int neighborBlockID){
  checkForConnections(world,x,y,z);
}
Program: 161376
Project: 161376
Buggy source:
/** 
 * Check for a world connection, if we're assembled.
 * @param world
 * @param x
 * @param y
 * @param z
 */
protected void checkForConnections(World world,int x,int y,int z){
  boolean wasConnected=(rfNetwork != null);
  ForgeDirection out=getOutwardsDir();
  if (out == ForgeDirection.UNKNOWN) {
    wasConnected=false;
    rfNetwork=null;
  }
 else {
    rfNetwork=null;
    TileEntity te=world.getBlockTileEntity(x + out.offsetX,y + out.offsetY,z + out.offsetZ);
    if (!(te instanceof TileEntityReactorPowerTap)) {
      if (te instanceof IEnergyHandler) {
        rfNetwork=(IEnergyHandler)te;
      }
    }
  }
  boolean isConnected=(rfNetwork != null);
  if (wasConnected != isConnected && worldObj.isRemote) {
    world.markBlockForRenderUpdate(xCoord,yCoord,zCoord);
  }
}

Fixed version (ground truth):
/** 
 * Check for a world connection, if we're assembled.
 * @param world
 * @param x
 * @param y
 * @param z
 */
protected void checkForConnections(World world,int x,int y,int z){
  boolean wasConnected=(rfNetwork != null);
  ForgeDirection out=getOutwardsDir();
  if (out == ForgeDirection.UNKNOWN) {
    wasConnected=false;
    rfNetwork=null;
  }
 else {
    rfNetwork=null;
    TileEntity te=world.getBlockTileEntity(x + out.offsetX,y + out.offsetY,z + out.offsetZ);
    if (!(te instanceof TileEntityReactorPowerTap)) {
      if (te instanceof IEnergyHandler) {
        rfNetwork=(IEnergyHandler)te;
      }
    }
  }
  boolean isConnected=(rfNetwork != null);
  if (wasConnected != isConnected && worldObj.isRemote) {
    world.markBlockForUpdate(xCoord,yCoord,zCoord);
  }
}
Program: 161377
Project: 161377
Buggy source:
/** 
 * Attempt to transfer some heat (in RF) into the coolant system. This method assumes you've already checked the coolant temperature, above, and scaled the energy absorbed into the coolant based on surface area.
 * @param rfAbsorbed RF to transfer into the coolant system.
 * @return RF remaining after absorption.
 */
public float onAbsorbHeat(float rfAbsorbed){
  if (getFluidAmount(COLD) <= 0 || rfAbsorbed <= 0) {
    return rfAbsorbed;
  }
  Fluid coolantType=getCoolantType();
  int coolantAmt=getFluidAmount(COLD);
  int vaporAmt=getFluidAmount(HOT);
  float heatOfVaporization=getHeatOfVaporization(coolantType);
  int mbVaporized=Math.min(coolantAmt,(int)(rfAbsorbed / heatOfVaporization));
  mbVaporized=Math.min(mbVaporized,getRemainingSpaceForFluid(HOT));
  if (mbVaporized < 1) {
    return rfAbsorbed;
  }
  Fluid newVaporType=getVaporizedCoolantFluid(coolantType);
  if (newVaporType == null) {
    BRLog.warning("String_Node_Str",coolantType.getName());
    return rfAbsorbed;
  }
  Fluid existingVaporType=getVaporType();
  if (existingVaporType != null && getVaporType().getID() != existingVaporType.getID()) {
    return rfAbsorbed;
  }
  fluidVaporizedLastTick=mbVaporized;
  this.drainCoolant(mbVaporized);
  if (existingVaporType != null) {
    addFluidToStack(HOT,mbVaporized);
  }
 else {
    fill(HOT,new FluidStack(newVaporType,mbVaporized),true);
  }
  float energyConsumed=(float)mbVaporized * heatOfVaporization;
  return Math.max(0f,rfAbsorbed - energyConsumed);
}

Fixed version (ground truth):
/** 
 * Attempt to transfer some heat (in RF) into the coolant system. This method assumes you've already checked the coolant temperature, above, and scaled the energy absorbed into the coolant based on surface area.
 * @param rfAbsorbed RF to transfer into the coolant system.
 * @return RF remaining after absorption.
 */
public float onAbsorbHeat(float rfAbsorbed){
  if (getFluidAmount(COLD) <= 0 || rfAbsorbed <= 0) {
    return rfAbsorbed;
  }
  Fluid coolantType=getCoolantType();
  int coolantAmt=getFluidAmount(COLD);
  float heatOfVaporization=getHeatOfVaporization(coolantType);
  int mbVaporized=Math.min(coolantAmt,(int)(rfAbsorbed / heatOfVaporization));
  mbVaporized=Math.min(mbVaporized,getRemainingSpaceForFluid(HOT));
  if (mbVaporized < 1) {
    return rfAbsorbed;
  }
  Fluid newVaporType=getVaporizedCoolantFluid(coolantType);
  if (newVaporType == null) {
    BRLog.warning("String_Node_Str",coolantType.getName());
    return rfAbsorbed;
  }
  Fluid existingVaporType=getVaporType();
  if (existingVaporType != null && getVaporType().getID() != existingVaporType.getID()) {
    return rfAbsorbed;
  }
  fluidVaporizedLastTick=mbVaporized;
  this.drainCoolant(mbVaporized);
  if (existingVaporType != null) {
    addFluidToStack(HOT,mbVaporized);
  }
 else {
    fill(HOT,new FluidStack(newVaporType,mbVaporized),true);
  }
  float energyConsumed=(float)mbVaporized * heatOfVaporization;
  return Math.max(0f,rfAbsorbed - energyConsumed);
}
Program: 161378
Project: 161378
Buggy source:
public FluidStack drain(int idx,int maxDrain,boolean doDrain){
  if (maxDrain <= 0 || idx < 0 || idx >= fluids.length) {
    return null;
  }
  if (getFluidType(idx) == null) {
    return null;
  }
  FluidStack drained=new FluidStack(getFluidType(idx),0);
  if (!doDrain) {
    drained.amount=Math.max(getFluidAmount(idx),maxDrain);
  }
 else {
    drained.amount=drainFluidFromStack(idx,maxDrain);
  }
  return drained;
}

Fixed version (ground truth):
public FluidStack drain(int idx,int maxDrain,boolean doDrain){
  if (maxDrain <= 0 || idx < 0 || idx >= fluids.length) {
    return null;
  }
  if (getFluidType(idx) == null) {
    return null;
  }
  FluidStack drained=new FluidStack(getFluidType(idx),0);
  if (!doDrain) {
    drained.amount=Math.min(getFluidAmount(idx),maxDrain);
  }
 else {
    drained.amount=drainFluidFromStack(idx,maxDrain);
  }
  return drained;
}
Program: 161379
Project: 161379
Buggy source:
@Override public int fill(ForgeDirection from,FluidStack resource,boolean doFill){
  if (!isConnected() || from != getOutwardsDir()) {
    return 0;
  }
  if (!inlet) {
    return 0;
  }
  CoolantContainer cc=getReactorController().getCoolantContainer();
  return cc.fill(getConnectedTank(),resource,doFill);
}

Fixed version (ground truth):
@Override public int fill(ForgeDirection from,FluidStack resource,boolean doFill){
  if (!isConnected() || !inlet || from != getOutwardsDir()) {
    return 0;
  }
  CoolantContainer cc=getReactorController().getCoolantContainer();
  return cc.fill(getConnectedTank(),resource,doFill);
}
Program: 161381
Project: 161381
Buggy source:
public void onNetworkPacket(int packetType,DataInputStream data) throws IOException {
  if (packetType == Packets.MultiblockControllerButton) {
    Class decodeAs[]={String.class,Boolean.class};
    Object[] decodedData=PacketWrapper.readPacketData(data,decodeAs);
    String buttonName=(String)decodedData[0];
    boolean newValue=(Boolean)decodedData[1];
    if (buttonName.equals("String_Node_Str")) {
      setActive(newValue);
    }
  }
  if (packetType == Packets.MultiblockTurbineGovernorUpdate) {
    setMaxIntakeRate(data.readInt());
  }
  if (packetType == Packets.MultiblockTurbineVentUpdate) {
    int idx=data.readInt();
    if (idx >= 0 && idx < VentStatus.values().length) {
      ventStatus=VentStatus.values()[idx];
    }
  }
  if (packetType == Packets.MultiblockTurbineFullUpdate) {
    onReceiveUpdatePacket(data);
  }
}

Fixed version (ground truth):
public void onNetworkPacket(int packetType,DataInputStream data) throws IOException {
  if (packetType == Packets.MultiblockControllerButton) {
    Class decodeAs[]={String.class,Boolean.class};
    Object[] decodedData=PacketWrapper.readPacketData(data,decodeAs);
    String buttonName=(String)decodedData[0];
    boolean newValue=(Boolean)decodedData[1];
    if (buttonName.equals("String_Node_Str")) {
      setActive(newValue);
      markReferenceCoordDirty();
    }
  }
  if (packetType == Packets.MultiblockTurbineGovernorUpdate) {
    setMaxIntakeRate(data.readInt());
    markReferenceCoordDirty();
  }
  if (packetType == Packets.MultiblockTurbineVentUpdate) {
    int idx=data.readInt();
    if (idx >= 0 && idx < VentStatus.values().length) {
      ventStatus=VentStatus.values()[idx];
      markReferenceCoordDirty();
    }
  }
  if (packetType == Packets.MultiblockTurbineFullUpdate) {
    onReceiveUpdatePacket(data);
  }
}
Program: 161382
Project: 161382
Buggy source:
@Override public void readFromNBT(NBTTagCompound data){
  if (data.hasKey("String_Node_Str")) {
    setActive(data.getBoolean("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    setHeat(data.getFloat("String_Node_Str"));
  }
 else {
    setHeat(0.0f);
  }
  if (data.hasKey("String_Node_Str")) {
    setStoredEnergy(data.getFloat("String_Node_Str"));
  }
 else {
    setStoredEnergy(0.0f);
  }
  if (data.hasKey("String_Node_Str")) {
    this.wasteEjection=WasteEjectionSetting.values()[data.getInteger("String_Node_Str")];
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound data){
  if (data.hasKey("String_Node_Str")) {
    setActive(data.getBoolean("String_Node_Str"));
  }
  if (data.hasKey("String_Node_Str")) {
    setHeat(Math.max(getHeat(),data.getFloat("String_Node_Str")));
  }
  if (data.hasKey("String_Node_Str")) {
    setStoredEnergy(Math.max(getEnergyStored(),data.getFloat("String_Node_Str")));
  }
  if (data.hasKey("String_Node_Str")) {
    this.wasteEjection=WasteEjectionSetting.values()[data.getInteger("String_Node_Str")];
  }
}
Program: 161383
Project: 161383
Buggy source:
public MultiblockReactor(World world){
  super(world);
  active=false;
  latentHeat=0f;
  energyGeneratedLastTick=0f;
  fuelConsumedLastTick=0;
  wasteEjection=WasteEjectionSetting.kAutomatic;
  attachedPowerTaps=new HashSet<CoordTriplet>();
  attachedTickables=new HashSet<CoordTriplet>();
  attachedControlRods=new LinkedList<CoordTriplet>();
  attachedAccessPorts=new LinkedList<CoordTriplet>();
  attachedControllers=new LinkedList<CoordTriplet>();
  updatePlayers=new HashSet<EntityPlayer>();
  ticksSinceLastUpdate=0;
}

Fixed version (ground truth):
public MultiblockReactor(World world){
  super(world);
  active=false;
  latentHeat=0f;
  energyStored=0f;
  energyGeneratedLastTick=0f;
  fuelConsumedLastTick=0;
  wasteEjection=WasteEjectionSetting.kAutomatic;
  attachedPowerTaps=new HashSet<CoordTriplet>();
  attachedTickables=new HashSet<CoordTriplet>();
  attachedControlRods=new LinkedList<CoordTriplet>();
  attachedAccessPorts=new LinkedList<CoordTriplet>();
  attachedControllers=new LinkedList<CoordTriplet>();
  updatePlayers=new HashSet<EntityPlayer>();
  ticksSinceLastUpdate=0;
}
Program: 161384
Project: 161384
Buggy source:
@Override public void onContainerClosed(EntityPlayer player){
  super.onContainerClosed(player);
  part.getReactorController().stopUpdatingPlayer(player);
}

Fixed version (ground truth):
@Override public void onContainerClosed(EntityPlayer player){
  super.onContainerClosed(player);
  if (part != null && part.getReactorController() != null)   part.getReactorController().stopUpdatingPlayer(player);
}
Program: 161386
Project: 161386
Buggy source:
@Override public boolean isStackValidForSlot(int slot,ItemStack itemstack){
  if (itemstack == null) {
    return true;
  }
  if (itemstack.itemID == BigReactors.ingotGeneric.itemID) {
    if (ItemIngot.isFuel(itemstack.getItemDamage()) && slot == SLOT_OUTLET) {
      return true;
    }
 else     if (ItemIngot.isWaste(itemstack.getItemDamage()) && slot == SLOT_INLET) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isStackValidForSlot(int slot,ItemStack itemstack){
  if (itemstack == null) {
    return true;
  }
  if (slot == SLOT_OUTLET) {
    return BRRegistry.getDataForFuel(itemstack) != null;
  }
 else   if (slot == SLOT_INLET) {
    return BRRegistry.getDataForWaste(itemstack) != null;
  }
  return false;
}
Program: 161387
Project: 161387
Buggy source:
@Override public boolean isStackValidForSlot(int slot,ItemStack itemstack){
  if (itemstack == null) {
    return true;
  }
  if (itemstack.itemID == BigReactors.ingotGeneric.itemID) {
    if (ItemIngot.isFuel(itemstack.getItemDamage()) && slot == SLOT_INLET) {
      return true;
    }
 else     if (ItemIngot.isWaste(itemstack.getItemDamage()) && slot == SLOT_OUTLET) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isStackValidForSlot(int slot,ItemStack itemstack){
  if (itemstack == null) {
    return true;
  }
  if (slot == SLOT_INLET) {
    return BRRegistry.getDataForFuel(itemstack) != null;
  }
 else   if (slot == SLOT_OUTLET) {
    return BRRegistry.getDataForWaste(itemstack) != null;
  }
  return false;
}
Program: 161389
Project: 161389
Buggy source:
@Override protected void onMachineMerge(MultiblockControllerBase otherMachine){
  this.activePowerTaps.clear();
  this.attachedAccessPorts.clear();
  this.attachedControllers.clear();
  this.attachedControlRods.clear();
}

Fixed version (ground truth):
@Override protected void onMachineMerge(MultiblockControllerBase otherMachine){
  this.attachedPowerTaps.clear();
  this.attachedAccessPorts.clear();
  this.attachedControllers.clear();
  this.attachedControlRods.clear();
}