nus-yam/ex-repair huggingface dataset:
Program: 169437
Project: 169437
Buggy source:
protected List<IConnection<IRedstoneDevice>> performPropagation(){
  List<IConnection<IRedstoneDevice>> connections=new ArrayList<IConnection<IRedstoneDevice>>();
  IConnection<IRedstoneDevice> firstCon=(IConnection<IRedstoneDevice>)getDevice().getRedstoneConnectionCache().getConnectionOnSide(getSide());
  if (firstCon != null)   connections.add(firstCon);
  List<IConnection<IRedstoneDevice>> current=new ArrayList<IConnection<IRedstoneDevice>>();
  for (  Entry<IConnection<IRedstoneDevice>,Boolean> p : getPropagation(getDevice(),getSide())) {
    if (p.getValue()) {
      schedule(new RedPropagator(p.getKey().getB(),p.getKey().getSideB()));
    }
 else {
      if (p.getKey().getB() instanceof IRedstoneConductor && ((IRedstoneConductor)p.getKey().getB()).hasLoss(p.getKey().getSideB()) != (this instanceof LossyPropagator)) {
        schedule(new RedPropagator(p.getKey().getB(),p.getKey().getSideB()));
      }
 else {
        current.add(p.getKey());
      }
    }
  }
  if (current.size() == 0 && connections.size() == 0)   return connections;
  List<IConnection<IRedstoneDevice>> newDevices=new ArrayList<IConnection<IRedstoneDevice>>();
  return connections;
}

Fixed version (ground truth):
protected List<IConnection<IRedstoneDevice>> performPropagation(){
  List<IConnection<IRedstoneDevice>> connections=new ArrayList<IConnection<IRedstoneDevice>>();
  IConnection<IRedstoneDevice> firstCon=(IConnection<IRedstoneDevice>)getDevice().getRedstoneConnectionCache().getConnectionOnSide(getSide());
  if (firstCon != null)   connections.add(firstCon);
  List<IConnection<IRedstoneDevice>> current=new ArrayList<IConnection<IRedstoneDevice>>();
  for (  Entry<IConnection<IRedstoneDevice>,Boolean> p : getPropagation(getDevice(),getSide())) {
    if (p.getValue()) {
      schedule(new RedPropagator(p.getKey().getB(),p.getKey().getSideB()));
    }
 else {
      if (p.getKey().getB() instanceof IRedstoneConductor && ((IRedstoneConductor)p.getKey().getB()).hasLoss(p.getKey().getSideB()) != (this instanceof LossyPropagator)) {
        schedule(new RedPropagator(p.getKey().getB(),p.getKey().getSideB()));
      }
 else {
        current.add(p.getKey());
      }
    }
  }
  if (current.size() == 0 && connections.size() == 0)   return connections;
  List<IConnection<IRedstoneDevice>> newDevices=new ArrayList<IConnection<IRedstoneDevice>>();
  while (current.size() > 0) {
    List<Entry<IConnection<IRedstoneDevice>,Boolean>> tmp=new ArrayList<Entry<IConnection<IRedstoneDevice>,Boolean>>();
    for (    IConnection<IRedstoneDevice> c : current) {
      tmp.addAll(getPropagation(c.getB(),c.getSideB()));
      for (      Entry<IConnection<IRedstoneDevice>,Boolean> p : tmp) {
        if (p.getValue()) {
        }
 else         if (!connections.contains(p.getKey()) && !newDevices.contains(p.getKey())) {
          newDevices.add(p.getKey());
        }
      }
      tmp.clear();
    }
    connections.addAll(current);
    current.clear();
    for (    IConnection<IRedstoneDevice> c : newDevices)     if (!connections.contains(c))     current.add(c);
    newDevices.clear();
  }
  return connections;
}
Program: 169438
Project: 169438
Buggy source:
@SubscribeEvent public void onRenderDebugScreen(RenderGameOverlayEvent event){
  if (event.type.equals(RenderGameOverlayEvent.ElementType.DEBUG)) {
    Minecraft mc=Minecraft.getMinecraft();
    FontRenderer fr=mc.fontRenderer;
    MinecraftServer sv=MinecraftServer.getServer();
    boolean isLocal=sv instanceof IntegratedServer;
    List<String> text=new ArrayList<String>();
{
      fr.drawStringWithShadow("String_Node_Str",event.resolution.getScaledWidth() - 165,75,0xFFFFFF44);
    }
    if (sv != null) {
      double ms=MathHelper.mean(sv.worldTickTimes.get(mc.theWorld.provider.dimensionId)) * 1.0E-6D;
      double tps=Math.min(1000.0 / ms,20);
      text.add("String_Node_Str" + tps + "String_Node_Str"+ new DecimalFormat("String_Node_Str").format(ms)+ "String_Node_Str");
    }
 else {
      text.add("String_Node_Str");
    }
    int i=0;
    for (    String s : text) {
      fr.drawStringWithShadow(s,event.resolution.getScaledWidth() - 160,90 + 10 * i,0xFFFFFF77);
      i++;
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onRenderDebugScreen(RenderGameOverlayEvent event){
  if (event.type.equals(RenderGameOverlayEvent.ElementType.DEBUG)) {
    Minecraft mc=Minecraft.getMinecraft();
    FontRenderer fr=mc.fontRenderer;
    MinecraftServer sv=MinecraftServer.getServer();
    boolean isLocal=sv instanceof IntegratedServer;
    List<String> text=new ArrayList<String>();
{
      fr.drawStringWithShadow("String_Node_Str",event.resolution.getScaledWidth() - 165,75,0xFFFFFF44);
    }
    if (sv != null) {
      double ms=MathHelper.mean(sv.worldTickTimes.get(mc.theWorld.provider.dimensionId)) * 1.0E-6D;
      double tps=Math.min(1000.0 / ms,20);
      text.add("String_Node_Str" + df.format(tps) + "String_Node_Str"+ df.format(ms)+ "String_Node_Str");
    }
 else {
      text.add("String_Node_Str");
    }
    int i=0;
    for (    String s : text) {
      fr.drawStringWithShadow(s,event.resolution.getScaledWidth() - 160,90 + 10 * i,0xFFFFFF77);
      i++;
    }
  }
}
Program: 169439
Project: 169439
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  super.drawGuiContainerBackgroundLayer(f,i,j);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  int burningPercentage=(int)(furnace.getBurningPercentage() * 14);
  drawTexturedModalRect(x + 22,y + 54 + 14 - burningPercentage,177,14 - burningPercentage,14,burningPercentage + 0);
  int processPercentage=(int)(furnace.getProcessPercentage() * 22);
  drawTexturedModalRect(x + 103,y + 35,178,14,processPercentage,15);
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  super.drawGuiContainerBackgroundLayer(f,i,j);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  mc.renderEngine.bindTexture(resLoc);
  int burningPercentage=(int)(furnace.getBurningPercentage() * 14);
  drawTexturedModalRect(x + 22,y + 54 + 14 - burningPercentage,177,14 - burningPercentage,14,burningPercentage + 0);
  int processPercentage=(int)(furnace.getProcessPercentage() * 22);
  drawTexturedModalRect(x + 103,y + 35,178,14,processPercentage,15);
}
Program: 169440
Project: 169440
Buggy source:
@Override @SideOnly(Side.CLIENT) public boolean renderStatic(Vec3i translation,RenderHelper renderer,RenderBlocks renderBlocks,int pass){
switch (getFace()) {
case DOWN:
    break;
case UP:
  renderer.addTransformation(new Rotation(180,180,0,Vec3d.center));
break;
case NORTH:
renderer.addTransformation(new Rotation(90,0,0,Vec3d.center));
break;
case SOUTH:
renderer.addTransformation(new Rotation(-90,0,0,Vec3d.center));
break;
case WEST:
renderer.addTransformation(new Rotation(0,0,-90,Vec3d.center));
break;
case EAST:
renderer.addTransformation(new Rotation(0,0,90,Vec3d.center));
break;
default :
break;
}
int rotation=getRotation();
if (rotation != -1) renderer.addTransformation(new Rotation(0,90 * -rotation,0));
renderer.renderBox(BOX,getIcon(ForgeDirection.DOWN),getIcon(ForgeDirection.UP),getIcon(ForgeDirection.WEST),getIcon(ForgeDirection.EAST),getIcon(ForgeDirection.NORTH),getIcon(ForgeDirection.SOUTH));
for (IGateComponent c : getComponents()) c.renderStatic(translation,renderer,pass);
return true;
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public boolean renderStatic(Vec3i translation,RenderHelper renderer,RenderBlocks renderBlocks,int pass){
  Transformation t=null;
  if (getFace() == ForgeDirection.UP)   t=new Rotation(180,180,0,Vec3d.center);
  if (getFace() == ForgeDirection.NORTH)   t=new Rotation(90,0,0,Vec3d.center);
  if (getFace() == ForgeDirection.SOUTH)   t=new Rotation(-90,0,0,Vec3d.center);
  if (getFace() == ForgeDirection.WEST)   t=new Rotation(0,0,-90,Vec3d.center);
  if (getFace() == ForgeDirection.EAST)   t=new Rotation(0,0,90,Vec3d.center);
  if (t != null)   renderer.addTransformation(t);
  int rotation=getRotation();
  if (rotation != -1)   renderer.addTransformation(new Rotation(0,90 * -rotation,0));
  renderer.renderBox(BOX,getIcon(ForgeDirection.DOWN),getIcon(ForgeDirection.UP),getIcon(ForgeDirection.WEST),getIcon(ForgeDirection.EAST),getIcon(ForgeDirection.NORTH),getIcon(ForgeDirection.SOUTH));
  for (  IGateComponent c : getComponents())   c.renderStatic(translation,renderer,pass);
  if (rotation != -1)   renderer.removeTransformation();
  if (t != null)   renderer.removeTransformation();
  return true;
}
Program: 169441
Project: 169441
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public IConnection<IRedstoneDevice> getConnectionOnSide(ForgeDirection side){
  if (wrapper.device instanceof IInsulatedRedwire && ((IRedstoneDevice)wrapper.device).getRedstoneConnectionCache() != null) {
    return (IConnection<IRedstoneDevice>)((IRedstoneDevice)wrapper.device).getRedstoneConnectionCache().getConnectionOnSide(side);
  }
 else {
    IConnection<? extends IBundledDevice> original=wrapper.device.getBundledConnectionCache().getConnectionOnSide(side);
    if (original != originalCons[side.ordinal()]) {
      if (original != null) {
        if (!(original.getB() instanceof IInsulatedRedstoneDevice) || (original.getB() instanceof IInsulatedRedstoneDevice && wrapper.color.equals(((IInsulatedRedstoneDevice)original.getB()).getInsulationColor(original.getSideB()))))         cons[side.ordinal()]=new RedstoneConnection(BundledDeviceWrapper.this,wrap(original.getB(),color),side,original.getSideB(),original.getType());
 else         cons[side.ordinal()]=null;
      }
 else {
        cons[side.ordinal()]=null;
      }
      originalCons[side.ordinal()]=original;
    }
    return cons[side.ordinal()];
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public IConnection<IRedstoneDevice> getConnectionOnSide(ForgeDirection side){
  if (wrapper.device instanceof IInsulatedRedwire && ((IRedstoneDevice)wrapper.device).getRedstoneConnectionCache() != null) {
    IConnection<IRedstoneDevice> c=(IConnection<IRedstoneDevice>)((IRedstoneDevice)wrapper.device).getRedstoneConnectionCache().getConnectionOnSide(side);
    if (c != null)     return c;
  }
  IConnection<? extends IBundledDevice> original=wrapper.device.getBundledConnectionCache().getConnectionOnSide(side);
  if (original != originalCons[side.ordinal()]) {
    if (original != null) {
      if (!(original.getB() instanceof IInsulatedRedstoneDevice) || (original.getB() instanceof IInsulatedRedstoneDevice && wrapper.color.equals(((IInsulatedRedstoneDevice)original.getB()).getInsulationColor(original.getSideB()))))       cons[side.ordinal()]=new RedstoneConnection(BundledDeviceWrapper.this,wrap(original.getB(),color),side,original.getSideB(),original.getType());
 else       cons[side.ordinal()]=null;
    }
 else {
      cons[side.ordinal()]=null;
    }
    originalCons[side.ordinal()]=original;
  }
  return cons[side.ordinal()];
}
Program: 169444
Project: 169444
Buggy source:
@Override public void writeUpdateData(DataOutput buffer) throws IOException {
  super.writeUpdateData(buffer);
}

Fixed version (ground truth):
@Override public void writeUpdateData(DataOutput buffer) throws IOException {
  super.writeUpdateData(buffer);
  for (int i=0; i < 6; i++) {
    boolean connected=false;
    boolean render=false;
    IConnection<? extends IBundledDevice> bc=getBundledConnectionCache().getConnectionOnSide(ForgeDirection.getOrientation(i));
    if (bc != null) {
      IBundledDevice dev=bc.getB();
      if (dev instanceof IFace && ((IFace)dev).getFace() == ForgeDirection.getOrientation(i).getOpposite()) {
        if (dev instanceof IRedwire) {
          if (getFace().ordinal() > ((PartRedwireFace)dev).getFace().ordinal()) {
            if (!(dev instanceof IInsulatedRedstoneDevice) && dev instanceof IRedwire) {
              render=true;
              connected=true;
            }
          }
 else           if (dev instanceof PartRedwireFaceBundled) {
            connected=true;
          }
        }
 else {
          connected=true;
          render=true;
        }
      }
    }
    buffer.writeBoolean(connected);
    buffer.writeBoolean(render);
  }
}
Program: 169445
Project: 169445
Buggy source:
@Override public IBundledDevice getBundledDeviceAt(World world,int x,int y,int z,ForgeDirection face,ForgeDirection side){
  ITilePartHolder holder=MultipartCompatibility.getPartHolder(world,x,y,z);
  if (holder != null) {
    for (    IPart p : holder.getParts()) {
      if (p instanceof IBundledDeviceWrapper) {
        if (p instanceof IFace) {
          if (((IFace)p).getFace() == face)           return ((IBundledDeviceWrapper)p).getBundledDeviceOnSide(side);
        }
 else {
          if (face == ForgeDirection.UNKNOWN)           return ((IBundledDeviceWrapper)p).getBundledDeviceOnSide(side);
        }
      }
 else       if (p instanceof IBundledDevice) {
        if (p instanceof IFace) {
          if (((IFace)p).getFace() == face)           return (IBundledDevice)p;
        }
 else {
          if (face == ForgeDirection.UNKNOWN)           return (IBundledDevice)p;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public IBundledDevice getBundledDeviceAt(World world,int x,int y,int z,ForgeDirection face,ForgeDirection side){
  ITilePartHolder holder=MultipartCompatibility.getPartHolder(world,x,y,z);
  if (holder != null) {
    boolean foundOnlyFace=holder.getParts().size() > 0;
    for (    IPart p : holder.getParts()) {
      if (p instanceof IBundledDeviceWrapper) {
        if (p instanceof IFace) {
          if (((IFace)p).getFace() == face)           return ((IBundledDeviceWrapper)p).getBundledDeviceOnSide(side);
        }
 else {
          if (face == ForgeDirection.UNKNOWN)           return ((IBundledDeviceWrapper)p).getBundledDeviceOnSide(side);
        }
      }
 else       if (p instanceof IBundledDevice) {
        if (p instanceof IFace) {
          if (((IFace)p).getFace() == face)           return (IBundledDevice)p;
        }
 else {
          if (face == ForgeDirection.UNKNOWN)           return (IBundledDevice)p;
        }
        foundOnlyFace=true;
      }
 else {
        if (!(p instanceof IFace))         foundOnlyFace=false;
      }
    }
    if (foundOnlyFace)     return null;
  }
  return null;
}
Program: 169446
Project: 169446
Buggy source:
@Override public final void update(){
  if (getLayout() == null && !getWorld().isRemote)   loadLayout();
  if (!getWorld().isRemote) {
    getRedstoneConnectionCache().recalculateConnections();
    getBundledConnectionCache().recalculateConnections();
    for (    GateConnectionBase c : getConnections())     if (c != null)     c.refresh();
  }
  logic().tick();
  for (  IGateComponent c : getComponents())   c.tick();
  if (!getWorld().isRemote) {
    for (    GateConnectionBase c : getConnections())     if (c != null)     c.notifyUpdateIfNeeded();
    sendUpdateIfNeeded();
  }
}

Fixed version (ground truth):
@Override public final void update(){
  if (getLayout() == null && !getWorld().isRemote)   loadLayout();
  logic().tick();
  for (  IGateComponent c : getComponents())   c.tick();
  if (!getWorld().isRemote) {
    for (    GateConnectionBase c : getConnections())     if (c != null)     c.notifyUpdateIfNeeded();
    sendUpdateIfNeeded();
  }
}
Program: 169447
Project: 169447
Buggy source:
@Override public void onUpdate(){
  if (getLayout() == null && !getWorld().isRemote)   loadLayout();
  if (RedstoneApi.getInstance().shouldWiresHandleUpdates()) {
    getRedstoneConnectionCache().recalculateConnections();
    getBundledConnectionCache().recalculateConnections();
    for (    GateConnectionBase c : getConnections())     if (c != null)     c.refresh();
    for (    GateConnectionBase c : getConnections())     if (c != null)     RedstoneApi.getInstance().getRedstonePropagator(this,c.getForgeDirection()).propagate();
  }
  logic().doLogic();
  sendUpdateIfNeeded();
}

Fixed version (ground truth):
@Override public void onUpdate(){
  if (getLayout() == null && !getWorld().isRemote)   loadLayout();
  if (RedstoneApi.getInstance().shouldWiresHandleUpdates()) {
    getRedstoneConnectionCache().recalculateConnections();
    getBundledConnectionCache().recalculateConnections();
    for (    GateConnectionBase c : getConnections())     if (c != null)     c.refresh();
    for (    GateConnectionBase c : getConnections())     if (c != null)     if (getRedstoneConnectionCache().getConnectionOnSide(c.getForgeDirection()) != null)     RedstoneApi.getInstance().getRedstonePropagator(this,c.getForgeDirection()).propagate();
  }
  logic().doLogic();
  sendUpdateIfNeeded();
}
Program: 169448
Project: 169448
Buggy source:
@Override public void renderStatic(Vec3i translation,RenderHelper renderer,int pass){
  byte power=getPower();
  int colorMin=isEnabled() ? type.getMinColor() : 0x6A6A6A;
  int colorMax=isEnabled() ? type.getMaxColor() : 0x6A6A6A;
  renderer.setColor(WireHelper.getColorForPowerLevel(colorMin,colorMax,power));
  double height=1 / 48D;
  double scale=1D / getGate().getLayout().getLayout(layoutColor).getWidth();
  renderer.setRenderSides(false,true,true,true,true,true);
  Transformation transformation=new Scale(scale,1,scale);
  for (  Rectangle r : getGate().getLayout().getSimplifiedLayout(layoutColor).getRectangles())   renderer.renderBox(new Vec2dRect(r).extrude(height).transform(transformation).add(-0.5 + 1 / 64D,2 / 16D,-0.5 + 1 / 64D),IconSupplier.wire);
  renderer.resetRenderedSides();
  renderer.setColor(0xFFFFFF);
}

Fixed version (ground truth):
@Override public void renderStatic(Vec3i translation,RenderHelper renderer,int pass){
  byte power=getPower();
  int colorMin=isEnabled() ? type.getMinColor() : 0x6A6A6A;
  int colorMax=isEnabled() ? type.getMaxColor() : 0x6A6A6A;
  renderer.setColor(WireHelper.getColorForPowerLevel(colorMin,colorMax,power));
  double height=1 / 32D;
  double scale=1D / getGate().getLayout().getLayout(layoutColor).getWidth();
  renderer.setRenderSides(false,true,true,true,true,true);
  Transformation transformation=new Scale(scale,1,scale);
  for (  Rectangle r : getGate().getLayout().getSimplifiedLayout(layoutColor).getRectangles())   renderer.renderBox(new Vec2dRect(r).extrude(height).transform(transformation).add(-0.5 + 1 / 64D,2 / 16D,-0.5 + 1 / 64D),IconSupplier.wire);
  renderer.resetRenderedSides();
  renderer.setColor(0xFFFFFF);
}
Program: 169449
Project: 169449
Buggy source:
@Override public void refresh(){
  IConnection<? extends IRedstoneDevice> c=gate.getRedstoneConnectionCache().getConnectionOnSide(getForgeDirection());
  if (c == null || c.getB() instanceof DummyRedstoneDevice)   input=RedstoneHelper.getInput(getGate().getWorld(),getGate().getX(),getGate().getY(),getGate().getZ(),getForgeDirection(),getGate().getFace()) > 0;
}

Fixed version (ground truth):
@Override public void refresh(){
  IConnection<? extends IRedstoneDevice> c=gate.getRedstoneConnectionCache().getConnectionOnSide(getForgeDirection());
  if (c == null || c.getB() instanceof DummyRedstoneDevice) {
    input=RedstoneHelper.getInput(getGate().getWorld(),getGate().getX(),getGate().getY(),getGate().getZ(),getForgeDirection(),getGate().getFace()) > 0;
  }
}
Program: 169450
Project: 169450
Buggy source:
@Override public boolean canStay(){
  Vec3i loc=new Vec3i(this).add(getFace());
  if (MultipartCompatibility.getPartHolder(getWorld(),loc) != null)   return MultipartCompatibility.getPart(getWorld(),loc,PartRedwireFreestanding.class) != null;
  return super.canStay();
}

Fixed version (ground truth):
@Override public boolean canStay(){
  Vec3i loc=new Vec3i(this).add(getFace());
  if (MultipartCompatibility.getPartHolder(getWorld(),loc) != null) {
    if (MultipartCompatibility.getPart(getWorld(),loc,PartRedwireFreestanding.class) != null)     return true;
    PneumaticTube t=MultipartCompatibility.getPart(getWorld(),loc,PneumaticTube.class);
    if (t != null && t.getRedwireType() != null)     return true;
  }
  return super.canStay();
}
Program: 169451
Project: 169451
Buggy source:
/** 
 * @author Koen Beckers (K4Unl)
 */
@Override @SideOnly(Side.CLIENT) public void renderItem(ItemRenderType type,ItemStack item,Object... data){
  power=(byte)255;
  RenderHelper rh=RenderHelper.instance;
  rh.setRenderCoords(null,0,0,0);
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
  Tessellator.instance.startDrawingQuads();
  renderStatic(new Vec3i(0,0,0),rh,RenderBlocks.getInstance(),0);
  Tessellator.instance.draw();
  rh.reset();
  GL11.glPushMatrix();
  renderGlow(1);
  GL11.glPopMatrix();
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
}

Fixed version (ground truth):
/** 
 * @author Koen Beckers (K4Unl)
 */
@Override @SideOnly(Side.CLIENT) public void renderItem(ItemRenderType type,ItemStack item,Object... data){
  power=(byte)0;
  RenderHelper rh=RenderHelper.instance;
  rh.setRenderCoords(null,0,0,0);
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
  Tessellator.instance.startDrawingQuads();
  renderStatic(new Vec3i(0,0,0),rh,RenderBlocks.getInstance(),0);
  Tessellator.instance.draw();
  rh.reset();
  GL11.glPushMatrix();
  renderGlow(1);
  GL11.glPopMatrix();
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
}
Program: 169452
Project: 169452
Buggy source:
@Override public boolean canConnect(ForgeDirection side,IRedstoneDevice dev,ConnectionType type){
  if (side == ForgeDirection.UNKNOWN)   return false;
  if (OcclusionHelper.microblockOcclusionTest(getParent(),MicroblockShape.EDGE,1,getFace(),side))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean canConnect(ForgeDirection side,IRedstoneDevice dev,ConnectionType type){
  if (side == ForgeDirection.UNKNOWN)   return false;
  if (!OcclusionHelper.microblockOcclusionTest(getParent(),MicroblockShape.EDGE,1,getFace(),side))   return false;
  return true;
}
Program: 169453
Project: 169453
Buggy source:
public boolean isConnected(ForgeDirection dir,PneumaticTube otherTube){
  if (otherTube != null) {
    if (!(this instanceof Accelerator) && this instanceof MagTube != otherTube instanceof MagTube && !(otherTube instanceof Accelerator))     return false;
    TubeColor otherTubeColor=otherTube.getColor(dir.getOpposite());
    if (otherTubeColor != TubeColor.NONE && getColor(dir) != TubeColor.NONE && getColor(dir) != otherTubeColor)     return false;
  }
  return getWorld() == null || OcclusionHelper.microblockOcclusionTest(getParent(),MicroblockShape.FACE_HOLLOW,8,dir);
}

Fixed version (ground truth):
public boolean isConnected(ForgeDirection dir,PneumaticTube otherTube){
  if (otherTube != null) {
    if (!(this instanceof Accelerator) && this instanceof MagTube != otherTube instanceof MagTube && !(otherTube instanceof Accelerator))     return false;
    TubeColor otherTubeColor=otherTube.getColor(dir.getOpposite());
    if (otherTubeColor != TubeColor.NONE && getColor(dir) != TubeColor.NONE && getColor(dir) != otherTubeColor)     return false;
  }
  return getWorld() == null || OcclusionHelper.microblockOcclusionTest(getParent(),true,MicroblockShape.FACE_HOLLOW,8,dir);
}
Program: 169454
Project: 169454
Buggy source:
/** 
 * Event called whenever a nearby block updates
 */
@Override public void onUpdate(){
  if (getParent() != null && getWorld() != null) {
    RedstoneConductorTube device=RedstoneConductorTube.getDevice(this);
    device.getRedstoneConnectionCache().recalculateConnections();
    ForgeDirection d=ForgeDirection.UNKNOWN;
    for (    ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)     if (device.getDeviceOnSide(dir) != null)     d=dir;
    RedstoneApi.getInstance().getRedstonePropagator(device,d).propagate();
    sendUpdatePacket();
    clearCache();
    updateConnections();
  }
}

Fixed version (ground truth):
/** 
 * Event called whenever a nearby block updates
 */
@Override public void onUpdate(){
  if (getParent() != null && getWorld() != null) {
    if (RedstoneApi.getInstance().shouldWiresHandleUpdates()) {
      RedstoneConductorTube device=RedstoneConductorTube.getDevice(this);
      device.getRedstoneConnectionCache().recalculateConnections();
      ForgeDirection d=ForgeDirection.UNKNOWN;
      for (      ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)       if (device.getDeviceOnSide(dir) != null)       d=dir;
      RedstoneApi.getInstance().getRedstonePropagator(device,d).propagate();
      sendUpdatePacket();
    }
    clearCache();
    updateConnections();
  }
}
Program: 169455
Project: 169455
Buggy source:
@Override public void onRedstoneUpdate(){
  tube.sendUpdatePacket();
}

Fixed version (ground truth):
@Override public void onRedstoneUpdate(){
  for (  ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
    IConnection<IRedstoneDevice> c=connections.getConnectionOnSide(dir);
    IRedstoneDevice dev=null;
    if (c != null)     dev=c.getB();
    if (dev == null || dev instanceof DummyRedstoneDevice)     RedstoneHelper.notifyRedstoneUpdate(getWorld(),getX(),getY(),getZ(),dir,false);
  }
  tube.sendUpdatePacket();
}
Program: 169456
Project: 169456
Buggy source:
@Override public boolean canConnect(ForgeDirection side,IRedstoneDevice device,ConnectionType type){
  if (type == ConnectionType.STRAIGHT) {
    if (getRedwireType(side) == null)     return false;
    if (device instanceof IRedwire) {
      RedwireType rwt=getRedwireType(side);
      if (type == null)       return false;
      RedwireType rwt_=((IRedwire)device).getRedwireType(type == ConnectionType.STRAIGHT ? side.getOpposite() : side.getOpposite());
      if (rwt_ == null)       return false;
      if (!rwt.canConnectTo(rwt_))       return false;
    }
    if (device instanceof IFace)     return false;
    if (!OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))     return false;
    if (device instanceof RedstoneConductorTube)     if (((RedstoneConductorTube)device).tube instanceof MagTube != tube instanceof MagTube)     return false;
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canConnect(ForgeDirection side,IRedstoneDevice device,ConnectionType type){
  if (type == ConnectionType.STRAIGHT) {
    if (getRedwireType(side) == null)     return false;
    if (device instanceof IRedwire) {
      RedwireType rwt=getRedwireType(side);
      if (type == null)       return false;
      RedwireType rwt_=((IRedwire)device).getRedwireType(type == ConnectionType.STRAIGHT ? side.getOpposite() : side.getOpposite());
      if (rwt_ == null)       return false;
      if (!rwt.canConnectTo(rwt_))       return false;
    }
    if (device instanceof IFace)     return ((IFace)device).getFace() == side.getOpposite();
    if (!OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))     return false;
    if (device instanceof RedstoneConductorTube)     if (((RedstoneConductorTube)device).tube instanceof MagTube != tube instanceof MagTube)     return false;
    return true;
  }
  return false;
}
Program: 169457
Project: 169457
Buggy source:
@Override public List<Vec3dCube> getOcclusionBoxes(){
  List<Vec3dCube> boxes=new ArrayList<Vec3dCube>();
  double h=getHeight() / 16D;
  double d=0.25;
  boxes.add(new Vec3dCube(d,0,d,1 - d,h,1 - d));
  VectorHelper.rotateBoxes(boxes,getFace(),0);
  return boxes;
}

Fixed version (ground truth):
@Override public List<Vec3dCube> getOcclusionBoxes(){
  List<Vec3dCube> boxes=new ArrayList<Vec3dCube>();
  double h=getHeight() / 16D;
  double d=4 / 16D;
  boxes.add(new Vec3dCube(d,0,d,1 - d,h,1 - d));
  VectorHelper.rotateBoxes(boxes,getFace(),0);
  return boxes;
}
Program: 169458
Project: 169458
Buggy source:
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  if (world.getBlock(x,y - 1,z).canSustainPlant(world,x,y,z,ForgeDirection.UP,this) && world.getBlock(x,y - 1,z).isFertile(world,x,y,z)) {
    return true;
  }
  return (world.getBlock(x,y - 1,z) instanceof com.bluepowermod.block.worldgen.BlockCrop) && (world.getBlockMetadata(x,y - 1,z) == 7);
}

Fixed version (ground truth):
/** 
 * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
 */
@Override public boolean canBlockStay(World world,int x,int y,int z){
  if (world.getBlock(x,y,z) != this)   return super.canBlockStay(world,x,y,z);
  if (world.getBlock(x,y - 1,z).canSustainPlant(world,x,y - 1,z,ForgeDirection.UP,this) && world.getBlock(x,y - 1,z).isFertile(world,x,y - 1,z)) {
    return true;
  }
  return (world.getBlock(x,y - 1,z) instanceof com.bluepowermod.block.worldgen.BlockCrop) && (world.getBlockMetadata(x,y - 1,z) == 7);
}
Program: 169459
Project: 169459
Buggy source:
@Override public void onUpdate(){
  getRedstoneConnectionCache().recalculateConnections();
  getBundledConnectionCache().recalculateConnections();
  for (  GateConnectionBase c : getConnections())   if (c != null)   c.refesh();
  if (!RedstoneApi.getInstance().shouldWiresHandleUpdates())   return;
  for (  GateConnectionBase c : getConnections())   if (c != null)   RedstoneApi.getInstance().getRedstonePropagator(this,c.getForgeDirection()).propagate();
  doLogicStuff();
}

Fixed version (ground truth):
@Override public void onUpdate(){
  getRedstoneConnectionCache().recalculateConnections();
  getBundledConnectionCache().recalculateConnections();
  for (  GateConnectionBase c : getConnections())   if (c != null)   c.refesh();
  for (  GateConnectionBase c : getConnections())   if (c != null)   RedstoneApi.getInstance().getRedstonePropagator(this,c.getForgeDirection()).propagate();
  doLogicStuff();
  for (  GateConnectionBase c : getConnections())   if (c != null)   c.notifyUpdateIfNeeded();
  sendUpdateIfNeeded();
}
Program: 169461
Project: 169461
Buggy source:
@Override protected void doPropagate(){
  if (getDevice().getWorld().isRemote)   return;
  if (getDevice() instanceof IRedConductor) {
    if (((IRedConductor)getDevice()).hasLoss(getSide())) {
      try {
        new LossyPropagator(getDevice(),getSide()).propagate();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
 else {
      try {
        new LosslessPropagator(getDevice(),getSide()).propagate();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
    return;
  }
 else   if (getDevice() instanceof GateBase<?,?,?,?,?,?>) {
    IGateConnection c=((GateBase<?,?,?,?,?,?>)getDevice()).getConnection(getSide());
    if (c != null) {
      if (c instanceof GateConnectionAnalogue) {
        try {
          new LossyPropagator(getDevice(),getSide()).propagate();
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
 else       if (c instanceof GateConnectionDigital) {
        try {
          new LosslessPropagator(getDevice(),getSide()).propagate();
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
      return;
    }
  }
  try {
    new LosslessPropagator(getDevice(),getSide()).propagate();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void doPropagate(){
  if (getDevice().getWorld().isRemote)   return;
  if (getDevice() instanceof IRedConductor) {
    if (((IRedConductor)getDevice()).hasLoss(getSide())) {
      try {
        new LossyPropagator(getDevice(),getSide()).propagate();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
 else {
      try {
        new LosslessPropagator(getDevice(),getSide()).propagate();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
    return;
  }
 else   if (getDevice() instanceof GateBase<?,?,?,?,?,?>) {
    IGateConnection c=((GateBase<?,?,?,?,?,?>)getDevice()).getConnection(getSide());
    IConnection<IRedstoneDevice> con=(IConnection<IRedstoneDevice>)getDevice().getRedstoneConnectionCache().getConnectionOnSide(getSide());
    if (c != null) {
      if (con != null && con.getB() instanceof IRedConductor && ((IRedConductor)con.getB()).hasLoss(con.getSideB())) {
        try {
          new LossyPropagator(getDevice(),getSide()).propagate();
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
 else       if (c instanceof GateConnectionDigital) {
        try {
          new LosslessPropagator(getDevice(),getSide()).propagate();
        }
 catch (        Exception ex) {
          ex.printStackTrace();
        }
      }
      return;
    }
  }
  try {
    new LosslessPropagator(getDevice(),getSide()).propagate();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 169462
Project: 169462
Buggy source:
private void propagate(IRedstoneDevice dev,ForgeDirection side,byte power){
  if (shouldPreventStackOverflows())   return;
  if ((power & 0xFF) < 0)   return;
  if ((dev.getRedstonePower(side) & 0xFF) > (power & 0xFF))   return;
  for (  Entry<IConnection<IRedstoneDevice>,Boolean> e : getPropagation(dev,side)) {
    e.getKey().getA().setRedstonePower(e.getKey().getSideA(),power);
    boolean found=false;
    for (    RedstonePropagator p : getScheduledPropagations()) {
      if (p.getDevice() == e.getKey().getB() && p.getSide() == e.getKey().getSideB()) {
        found=true;
        break;
      }
    }
    if (!found)     propagate(e.getKey().getB(),e.getKey().getSideB(),(byte)((power & 0xFF) - 1));
  }
}

Fixed version (ground truth):
private void propagate(IRedstoneDevice dev,ForgeDirection side,byte power){
  if (shouldPreventStackOverflows())   return;
  if ((power & 0xFF) < 0)   return;
  if ((dev.getRedstonePower(side) & 0xFF) > (power & 0xFF))   return;
  for (  Entry<IConnection<IRedstoneDevice>,Boolean> e : getPropagation(dev,side)) {
    e.getKey().getA().setRedstonePower(e.getKey().getSideA(),power);
    boolean found=false;
    for (    RedstonePropagator p : getScheduledPropagations()) {
      if (p.getDevice() == e.getKey().getB() && p.getSide() == e.getKey().getSideB()) {
        found=true;
        break;
      }
    }
    if (!found)     propagate(e.getKey().getB(),e.getKey().getSideB(),(byte)((power & 0xFF) - (dev instanceof IRedstoneConductor ? 1 : 0)));
  }
}
Program: 169463
Project: 169463
Buggy source:
@Override public void refesh(){
}

Fixed version (ground truth):
@Override public void refesh(){
  if (getGate().getRedstoneConnectionCache().getConnectionOnSide(getForgeDirection()) == null)   input=(byte)MathHelper.map(RedstoneHelper.getInput(getGate().getWorld(),getGate().getX(),getGate().getY(),getGate().getZ(),getForgeDirection(),getGate().getFace()),0,15,0,255);
}
Program: 169464
Project: 169464
Buggy source:
@Override public void refesh(){
}

Fixed version (ground truth):
@Override public void refesh(){
  if (getGate().getRedstoneConnectionCache().getConnectionOnSide(getForgeDirection()) == null)   input=RedstoneHelper.getInput(getGate().getWorld(),getGate().getX(),getGate().getY(),getGate().getZ(),getForgeDirection(),getGate().getFace()) > 0;
}
Program: 169465
Project: 169465
Buggy source:
@Override public void addWAILABody(List<String> text){
  super.addWAILABody(text);
}

Fixed version (ground truth):
@Override public void addWAILABody(List<String> text){
  super.addWAILABody(text);
  text.add("String_Node_Str" + (power & 0xFF));
}
Program: 169467
Project: 169467
Buggy source:
@Override public boolean canConnect(ForgeDirection side,IBundledDevice dev,ConnectionType type){
  if (dev instanceof IInsulatedRedstoneDevice)   return false;
  return type == ConnectionType.STRAIGHT && side != ForgeDirection.UNKNOWN;
}

Fixed version (ground truth):
@Override public boolean canConnect(ForgeDirection side,IBundledDevice dev,ConnectionType type){
  if (dev instanceof IInsulatedRedstoneDevice)   return false;
  if (dev instanceof TileLamp)   return false;
  return type == ConnectionType.STRAIGHT && side != ForgeDirection.UNKNOWN;
}
Program: 169468
Project: 169468
Buggy source:
public void onUpdate(){
  if (blockType instanceof BlockLampRGB) {
    int pow=0;
    if (((BlockLamp)blockType).isInverted()) {
      pow=255 - Math.min(Math.min(bundledPower[MinecraftColor.RED.ordinal()] & 0xFF,bundledPower[MinecraftColor.GREEN.ordinal()] & 0xFF),bundledPower[MinecraftColor.BLUE.ordinal()] & 0xFF);
    }
 else {
      pow=Math.max(Math.max(bundledPower[MinecraftColor.RED.ordinal()] & 0xFF,bundledPower[MinecraftColor.GREEN.ordinal()] & 0xFF),bundledPower[MinecraftColor.BLUE.ordinal()] & 0xFF);
    }
    power=(int)((pow / 256D) * 15);
    sendUpdatePacket();
  }
 else {
    int pow=RedstoneHelper.getInput(getWorldObj(),xCoord,yCoord,zCoord);
    if (pow != power) {
      power=pow;
      sendUpdatePacket();
      getWorldObj().markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
      try {
        getWorldObj().updateLightByType(EnumSkyBlock.Block,xCoord,yCoord,zCoord);
      }
 catch (      Exception ex) {
      }
      getWorldObj().notifyBlocksOfNeighborChange(xCoord,yCoord,zCoord,getBlockType());
    }
  }
}

Fixed version (ground truth):
public void onUpdate(){
  if (blockType instanceof BlockLampRGB) {
    connections.recalculateConnections();
    int connected=0;
    for (    ForgeDirection s : ForgeDirection.VALID_DIRECTIONS)     connected+=(connections.getConnectionOnSide(s) != null) ? 1 : 0;
    if (connected == 0)     bundledPower=new byte[16];
    int pow=0;
    if (((BlockLamp)blockType).isInverted()) {
      pow=255 - Math.min(Math.min(bundledPower[MinecraftColor.RED.ordinal()] & 0xFF,bundledPower[MinecraftColor.GREEN.ordinal()] & 0xFF),bundledPower[MinecraftColor.BLUE.ordinal()] & 0xFF);
    }
 else {
      pow=Math.max(Math.max(bundledPower[MinecraftColor.RED.ordinal()] & 0xFF,bundledPower[MinecraftColor.GREEN.ordinal()] & 0xFF),bundledPower[MinecraftColor.BLUE.ordinal()] & 0xFF);
    }
    power=(int)((pow / 256D) * 15);
    sendUpdatePacket();
  }
 else {
    int pow=RedstoneHelper.getInput(getWorldObj(),xCoord,yCoord,zCoord);
    if (pow != power) {
      power=pow;
      sendUpdatePacket();
      getWorldObj().markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
      try {
        getWorldObj().updateLightByType(EnumSkyBlock.Block,xCoord,yCoord,zCoord);
      }
 catch (      Exception ex) {
      }
      getWorldObj().notifyBlocksOfNeighborChange(xCoord,yCoord,zCoord,getBlockType());
    }
  }
}
Program: 169469
Project: 169469
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  super.drawGuiContainerBackgroundLayer(f,i,j);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  int burningPercentage=(int)(furnace.getBurningPercentage() * 14);
  drawTexturedModalRect(x + 22,y + 54 + 14 - burningPercentage,177,14 - burningPercentage,14,burningPercentage + 0);
  int processPercentage=(int)(furnace.getProcessPercentage() * 22);
  drawTexturedModalRect(x + 103,y + 35,178,14,processPercentage,15);
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  super.drawGuiContainerBackgroundLayer(f,i,j);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  mc.renderEngine.bindTexture(resLoc);
  int burningPercentage=(int)(furnace.getBurningPercentage() * 14);
  drawTexturedModalRect(x + 22,y + 54 + 14 - burningPercentage,177,14 - burningPercentage,14,burningPercentage + 0);
  int processPercentage=(int)(furnace.getProcessPercentage() * 22);
  drawTexturedModalRect(x + 103,y + 35,178,14,processPercentage,15);
}
Program: 169470
Project: 169470
Buggy source:
private void unloadWorld(){
  FakeWorldIC.getInstance().setIC(null);
}

Fixed version (ground truth):
public void unloadWorld(){
  FakeWorldIC.getInstance().setIC(null);
}
Program: 169471
Project: 169471
Buggy source:
private void loadWorld(){
  FakeWorldIC.getInstance().setIC(this);
}

Fixed version (ground truth):
public void loadWorld(){
  FakeWorldIC.getInstance().setIC(this);
}
Program: 169472
Project: 169472
Buggy source:
@Override public boolean canConnectBundledStraight(ForgeDirection side,IBundledDevice device){
  if (!(device instanceof IFaceBundledDevice))   if (OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))   return false;
  return WireCommons.canConnect(this,device,side,side.getOpposite());
}

Fixed version (ground truth):
@Override public boolean canConnectBundledStraight(ForgeDirection side,IBundledDevice device){
  if (!(device instanceof IFaceBundledDevice))   if (OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))   return false;
  if (device instanceof IRedstoneDevice) {
    MinecraftColor insulation=((IRedstoneDevice)device).getInsulationColor(side.getOpposite());
    MinecraftColor myInsulation=getInsulationColor(side);
    if (insulation != null && getInsulationColor(side) != null)     if (!insulation.matches(myInsulation))     return false;
  }
  return WireCommons.canConnect(this,device,side,side.getOpposite());
}
Program: 169473
Project: 169473
Buggy source:
@Override public boolean canConnectBundledOpenCorner(ForgeDirection side,IBundledDevice device){
  if (!(device instanceof IFaceBundledDevice))   if (OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))   return false;
  return WireCommons.canConnect(this,device);
}

Fixed version (ground truth):
@Override public boolean canConnectBundledOpenCorner(ForgeDirection side,IBundledDevice device){
  if (!(device instanceof IFaceBundledDevice))   if (OcclusionHelper.microblockOcclusionTest(new Vec3i(this),MicroblockShape.FACE_HOLLOW,8,side))   return false;
  if (device instanceof IRedstoneDevice) {
    MinecraftColor insulation=((IRedstoneDevice)device).getInsulationColor(side.getOpposite());
    MinecraftColor myInsulation=getInsulationColor(side);
    if (insulation != null && getInsulationColor(side) != null)     if (!insulation.matches(myInsulation))     return false;
  }
  return WireCommons.canConnect(this,device);
}
Program: 169474
Project: 169474
Buggy source:
@Override public boolean canConnectRedstone(ForgeDirection side){
  return false;
}

Fixed version (ground truth):
@Override public boolean canConnectRedstone(ForgeDirection side){
  return !bundled;
}
Program: 169475
Project: 169475
Buggy source:
@Override public void tick(){
  if (!getWorld().isRemote) {
    front().setOutput(false);
    left().setOutput(false);
    right().setOutput(false);
    t.setState(false);
    left().notifyUpdateIfNeeded();
    right().notifyUpdateIfNeeded();
  }
  if (!back().getInput() && !(!front().getOutput() && (left().getInput() || right().getInput()))) {
    p.setState(true);
    p.setIncrement(1 / (double)time);
    if (++curTime >= time) {
      if (!getWorld().isRemote) {
        front().setOutput(true);
        left().setOutput(true);
        right().setOutput(true);
        t.setState(true);
      }
      playTickSound();
      curTime=0;
    }
  }
 else {
    curTime=0;
    p.setState(false);
    p.setAngle(0);
  }
}

Fixed version (ground truth):
@Override public void tick(){
  if (!getWorld().isRemote) {
    front().setOutput(false);
    left().setOutput(false);
    right().setOutput(false);
    t.setState(false);
    left().notifyUpdateIfNeeded();
    right().notifyUpdateIfNeeded();
  }
  if (!back().getInput() && !(!front().getOutput() && (left().getInput() || right().getInput()))) {
    p.setState(true);
    p.setIncrement(1 / (double)time);
    if (++curTime >= time) {
      if (!getWorld().isRemote) {
        front().setOutput(true);
        left().setOutput(true);
        right().setOutput(true);
        t.setState(true);
        p.setAngle(0);
      }
      playTickSound();
      curTime=0;
    }
  }
 else {
    curTime=0;
    p.setState(false);
    p.setAngle(0);
  }
}
Program: 169476
Project: 169476
Buggy source:
public ItemStackDatabase(){
  saveLocation=BluePower.proxy.getSavePath() + "String_Node_Str" + DATABASE_FOLDER_NAME;
}

Fixed version (ground truth):
public ItemStackDatabase(){
  saveLocation=BluePower.proxy.getSavePath() + File.separator + DATABASE_FOLDER_NAME;
}
Program: 169477
Project: 169477
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  mc.renderEngine.bindTexture(resLoc);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  drawTexturedModalRect(x,y,0,0,xSize,ySize);
  for (  IGuiWidget widget : widgets) {
    widget.render(i,j);
  }
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float f,int i,int j){
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  mc.renderEngine.bindTexture(resLoc);
  int x=(width - xSize) / 2;
  int y=(height - ySize) / 2;
  drawTexturedModalRect(x,y,0,0,xSize,ySize);
  for (  IGuiWidget widget : widgets) {
    widget.render(i,j,f);
  }
}
Program: 169478
Project: 169478
Buggy source:
@Override public TubeStack acceptItemFromTube(TubeStack stack,ForgeDirection from,boolean simulate){
  if (from == getOutputDirection()) {
    return super.acceptItemFromTube(stack,from,simulate);
  }
 else {
    boolean success=!ItemStack.areItemStacksEqual(stack.stack,nonAcceptedStack) && tryProcessItem(stack.stack,simulate);
    if (success) {
      nonAcceptedStack=stack.stack;
      if (stack.stack.stackSize <= 0) {
        return null;
      }
 else {
        return stack;
      }
    }
 else {
      return stack;
    }
  }
}

Fixed version (ground truth):
@Override public TubeStack acceptItemFromTube(TubeStack stack,ForgeDirection from,boolean simulate){
  if (from == getOutputDirection()) {
    return super.acceptItemFromTube(stack,from,simulate);
  }
 else   if (!isBufferEmpty() && !ejectionScheduled) {
    return stack;
  }
 else {
    boolean success=!ItemStack.areItemStacksEqual(stack.stack,nonAcceptedStack) && tryProcessItem(stack.stack,simulate);
    if (success) {
      nonAcceptedStack=stack.stack;
      if (stack.stack.stackSize <= 0) {
        return null;
      }
 else {
        return stack;
      }
    }
 else {
      return stack;
    }
  }
}
Program: 169479
Project: 169479
Buggy source:
private void ejectItems(){
  for (Iterator<TubeStack> iterator=internalItemStackBuffer.iterator(); iterator.hasNext(); ) {
    TubeStack tubeStack=iterator.next();
    if (IOHelper.canInterfaceWith(getTileCache(getOutputDirection()),getFacingDirection())) {
      ItemStack returnedStack=IOHelper.insert(getTileCache(getOutputDirection()),tubeStack.stack,getFacingDirection(),tubeStack.color,false);
      if (returnedStack == null) {
        iterator.remove();
        markDirty();
        if (!ejectionScheduled)         break;
      }
 else       if (returnedStack.stackSize != tubeStack.stack.stackSize) {
        markDirty();
        if (!ejectionScheduled)         break;
      }
 else {
        break;
      }
    }
 else     if (spawnItemsInWorld) {
      ForgeDirection direction=getFacingDirection().getOpposite();
      if (worldObj.isAirBlock(xCoord + direction.offsetX,yCoord + direction.offsetY,zCoord + direction.offsetZ)) {
        ejectItemInWorld(tubeStack.stack,direction);
        iterator.remove();
        markDirty();
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void ejectItems(){
  for (Iterator<TubeStack> iterator=internalItemStackBuffer.iterator(); iterator.hasNext(); ) {
    TubeStack tubeStack=iterator.next();
    if (IOHelper.canInterfaceWith(getTileCache(getOutputDirection()),getFacingDirection())) {
      ItemStack returnedStack=IOHelper.insert(getTileCache(getOutputDirection()),tubeStack.stack,getFacingDirection(),tubeStack.color,false);
      if (returnedStack == null) {
        iterator.remove();
        markDirty();
        if (!ejectionScheduled)         break;
      }
 else       if (returnedStack.stackSize != tubeStack.stack.stackSize) {
        markDirty();
        if (!ejectionScheduled)         break;
      }
 else {
        break;
      }
    }
 else     if (spawnItemsInWorld) {
      ForgeDirection direction=getFacingDirection().getOpposite();
      if (worldObj.getBlock(xCoord + direction.offsetX,yCoord + direction.offsetY,zCoord + direction.offsetZ).getBlocksMovement(worldObj,xCoord + direction.offsetX,yCoord + direction.offsetY,zCoord + direction.offsetZ)) {
        ejectItemInWorld(tubeStack.stack,direction);
        iterator.remove();
        markDirty();
      }
 else {
        break;
      }
    }
  }
}