nus-yam/ex-repair huggingface dataset:
Program: 30465
Project: 30465
Buggy source:
private TickRateModulation breakBlock(final boolean modulate){
  if (this.isAccepting && this.getProxy().isActive()) {
    try {
      final TileEntity te=this.getTile();
      final WorldServer w=(WorldServer)te.getWorld();
      final BlockPos pos=te.getPos().offset(this.getSide().getFacing());
      final IEnergyGrid energy=this.getProxy().getEnergy();
      if (this.canHandleBlock(w,pos)) {
        final List<ItemStack> items=this.obtainBlockDrops(w,pos);
        final float requiredPower=this.calculateEnergyUsage(w,pos,items);
        final boolean hasPower=energy.extractAEPower(requiredPower,Actionable.SIMULATE,PowerMultiplier.CONFIG) > requiredPower - 0.1;
        final boolean canStore=this.canStoreItemStacks(items);
        if (hasPower && canStore) {
          if (modulate) {
            energy.extractAEPower(requiredPower,Actionable.MODULATE,PowerMultiplier.CONFIG);
            this.breakBlockAndStoreItems(w,pos,items);
            AppEng.proxy.sendToAllNearExcept(null,pos.getX(),pos.getY(),pos.getZ(),64,w,new PacketTransitionEffect(pos.getX(),pos.getY(),pos.getZ(),this.getSide(),true));
          }
 else {
            this.breaking=true;
            TickHandler.INSTANCE.addCallable(this.getTile().getWorld(),this);
          }
          return TickRateModulation.URGENT;
        }
      }
    }
 catch (    final GridAccessException e1) {
    }
  }
  return TickRateModulation.IDLE;
}

Fixed version (ground truth):
private TickRateModulation breakBlock(final boolean modulate){
  if (this.isAccepting && this.getProxy().isActive()) {
    try {
      final TileEntity te=this.getTile();
      final WorldServer w=(WorldServer)te.getWorld();
      final BlockPos pos=te.getPos().offset(this.getSide().getFacing());
      final IEnergyGrid energy=this.getProxy().getEnergy();
      if (this.canHandleBlock(w,pos)) {
        final List<ItemStack> items=this.obtainBlockDrops(w,pos);
        final float requiredPower=this.calculateEnergyUsage(w,pos,items);
        final boolean hasPower=energy.extractAEPower(requiredPower,Actionable.SIMULATE,PowerMultiplier.CONFIG) > requiredPower - 0.1;
        final boolean canStore=this.canStoreItemStacks(items);
        if (hasPower && canStore) {
          if (modulate) {
            energy.extractAEPower(requiredPower,Actionable.MODULATE,PowerMultiplier.CONFIG);
            this.breakBlockAndStoreItems(w,pos);
            AppEng.proxy.sendToAllNearExcept(null,pos.getX(),pos.getY(),pos.getZ(),64,w,new PacketTransitionEffect(pos.getX(),pos.getY(),pos.getZ(),this.getSide(),true));
          }
 else {
            this.breaking=true;
            TickHandler.INSTANCE.addCallable(this.getTile().getWorld(),this);
          }
          return TickRateModulation.URGENT;
        }
      }
    }
 catch (    final GridAccessException e1) {
    }
  }
  return TickRateModulation.IDLE;
}
Program: 30467
Project: 30467
Buggy source:
@Override public boolean canTurn(){
  if (Platform.isClient()) {
    return false;
  }
  if (this.getStackInSlot(6).isEmpty()) {
    final IInventory src=new WrapperInventoryRange(this,this.inputs,true);
    for (int x=0; x < src.getSizeInventory(); x++) {
      ItemStack item=src.getStackInSlot(x);
      if (item.isEmpty()) {
        continue;
      }
      final IGrinderRecipe r=AEApi.instance().registries().grinder().getRecipeForInput(item);
      if (r != null) {
        if (item.getCount() >= r.getInput().getCount()) {
          item.grow(-r.getInput().getCount());
          final ItemStack ais=item.copy();
          ais.setCount(r.getInput().getCount());
          if (item.getCount() <= 0) {
            item=ItemStack.EMPTY;
          }
          src.setInventorySlotContents(x,item);
          this.setInventorySlotContents(6,ais);
          return true;
        }
      }
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean canTurn(){
  if (Platform.isClient()) {
    return false;
  }
  if (this.getStackInSlot(6).isEmpty()) {
    final IInventory src=new WrapperInventoryRange(this,this.inputs,true);
    for (int x=0; x < src.getSizeInventory(); x++) {
      ItemStack item=src.getStackInSlot(x);
      if (item.isEmpty()) {
        continue;
      }
      final IGrinderRecipe r=AEApi.instance().registries().grinder().getRecipeForInput(item);
      if (r != null) {
        if (item.getCount() >= r.getInput().getCount()) {
          final ItemStack ais=item.copy();
          ais.setCount(r.getInput().getCount());
          item.shrink(r.getInput().getCount());
          if (item.getCount() <= 0) {
            item=ItemStack.EMPTY;
          }
          src.setInventorySlotContents(x,item);
          this.setInventorySlotContents(6,ais);
          return true;
        }
      }
    }
    return false;
  }
  return true;
}
Program: 30469
Project: 30469
Buggy source:
@Override protected final void drawGuiContainerBackgroundLayer(final float f,final int x,final int y){
  final int ox=this.guiLeft;
  final int oy=this.guiTop;
  GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
  this.drawBG(ox,oy,x,y);
  final List<Slot> slots=this.getInventorySlots();
  for (  final Slot slot : slots) {
    if (slot instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)slot;
      if (fs.renderDisabled()) {
        if (fs.isEnabled()) {
          this.drawTexturedModalRect(ox + fs.xPos - 1,oy + fs.yPos - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
        }
 else {
          GlStateManager.color(1.0F,1.0F,1.0F,0.4F);
          GlStateManager.enableBlend();
          this.drawTexturedModalRect(ox + fs.xPos - 1,oy + fs.yPos - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
          GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected final void drawGuiContainerBackgroundLayer(final float f,final int x,final int y){
  final int ox=this.guiLeft;
  final int oy=this.guiTop;
  GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
  this.drawBG(ox,oy,x,y);
  final List<Slot> slots=this.getInventorySlots();
  for (  final Slot slot : slots) {
    if (slot instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)slot;
      if (fs.renderDisabled()) {
        if (fs.isSlotEnabled()) {
          this.drawTexturedModalRect(ox + fs.xPos - 1,oy + fs.yPos - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
        }
 else {
          GlStateManager.color(1.0F,1.0F,1.0F,0.4F);
          GlStateManager.enableBlend();
          this.drawTexturedModalRect(ox + fs.xPos - 1,oy + fs.yPos - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
          GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
        }
      }
    }
  }
}
Program: 30470
Project: 30470
Buggy source:
@Override public void detectAndSendChanges(){
  this.verifyPermissions(SecurityPermissions.BUILD,false);
  if (Platform.isServer()) {
    final IConfigManager cm=this.getUpgradeable().getConfigManager();
    this.loadSettingsFromHost(cm);
  }
  this.checkToolbox();
  for (  final Object o : this.inventorySlots) {
    if (o instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)o;
      if (!fs.isEnabled() && !fs.getDisplayStack().isEmpty()) {
        fs.clearStack();
      }
    }
  }
  this.standardDetectAndSendChanges();
}

Fixed version (ground truth):
@Override public void detectAndSendChanges(){
  this.verifyPermissions(SecurityPermissions.BUILD,false);
  if (Platform.isServer()) {
    final IConfigManager cm=this.getUpgradeable().getConfigManager();
    this.loadSettingsFromHost(cm);
  }
  this.checkToolbox();
  for (  final Object o : this.inventorySlots) {
    if (o instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)o;
      if (!fs.isSlotEnabled() && !fs.getDisplayStack().isEmpty()) {
        fs.clearStack();
      }
    }
  }
  this.standardDetectAndSendChanges();
}
Program: 30471
Project: 30471
Buggy source:
@Override public boolean isItemValid(final ItemStack par1ItemStack){
  if (this.isEnabled()) {
    return super.isItemValid(par1ItemStack);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isItemValid(final ItemStack par1ItemStack){
  if (this.isSlotEnabled()) {
    return super.isItemValid(par1ItemStack);
  }
  return false;
}
Program: 30472
Project: 30472
Buggy source:
@Override public void putStack(final ItemStack par1ItemStack){
  if (this.isEnabled()) {
    super.putStack(par1ItemStack);
    if (this.getContainer() != null) {
      this.getContainer().onSlotChange(this);
    }
  }
}

Fixed version (ground truth):
@Override public void putStack(final ItemStack par1ItemStack){
  if (this.isSlotEnabled()) {
    super.putStack(par1ItemStack);
    if (this.getContainer() != null) {
      this.getContainer().onSlotChange(this);
    }
  }
}
Program: 30473
Project: 30473
Buggy source:
@Override public boolean canTakeStack(final EntityPlayer par1EntityPlayer){
  if (this.isEnabled()) {
    return super.canTakeStack(par1EntityPlayer);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canTakeStack(final EntityPlayer par1EntityPlayer){
  if (this.isSlotEnabled()) {
    return super.canTakeStack(par1EntityPlayer);
  }
  return false;
}
Program: 30474
Project: 30474
Buggy source:
@Override public boolean isEnabled(){
  return super.isEnabled();
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public boolean isEnabled(){
  return super.isEnabled();
}
Program: 30475
Project: 30475
Buggy source:
@Override @Nonnull public ItemStack getStack(){
  if (!this.isEnabled()) {
    return ItemStack.EMPTY;
  }
  if (this.inventory.getSizeInventory() <= this.getSlotIndex()) {
    return ItemStack.EMPTY;
  }
  if (this.isDisplay()) {
    this.setDisplay(false);
    return this.getDisplayStack();
  }
  return super.getStack();
}

Fixed version (ground truth):
@Override @Nonnull public ItemStack getStack(){
  if (!this.isSlotEnabled()) {
    return ItemStack.EMPTY;
  }
  if (this.inventory.getSizeInventory() <= this.getSlotIndex()) {
    return ItemStack.EMPTY;
  }
  if (this.isDisplay()) {
    this.setDisplay(false);
    return this.getDisplayStack();
  }
  return super.getStack();
}
Program: 30476
Project: 30476
Buggy source:
public boolean shouldDisplay(){
  return this.isEnabled();
}

Fixed version (ground truth):
public boolean shouldDisplay(){
  return this.isSlotEnabled();
}
Program: 30477
Project: 30477
Buggy source:
@Override @Nonnull public ItemStack getStack(){
  if (!this.isEnabled()) {
    if (!this.getDisplayStack().isEmpty()) {
      this.clearStack();
    }
  }
  return super.getStack();
}

Fixed version (ground truth):
@Override @Nonnull public ItemStack getStack(){
  if (!this.isSlotEnabled()) {
    if (!this.getDisplayStack().isEmpty()) {
      this.clearStack();
    }
  }
  return super.getStack();
}
Program: 30478
Project: 30478
Buggy source:
@Override public boolean shouldDisplay(){
  return super.isEnabled();
}

Fixed version (ground truth):
@Override public boolean shouldDisplay(){
  return super.isSlotEnabled();
}
Program: 30479
Project: 30479
Buggy source:
@Override public ItemStack getStack(){
  if (!this.isEnabled()) {
    if (!this.getDisplayStack().isEmpty()) {
      this.clearStack();
    }
  }
  return super.getStack();
}

Fixed version (ground truth):
@Override public ItemStack getStack(){
  if (!this.isSlotEnabled()) {
    if (!this.getDisplayStack().isEmpty()) {
      this.clearStack();
    }
  }
  return super.getStack();
}
Program: 30481
Project: 30481
Buggy source:
@Override public SelectedPart selectPart(final Vec3d pos){
  for (  final AEPartLocation side : AEPartLocation.values()) {
    final IPart p=this.getPart(side);
    if (p != null) {
      final List<AxisAlignedBB> boxes=new LinkedList<AxisAlignedBB>();
      final IPartCollisionHelper bch=new BusCollisionHelper(boxes,side,null,true);
      p.getBoxes(bch);
      for (      AxisAlignedBB bb : boxes) {
        bb=bb.expand(0.002,0.002,0.002);
        if (bb.contains(pos)) {
          return new SelectedPart(p,side);
        }
      }
    }
  }
  if (AEApi.instance().partHelper().getCableRenderMode().opaqueFacades) {
    final IFacadeContainer fc=this.getFacadeContainer();
    for (    final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS) {
      final IFacadePart p=fc.getFacade(side);
      if (p != null) {
        final List<AxisAlignedBB> boxes=new LinkedList<AxisAlignedBB>();
        final IPartCollisionHelper bch=new BusCollisionHelper(boxes,side,null,true);
        p.getBoxes(bch,null);
        for (        AxisAlignedBB bb : boxes) {
          bb=bb.expand(0.01,0.01,0.01);
          if (bb.contains(pos)) {
            return new SelectedPart(p,side);
          }
        }
      }
    }
  }
  return new SelectedPart();
}

Fixed version (ground truth):
@Override public SelectedPart selectPart(final Vec3d pos){
  for (  final AEPartLocation side : AEPartLocation.values()) {
    final IPart p=this.getPart(side);
    if (p != null) {
      final List<AxisAlignedBB> boxes=new LinkedList<AxisAlignedBB>();
      final IPartCollisionHelper bch=new BusCollisionHelper(boxes,side,null,true);
      p.getBoxes(bch);
      for (      AxisAlignedBB bb : boxes) {
        bb=bb.grow(0.002,0.002,0.002);
        if (bb.contains(pos)) {
          return new SelectedPart(p,side);
        }
      }
    }
  }
  if (AEApi.instance().partHelper().getCableRenderMode().opaqueFacades) {
    final IFacadeContainer fc=this.getFacadeContainer();
    for (    final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS) {
      final IFacadePart p=fc.getFacade(side);
      if (p != null) {
        final List<AxisAlignedBB> boxes=new LinkedList<AxisAlignedBB>();
        final IPartCollisionHelper bch=new BusCollisionHelper(boxes,side,null,true);
        p.getBoxes(bch,null);
        for (        AxisAlignedBB bb : boxes) {
          bb=bb.grow(0.01,0.01,0.01);
          if (bb.contains(pos)) {
            return new SelectedPart(p,side);
          }
        }
      }
    }
  }
  return new SelectedPart();
}
Program: 30482
Project: 30482
Buggy source:
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer p,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileCraftingTile tg=this.getTileEntity(w,pos);
  if (tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive()) {
    if (Platform.isClient()) {
      return true;
    }
    Platform.openGUI(p,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_CRAFTING_CPU);
    return true;
  }
  return super.onBlockActivated(w,pos,state,p,hand,heldItem,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer p,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileCraftingTile tg=this.getTileEntity(w,pos);
  if (tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive()) {
    if (Platform.isClient()) {
      return true;
    }
    Platform.openGUI(p,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_CRAFTING_CPU);
    return true;
  }
  return super.onBlockActivated(w,pos,state,p,hand,side,hitX,hitY,hitZ);
}
Program: 30483
Project: 30483
Buggy source:
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer p,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileMolecularAssembler tg=this.getTileEntity(w,pos);
  if (tg != null && !p.isSneaking()) {
    Platform.openGUI(p,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_MAC);
    return true;
  }
  return super.onBlockActivated(w,pos,state,p,hand,heldItem,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer p,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileMolecularAssembler tg=this.getTileEntity(w,pos);
  if (tg != null && !p.isSneaking()) {
    Platform.openGUI(p,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_MAC);
    return true;
  }
  return super.onBlockActivated(w,pos,state,p,hand,side,hitX,hitY,hitZ);
}
Program: 30484
Project: 30484
Buggy source:
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer player,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileWireless tg=this.getTileEntity(w,pos);
  if (tg != null && !player.isSneaking()) {
    if (Platform.isServer()) {
      Platform.openGUI(player,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_WIRELESS);
    }
    return true;
  }
  return super.onBlockActivated(w,pos,state,player,hand,heldItem,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(final World w,final BlockPos pos,final IBlockState state,final EntityPlayer player,final EnumHand hand,final EnumFacing side,final float hitX,final float hitY,final float hitZ){
  final TileWireless tg=this.getTileEntity(w,pos);
  if (tg != null && !player.isSneaking()) {
    if (Platform.isServer()) {
      Platform.openGUI(player,tg,AEPartLocation.fromFacing(side),GuiBridge.GUI_WIRELESS);
    }
    return true;
  }
  return super.onBlockActivated(w,pos,state,player,hand,side,hitX,hitY,hitZ);
}
Program: 30485
Project: 30485
Buggy source:
private void putVertexTR(UnpackedBakedQuad.Builder builder,EnumFacing face,float x,float y,float z,UvVector uv){
  float u;
  float v;
switch (uvRotations[face.ordinal()]) {
default :
case 0:
    u=uv.u2;
  v=uv.v1;
break;
case 1:
u=uv.u1;
v=uv.v1;
break;
case 2:
u=uv.u1;
v=uv.v2;
break;
case 3:
u=uv.u2;
v=uv.v2;
break;
}
putVertex(builder,face,x,y,z,u,v);
}

Fixed version (ground truth):
private void putVertexTR(UnpackedBakedQuad.Builder builder,EnumFacing face,float x,float y,float z,UvVector uv){
  float u, v;
switch (uvRotations[face.ordinal()]) {
default :
case 0:
    u=uv.u2;
  v=uv.v1;
break;
case 1:
u=uv.u1;
v=uv.v1;
break;
case 2:
u=uv.u1;
v=uv.v2;
break;
case 3:
u=uv.u2;
v=uv.v2;
break;
}
putVertex(builder,face,x,y,z,u,v);
}
Program: 30487
Project: 30487
Buggy source:
/** 
 * Create an IC2 power sink for the given external sink.
 */
public static IC2PowerSink createPowerSink(TileEntity tileEntity,IExternalPowerSink externalSink){
  return instance.powerSinkFactory.apply(tileEntity,externalSink);
}

Fixed version (ground truth):
/** 
 * Create an IC2 power sink for the given external sink.
 */
public static IC2PowerSink createPowerSink(TileEntity tileEntity,IExternalPowerSink externalSink){
  return powerSinkFactory.apply(tileEntity,externalSink);
}
Program: 30488
Project: 30488
Buggy source:
public PacketClick(final BlockPos pos,final EnumFacing side,final float hitX,final float hitY,final float hitZ,final EnumHand hand){
  final ByteBuf data=Unpooled.buffer();
  data.writeInt(this.getPacketID());
  data.writeInt(this.x=pos.getX());
  data.writeInt(this.y=pos.getY());
  data.writeInt(this.z=pos.getZ());
  data.writeByte(side.ordinal());
  data.writeFloat(this.hitX=hitX);
  data.writeFloat(this.hitY=hitY);
  data.writeFloat(this.hitZ=hitZ);
  data.writeByte(hand.ordinal());
  this.configureWrite(data);
}

Fixed version (ground truth):
public PacketClick(final BlockPos pos,final EnumFacing side,final float hitX,final float hitY,final float hitZ,final EnumHand hand){
  final ByteBuf data=Unpooled.buffer();
  data.writeInt(this.getPacketID());
  data.writeInt(this.x=pos.getX());
  data.writeInt(this.y=pos.getY());
  data.writeInt(this.z=pos.getZ());
  if (side == null) {
    data.writeByte(-1);
  }
 else {
    data.writeByte(side.ordinal());
  }
  data.writeFloat(this.hitX=hitX);
  data.writeFloat(this.hitY=hitY);
  data.writeFloat(this.hitZ=hitZ);
  data.writeByte(hand.ordinal());
  this.configureWrite(data);
}
Program: 30490
Project: 30490
Buggy source:
@Override protected final void drawGuiContainerBackgroundLayer(final float f,final int x,final int y){
  final int ox=this.guiLeft;
  final int oy=this.guiTop;
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  this.drawBG(ox,oy,x,y);
  final List<Slot> slots=this.getInventorySlots();
  for (  final Slot slot : slots) {
    if (slot instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)slot;
      if (fs.renderDisabled()) {
        if (fs.isEnabled()) {
          this.drawTexturedModalRect(ox + fs.xDisplayPosition - 1,oy + fs.yDisplayPosition - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
        }
 else {
          GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
          GL11.glColor4f(1.0F,1.0F,1.0F,0.4F);
          GL11.glEnable(GL11.GL_BLEND);
          this.drawTexturedModalRect(ox + fs.xDisplayPosition - 1,oy + fs.yDisplayPosition - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
          GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
          GL11.glPopAttrib();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected final void drawGuiContainerBackgroundLayer(final float f,final int x,final int y){
  final int ox=this.guiLeft;
  final int oy=this.guiTop;
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  this.drawBG(ox,oy,x,y);
  final List<Slot> slots=this.getInventorySlots();
  for (  final Slot slot : slots) {
    if (slot instanceof OptionalSlotFake) {
      final OptionalSlotFake fs=(OptionalSlotFake)slot;
      if (fs.renderDisabled()) {
        if (fs.isEnabled()) {
          this.drawTexturedModalRect(ox + fs.xDisplayPosition - 1,oy + fs.yDisplayPosition - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
        }
 else {
          GL11.glColor4f(1.0F,1.0F,1.0F,0.4F);
          GlStateManager.enableBlend();
          this.drawTexturedModalRect(ox + fs.xDisplayPosition - 1,oy + fs.yDisplayPosition - 1,fs.getSourceX() - 1,fs.getSourceY() - 1,18,18);
          GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
        }
      }
    }
  }
}
Program: 30491
Project: 30491
Buggy source:
@Override public void drawButton(final Minecraft minecraft,final int x,final int y){
  if (this.visible) {
    GL11.glColor4f(1.0f,1.0f,1.0f,1.0f);
    minecraft.renderEngine.bindTexture(new ResourceLocation("String_Node_Str","String_Node_Str"));
    this.hovered=x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
    int uv_x=(this.hideEdge > 0 ? 11 : 13);
    final int offsetX=this.hideEdge > 0 ? 1 : 0;
    this.drawTexturedModalRect(this.xPosition,this.yPosition,uv_x * 16,0,25,22);
    if (this.myIcon >= 0) {
      final int uv_y=(int)Math.floor(this.myIcon / 16);
      uv_x=this.myIcon - uv_y * 16;
      this.drawTexturedModalRect(offsetX + this.xPosition + 3,this.yPosition + 3,uv_x * 16,uv_y * 16,16,16);
    }
    this.mouseDragged(minecraft,x,y);
    if (this.myItem != null) {
      this.zLevel=100.0F;
      this.itemRenderer.zLevel=100.0F;
      RenderHelper.enableGUIStandardItemLighting();
      this.itemRenderer.renderItemAndEffectIntoGUI(this.myItem,offsetX + this.xPosition + 3,this.yPosition + 3);
      this.itemRenderer.zLevel=0.0F;
      this.zLevel=0.0F;
    }
  }
}

Fixed version (ground truth):
@Override public void drawButton(final Minecraft minecraft,final int x,final int y){
  if (this.visible) {
    GL11.glColor4f(1.0f,1.0f,1.0f,1.0f);
    minecraft.renderEngine.bindTexture(new ResourceLocation("String_Node_Str","String_Node_Str"));
    this.hovered=x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
    int uv_x=(this.hideEdge > 0 ? 11 : 13);
    final int offsetX=this.hideEdge > 0 ? 1 : 0;
    this.drawTexturedModalRect(this.xPosition,this.yPosition,uv_x * 16,0,25,22);
    if (this.myIcon >= 0) {
      final int uv_y=(int)Math.floor(this.myIcon / 16);
      uv_x=this.myIcon - uv_y * 16;
      this.drawTexturedModalRect(offsetX + this.xPosition + 3,this.yPosition + 3,uv_x * 16,uv_y * 16,16,16);
    }
    this.mouseDragged(minecraft,x,y);
    if (this.myItem != null) {
      this.zLevel=100.0F;
      this.itemRenderer.zLevel=100.0F;
      GlStateManager.enableDepth();
      RenderHelper.enableGUIStandardItemLighting();
      this.itemRenderer.renderItemAndEffectIntoGUI(this.myItem,offsetX + this.xPosition + 3,this.yPosition + 3);
      GlStateManager.disableDepth();
      this.itemRenderer.zLevel=0.0F;
      this.zLevel=0.0F;
    }
  }
}
Program: 30492
Project: 30492
Buggy source:
CableBuilder(VertexFormat format,Function<ResourceLocation,TextureAtlasSprite> bakedTextureGetter){
  this.format=format;
  this.coreTextures=new EnumMap<>(CableCoreType.class);
  for (  CableCoreType type : CableCoreType.values()) {
    EnumMap<AEColor,TextureAtlasSprite> colorTextures=new EnumMap<>(AEColor.class);
    for (    AEColor color : AEColor.values()) {
      colorTextures.put(color,bakedTextureGetter.apply(type.getTexture(color)));
    }
    coreTextures.put(type,colorTextures);
  }
  this.connectionTextures=new EnumMap<>(AECableType.class);
  for (  AECableType type : AECableType.VALIDCABLES) {
    EnumMap<AEColor,TextureAtlasSprite> colorTextures=new EnumMap<>(AEColor.class);
    for (    AEColor color : AEColor.values()) {
      colorTextures.put(color,bakedTextureGetter.apply(type.getConnectionTexture(color)));
    }
    connectionTextures.put(type,colorTextures);
  }
  smartCableTextures=new SmartCableTextures(bakedTextureGetter);
}

Fixed version (ground truth):
CableBuilder(VertexFormat format,Function<ResourceLocation,TextureAtlasSprite> bakedTextureGetter){
  this.format=format;
  this.coreTextures=new EnumMap<>(CableCoreType.class);
  for (  CableCoreType type : CableCoreType.values()) {
    EnumMap<AEColor,TextureAtlasSprite> colorTextures=new EnumMap<>(AEColor.class);
    for (    AEColor color : AEColor.values()) {
      colorTextures.put(color,bakedTextureGetter.apply(type.getTexture(color)));
    }
    coreTextures.put(type,colorTextures);
  }
  this.connectionTextures=new EnumMap<>(AECableType.class);
  for (  AECableType type : AECableType.VALIDCABLES) {
    EnumMap<AEColor,TextureAtlasSprite> colorTextures=new EnumMap<>(AEColor.class);
    for (    AEColor color : AEColor.values()) {
      colorTextures.put(color,bakedTextureGetter.apply(getConnectionTexture(type,color)));
    }
    connectionTextures.put(type,colorTextures);
  }
  smartCableTextures=new SmartCableTextures(bakedTextureGetter);
}
Program: 30493
Project: 30493
Buggy source:
public static List<ResourceLocation> getTextures(){
  List<ResourceLocation> locations=new ArrayList<>();
  for (  CableCoreType coreType : CableCoreType.values()) {
    for (    AEColor color : AEColor.values()) {
      locations.add(coreType.getTexture(color));
    }
  }
  for (  AECableType cableType : AECableType.VALIDCABLES) {
    for (    AEColor color : AEColor.values()) {
      locations.add(cableType.getConnectionTexture(color));
    }
  }
  Collections.addAll(locations,SmartCableTextures.SMART_CHANNELS_TEXTURES);
  return locations;
}

Fixed version (ground truth):
public static List<ResourceLocation> getTextures(){
  List<ResourceLocation> locations=new ArrayList<>();
  for (  CableCoreType coreType : CableCoreType.values()) {
    for (    AEColor color : AEColor.values()) {
      locations.add(coreType.getTexture(color));
    }
  }
  for (  AECableType cableType : AECableType.VALIDCABLES) {
    for (    AEColor color : AEColor.values()) {
      locations.add(getConnectionTexture(cableType,color));
    }
  }
  Collections.addAll(locations,SmartCableTextures.SMART_CHANNELS_TEXTURES);
  return locations;
}
Program: 30494
Project: 30494
Buggy source:
/** 
 * Gets a list of texture sprites appropriate for particles (digging, etc.) given the render state for a cable bus.
 */
public List<TextureAtlasSprite> getParticleTextures(CableBusRenderState renderState){
  CableCoreType coreType=renderState.getCableType().getCoreType();
  AEColor cableColor=renderState.getCableColor();
  if (coreType != null) {
    return Collections.singletonList(cableBuilder.getCoreTexture(coreType,cableColor));
  }
 else {
    return Collections.emptyList();
  }
}

Fixed version (ground truth):
/** 
 * Gets a list of texture sprites appropriate for particles (digging, etc.) given the render state for a cable bus.
 */
public List<TextureAtlasSprite> getParticleTextures(CableBusRenderState renderState){
  CableCoreType coreType=CableCoreType.fromCableType(renderState.getCableType());
  AEColor cableColor=renderState.getCableColor();
  if (coreType != null) {
    return Collections.singletonList(cableBuilder.getCoreTexture(coreType,cableColor));
  }
 else {
    return Collections.emptyList();
  }
}
Program: 30497
Project: 30497
Buggy source:
@Override public void customize(IBlockRendering rendering,IItemRendering itemRendering){
  rendering.tesr(new SkyCompassTESR());
  rendering.modelCustomizer((loc,model) -> model);
  itemRendering.model(ITEM_MODEL);
  itemRendering.builtInModel("String_Node_Str",new SkyCompassModel());
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public void customize(IBlockRendering rendering,IItemRendering itemRendering){
  rendering.tesr(new SkyCompassTESR());
  rendering.modelCustomizer((loc,model) -> model);
  itemRendering.model(ITEM_MODEL);
  itemRendering.builtInModel("String_Node_Str",new SkyCompassModel());
}
Program: 30498
Project: 30498
Buggy source:
protected boolean isStraight(IPartHost host,final EnumSet<AEPartLocation> sides){
  boolean b=false;
  for (  EnumFacing facing : EnumFacing.values()) {
    b|=host.getPart(facing) != null;
  }
  if (!b && sides.size() == 2) {
    AEPartLocation[] sa=sides.toArray(new AEPartLocation[0]);
    if (sa[0] == sa[1].getOpposite()) {
      for (      AEPartLocation side : sides) {
        TileEntity to=host.getTile().getWorld().getTileEntity(host.getTile().getPos().offset(side.getFacing()));
        b|=to instanceof IPartHost && ((IPartHost)to).getPart(AEPartLocation.INTERNAL) instanceof IPartCable && ((IPartCable)((IPartHost)to).getPart(AEPartLocation.INTERNAL)).getCableConnectionType() == getCableConnectionType();
      }
      return !b;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * A cable connection is considered straight, if there are exactly two connection points on opposite sides, and the cable has no attached busses.
 */
protected boolean isStraight(IPartHost host,final EnumSet<AEPartLocation> sides){
  if (sides.size() != 2) {
    return false;
  }
  Iterator<AEPartLocation> it=sides.iterator();
  EnumFacing firstSide=it.next().getFacing();
  EnumFacing secondSide=it.next().getFacing();
  if (firstSide.getOpposite() != secondSide) {
    return false;
  }
  for (  EnumFacing facing : EnumFacing.values()) {
    if (facing != firstSide && facing != secondSide) {
      if (host.getPart(facing) != null) {
        return false;
      }
    }
  }
  return true;
}
Program: 30499
Project: 30499
Buggy source:
public BlockCableBus(){
  super(AEGlassMaterial.INSTANCE);
  this.setLightOpacity(0);
  this.setFullSize(this.setOpaque(false));
  this.setTileEntity(TileCableBus.class);
}

Fixed version (ground truth):
public BlockCableBus(){
  super(AEGlassMaterial.INSTANCE);
  this.setLightOpacity(0);
  this.setFullSize(false);
  this.setOpaque(false);
  this.setTileEntity(TileCableBus.class);
}
Program: 30500
Project: 30500
Buggy source:
@Override public int colorMultiplier(IBlockState state,IBlockAccess worldIn,BlockPos pos,int color){
  AEPartLocation side=AEPartLocation.fromOrdinal((color >> 2) & 7);
  CableBusContainer bus=((IExtendedBlockState)state).getValue(BlockCableBus.cableBus);
switch (color & 3) {
case 0:
    return bus.getGridNode(side) != null && bus.getGridNode(side).isActive() ? 0xffffff : 0;
case 1:
  return bus.getColor().blackVariant;
case 2:
return bus.getColor().mediumVariant;
case 3:
return bus.getColor().whiteVariant;
default :
return color;
}
}

Fixed version (ground truth):
@Override public int colorMultiplier(IBlockState state,IBlockAccess worldIn,BlockPos pos,int color){
  boolean active=true;
  AEColor busColor=AEColor.Transparent;
  if (state instanceof IExtendedBlockState) {
    AEPartLocation side=AEPartLocation.fromOrdinal((color >> 2) & 7);
    CableBusContainer bus=((IExtendedBlockState)state).getValue(BlockCableBus.cableBus);
    if (bus != null) {
      active=bus.getGridNode(side) != null && bus.getGridNode(side).isActive();
      busColor=bus.getColor();
    }
  }
switch (color & 3) {
case 0:
    return active ? 0xffffff : 0;
case 1:
  return busColor.blackVariant;
case 2:
return busColor.mediumVariant;
case 3:
return busColor.whiteVariant;
default :
return color;
}
}
Program: 30501
Project: 30501
Buggy source:
@Override public void setTexture(TextureAtlasSprite texture){
}

Fixed version (ground truth):
@Override public void setTexture(TextureAtlasSprite texture){
  parent.setTexture(texture);
}
Program: 30502
Project: 30502
Buggy source:
@Override public void setApplyDiffuseLighting(boolean diffuse){
}

Fixed version (ground truth):
@Override public void setApplyDiffuseLighting(boolean diffuse){
  parent.setApplyDiffuseLighting(diffuse);
}
Program: 30503
Project: 30503
Buggy source:
public void setQuadTint(int tint){
}

Fixed version (ground truth):
public void setQuadTint(int tint){
  parent.setQuadTint(tint);
}
Program: 30504
Project: 30504
Buggy source:
@Override public BakedQuad makeBakedQuad(Vector3f posFrom,Vector3f posTo,BlockPartFace face,TextureAtlasSprite sprite,EnumFacing facing,ITransformation modelRotationIn,BlockPartRotation partRotation,boolean uvLocked,boolean shade){
  BakedQuad quad=super.makeBakedQuad(posFrom,posTo,face,sprite,facing,modelRotationIn,partRotation,uvLocked,shade);
  Pair<Float,Float> brightness=uvlightmap.get(face);
  if (brightness != null) {
    VertexFormat format=new VertexFormat(quad.getFormat());
    if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) {
      format.addElement(DefaultVertexFormats.TEX_2S);
    }
    UnpackedBakedQuad.Builder builder=new UnpackedBakedQuad.Builder(format);
    VertexLighterFlat trans=new VertexLighterFlat(Minecraft.getMinecraft().getBlockColors()){
      @Override protected void updateLightmap(      float[] normal,      float[] lightmap,      float x,      float y,      float z){
        lightmap[0]=brightness.getRight();
        lightmap[1]=brightness.getLeft();
      }
    }
;
    trans.setParent(builder);
    quad.pipe(trans);
    builder.setQuadOrientation(quad.getFace());
    return builder.build();
  }
 else {
    return quad;
  }
}

Fixed version (ground truth):
@Override public BakedQuad makeBakedQuad(Vector3f posFrom,Vector3f posTo,BlockPartFace face,TextureAtlasSprite sprite,EnumFacing facing,ITransformation modelRotationIn,BlockPartRotation partRotation,boolean uvLocked,boolean shade){
  BakedQuad quad=super.makeBakedQuad(posFrom,posTo,face,sprite,facing,modelRotationIn,partRotation,uvLocked,shade);
  Pair<Float,Float> brightness=uvlightmap.get(face);
  if (brightness != null) {
    VertexFormat format=new VertexFormat(quad.getFormat());
    if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) {
      format.addElement(DefaultVertexFormats.TEX_2S);
    }
    UnpackedBakedQuad.Builder builder=new UnpackedBakedQuad.Builder(format);
    VertexLighterFlat trans=new VertexLighterFlat(Minecraft.getMinecraft().getBlockColors()){
      @Override protected void updateLightmap(      float[] normal,      float[] lightmap,      float x,      float y,      float z){
        lightmap[0]=brightness.getRight();
        lightmap[1]=brightness.getLeft();
      }
      @Override public void setQuadTint(      int tint){
      }
    }
;
    trans.setParent(builder);
    quad.pipe(trans);
    builder.setQuadTint(quad.getTintIndex());
    builder.setQuadOrientation(quad.getFace());
    return builder.build();
  }
 else {
    return quad;
  }
}
Program: 30505
Project: 30505
Buggy source:
void apply(FeatureFactory factory,Item item){
  if (this.itemMeshDefinition != null) {
    factory.addBootstrapComponent(new ItemMeshDefinitionComponent(item,itemMeshDefinition));
  }
  if (!this.itemModels.isEmpty()) {
    factory.addBootstrapComponent(new ItemModelComponent(item,this.itemModels));
  }
  Set<ResourceLocation> resources=new HashSet<>(variants);
  if (this.itemMeshDefinition == null && this.itemModels.isEmpty()) {
    ModelResourceLocation model;
    if (item instanceof ItemBlock) {
      Block block=((ItemBlock)item).getBlock();
      StateMapperHelper helper=new StateMapperHelper(block.getRegistryName());
      model=helper.getModelResourceLocation(block.getDefaultState());
    }
 else {
      model=new ModelResourceLocation(item.getRegistryName(),"String_Node_Str");
    }
    factory.addBootstrapComponent(new ItemModelComponent(item,ImmutableMap.of(0,model)));
    resources.add(model);
  }
  if (!resources.isEmpty()) {
    factory.addBootstrapComponent(new ItemVariantsComponent(item,resources));
  }
  if (itemColor != null) {
    factory.addBootstrapComponent(new ItemColorComponent(item,itemColor));
  }
}

Fixed version (ground truth):
void apply(FeatureFactory factory,Item item){
  if (this.itemMeshDefinition != null) {
    factory.addBootstrapComponent(new ItemMeshDefinitionComponent(item,itemMeshDefinition));
  }
  if (!this.itemModels.isEmpty()) {
    factory.addBootstrapComponent(new ItemModelComponent(item,this.itemModels));
  }
  Set<ResourceLocation> resources=new HashSet<>(variants);
  if (this.itemMeshDefinition == null && this.itemModels.isEmpty()) {
    ModelResourceLocation model;
    if (item instanceof ItemBlock) {
      Block block=((ItemBlock)item).getBlock();
      StateMapperHelper helper=new StateMapperHelper(block.getRegistryName());
      model=helper.getModelResourceLocation(block.getDefaultState());
    }
 else {
      model=new ModelResourceLocation(item.getRegistryName(),"String_Node_Str");
      resources.add(model);
    }
    factory.addBootstrapComponent(new ItemModelComponent(item,ImmutableMap.of(0,model)));
  }
  if (!resources.isEmpty()) {
    factory.addBootstrapComponent(new ItemVariantsComponent(item,resources));
  }
  if (itemColor != null) {
    factory.addBootstrapComponent(new ItemColorComponent(item,itemColor));
  }
}
Program: 30506
Project: 30506
Buggy source:
private TileEntity getTileEntity(TileEntity self,int x,int y,int z){
  final World w=self.getWorldObj();
  if (w.getChunkProvider().chunkExists(x >> 4,z >> 4)) {
    return w.getTileEntity(x,y,z);
  }
  return null;
}

Fixed version (ground truth):
private TileEntity getTileEntity(TileEntity self,BlockPos pos){
  World w=self.getWorld();
  if (w.getChunkProvider().chunkExists(pos.getX() >> 4,pos.getZ() >> 4)) {
    return w.getTileEntity(pos);
  }
  return null;
}
Program: 30508
Project: 30508
Buggy source:
@Override public boolean isSameAs(IBlockAccess world,int x,int y,int z){
  return false;
}

Fixed version (ground truth):
@Override public boolean isSameAs(ItemStack comparableStack){
  if (comparableStack == null) {
    return false;
  }
  return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem() && comparableStack.getItemDamage() == this.source.get().getDamage();
}
Program: 30509
Project: 30509
Buggy source:
@Override public boolean isSameAs(IBlockAccess world,int x,int y,int z){
  return false;
}

Fixed version (ground truth):
@Override public final boolean isSameAs(ItemStack comparableStack){
  return this.isEnabled() && Platform.isSameItemType(comparableStack,this.maybeStack(1).get());
}
Program: 30510
Project: 30510
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + this.part + "String_Node_Str"+ this.variant+ "String_Node_Str"+ this.ico+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + this.part + "String_Node_Str"+ this.variant+ '}';
}
Program: 30511
Project: 30511
Buggy source:
/** 
 * Check for a controller at this coordinates as well as is it loaded.
 * @return true if there is a loaded controller
 */
private boolean checkController(BlockPos pos){
  if (this.worldObj.getChunkProvider().chunkExists(this.xCoord >> 4,this.zCoord >> 4)) {
    return this.worldObj.getTileEntity(pos) instanceof TileController;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check for a controller at this coordinates as well as is it loaded.
 * @return true if there is a loaded controller
 */
private boolean checkController(BlockPos pos){
  final BlockPos ownPos=this.getPos();
  if (this.worldObj.getChunkProvider().chunkExists(ownPos.getX() >> 4,ownPos.getZ() >> 4)) {
    return this.worldObj.getTileEntity(pos) instanceof TileController;
  }
  return false;
}
Program: 30512
Project: 30512
Buggy source:
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer,int offset_x,int offset_y){
  for (int i=0; i < 9; i++) {
    if (this.locked.contains(i))     this.addSlotToContainer(new SlotDisabled(inventoryPlayer,i,8 + i * 18 + offset_x,58 + offset_y));
 else     this.addSlotToContainer(new SlotPlayerHotBar(inventoryPlayer,i,8 + i * 18 + offset_x,58 + offset_y));
  }
  for (int i=0; i < 3; i++) {
    for (int j=0; j < 9; j++) {
      if (this.locked.contains(j + i * 9 + 9))       this.addSlotToContainer(new SlotDisabled(inventoryPlayer,j + i * 9 + 9,8 + j * 18 + offset_x,offset_y + i * 18));
 else       this.addSlotToContainer(new SlotPlayerInv(inventoryPlayer,j + i * 9 + 9,8 + j * 18 + offset_x,offset_y + i * 18));
    }
  }
}

Fixed version (ground truth):
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer,int offset_x,int offset_y){
  for (int i=0; i < 3; i++) {
    for (int j=0; j < 9; j++) {
      if (this.locked.contains(j + i * 9 + 9))       this.addSlotToContainer(new SlotDisabled(inventoryPlayer,j + i * 9 + 9,8 + j * 18 + offset_x,offset_y + i * 18));
 else       this.addSlotToContainer(new SlotPlayerInv(inventoryPlayer,j + i * 9 + 9,8 + j * 18 + offset_x,offset_y + i * 18));
    }
  }
  for (int i=0; i < 9; i++) {
    if (this.locked.contains(i))     this.addSlotToContainer(new SlotDisabled(inventoryPlayer,i,8 + i * 18 + offset_x,58 + offset_y));
 else     this.addSlotToContainer(new SlotPlayerHotBar(inventoryPlayer,i,8 + i * 18 + offset_x,58 + offset_y));
  }
}
Program: 30513
Project: 30513
Buggy source:
public GuiMEPortableCell(InventoryPlayer inventoryPlayer,IPortableCell te){
  super(inventoryPlayer,te,new ContainerMEPortableCell(inventoryPlayer,null));
}

Fixed version (ground truth):
public GuiMEPortableCell(InventoryPlayer inventoryPlayer,IPortableCell te){
  super(inventoryPlayer,te,new ContainerMEPortableCell(inventoryPlayer,te));
}
Program: 30514
Project: 30514
Buggy source:
@Override public void detectAndSendChanges(){
  ItemStack currentItem=this.getPlayerInv().getCurrentItem();
  if (this.civ != null) {
    if (currentItem != this.civ.getItemStack()) {
      if (currentItem != null) {
        if (Platform.isSameItem(this.civ.getItemStack(),currentItem))         this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,this.civ.getItemStack());
 else         this.isContainerValid=false;
      }
 else       this.isContainerValid=false;
    }
  }
 else   this.isContainerValid=false;
  this.ticks++;
  if (this.ticks > 10) {
    this.civ.extractAEPower(this.powerMultiplier * this.ticks,Actionable.MODULATE,PowerMultiplier.CONFIG);
    this.ticks=0;
  }
  super.detectAndSendChanges();
}

Fixed version (ground truth):
@Override public void detectAndSendChanges(){
  ItemStack currentItem=slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(slot);
  if (this.civ != null) {
    if (currentItem != this.civ.getItemStack()) {
      if (currentItem != null) {
        if (Platform.isSameItem(this.civ.getItemStack(),currentItem))         this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem,this.civ.getItemStack());
 else         this.isContainerValid=false;
      }
 else       this.isContainerValid=false;
    }
  }
 else   this.isContainerValid=false;
  this.ticks++;
  if (this.ticks > 10) {
    this.civ.extractAEPower(this.powerMultiplier * this.ticks,Actionable.MODULATE,PowerMultiplier.CONFIG);
    this.ticks=0;
  }
  super.detectAndSendChanges();
}
Program: 30515
Project: 30515
Buggy source:
public ContainerMEPortableCell(InventoryPlayer ip,IPortableCell monitorable){
  super(ip,monitorable,false);
  this.lockPlayerInventorySlot(ip.currentItem);
  this.civ=monitorable;
  this.bindPlayerInventory(ip,0,0);
}

Fixed version (ground truth):
public ContainerMEPortableCell(InventoryPlayer ip,IPortableCell monitorable){
  super(ip,monitorable,false);
  if (monitorable instanceof IInventorySlotAware) {
    int slotIndex=((IInventorySlotAware)monitorable).getInventorySlot();
    this.lockPlayerInventorySlot(slotIndex);
    this.slot=slotIndex;
  }
 else {
    this.slot=-1;
    this.lockPlayerInventorySlot(ip.currentItem);
  }
  this.civ=monitorable;
  this.bindPlayerInventory(ip,0,0);
}
Program: 30516
Project: 30516
Buggy source:
public WirelessTerminalGuiObject(IWirelessTermHandler wh,ItemStack is,EntityPlayer ep,World w,int x,int y,int z){
  this.encryptionKey=wh.getEncryptionKey(is);
  this.effectiveItem=is;
  this.myPlayer=ep;
  this.wth=wh;
  ILocatable obj=null;
  try {
    long encKey=Long.parseLong(this.encryptionKey);
    obj=AEApi.instance().registries().locatable().getLocatableBy(encKey);
  }
 catch (  NumberFormatException err) {
  }
  if (obj instanceof IGridHost) {
    IGridNode n=((IGridHost)obj).getGridNode(ForgeDirection.UNKNOWN);
    if (n != null) {
      this.targetGrid=n.getGrid();
      if (this.targetGrid != null) {
        this.sg=this.targetGrid.getCache(IStorageGrid.class);
        if (this.sg != null)         this.itemStorage=this.sg.getItemInventory();
      }
    }
  }
}

Fixed version (ground truth):
public WirelessTerminalGuiObject(IWirelessTermHandler wh,ItemStack is,EntityPlayer ep,World w,int x,int y,int z){
  this.encryptionKey=wh.getEncryptionKey(is);
  this.effectiveItem=is;
  this.myPlayer=ep;
  this.wth=wh;
  this.inventorySlot=x;
  ILocatable obj=null;
  try {
    long encKey=Long.parseLong(this.encryptionKey);
    obj=AEApi.instance().registries().locatable().getLocatableBy(encKey);
  }
 catch (  NumberFormatException err) {
  }
  if (obj instanceof IGridHost) {
    IGridNode n=((IGridHost)obj).getGridNode(ForgeDirection.UNKNOWN);
    if (n != null) {
      this.targetGrid=n.getGrid();
      if (this.targetGrid != null) {
        this.sg=this.targetGrid.getCache(IStorageGrid.class);
        if (this.sg != null)         this.itemStorage=this.sg.getItemInventory();
      }
    }
  }
}
Program: 30517
Project: 30517
Buggy source:
public PortableCellViewer(ItemStack is){
  super(CellInventory.getCell(is,null));
  this.ips=(IAEItemPowerStorage)is.getItem();
  this.target=is;
}

Fixed version (ground truth):
public PortableCellViewer(ItemStack is,int slot){
  super(CellInventory.getCell(is,null));
  this.ips=(IAEItemPowerStorage)is.getItem();
  this.target=is;
  this.inventorySlot=slot;
}
Program: 30518
Project: 30518
Buggy source:
@Override public IGuiItemObject getGuiObject(ItemStack is,World w,int x,int y,int z){
  return new PortableCellViewer(is);
}

Fixed version (ground truth):
@Override public IGuiItemObject getGuiObject(ItemStack is,World w,int x,int y,int z){
  return new PortableCellViewer(is,x);
}