nus-yam/ex-repair huggingface dataset:
Program: 156905
Project: 156905
Buggy source:
private BlueprintId save(BlueprintBase blueprint){
  NBTTagCompound nbt=new NBTTagCompound();
  blueprint.writeToNBT(nbt);
  ByteBuf buf=Unpooled.buffer();
  Utils.writeNBT(buf,nbt);
  byte[] data=new byte[buf.readableBytes()];
  buf.readBytes(data);
  blueprint.id.generateUniqueId(data);
  BlueprintId id=blueprint.id;
  File blueprintFile=new File(blueprintFolder,String.format(Locale.ENGLISH,"String_Node_Str" + fileExt,id.toString()));
  if (!blueprintFile.exists()) {
    OutputStream gzOs=null;
    try {
      CompressedStreamTools.writeCompressed(nbt,new FileOutputStream(blueprintFile));
    }
 catch (    IOException ex) {
      Logger.getLogger("String_Node_Str").log(Level.SEVERE,String.format("String_Node_Str",blueprintFile.getName(),ex.getMessage()));
    }
 finally {
      try {
        if (gzOs != null)         gzOs.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return id;
}

Fixed version (ground truth):
private BlueprintId save(BlueprintBase blueprint){
  blueprint.id.generateUniqueId(blueprint.getData());
  BlueprintId id=blueprint.id;
  File blueprintFile=new File(blueprintFolder,String.format(Locale.ENGLISH,"String_Node_Str" + fileExt,id.toString()));
  if (!blueprintFile.exists()) {
    OutputStream gzOs=null;
    try {
      FileOutputStream f=new FileOutputStream(blueprintFile);
      f.write(blueprint.getData());
      f.close();
    }
 catch (    IOException ex) {
      Logger.getLogger("String_Node_Str").log(Level.SEVERE,String.format("String_Node_Str",blueprintFile.getName(),ex.getMessage()));
    }
 finally {
      try {
        if (gzOs != null) {
          gzOs.close();
        }
      }
 catch (      IOException e) {
      }
    }
  }
  return id;
}
Program: 156906
Project: 156906
Buggy source:
/** 
 * Called to update the entity's position/logic.
 */
@Override public void onUpdate(){
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  this.motionY-=(double)this.particleGravity;
  if (this.bobTimer-- > 0) {
    this.motionX*=0.02D;
    this.motionY*=0.02D;
    this.motionZ*=0.02D;
    this.setParticleTextureIndex(113);
  }
 else {
    this.setParticleTextureIndex(112);
  }
  this.moveEntity(this.motionX,this.motionY,this.motionZ);
  this.motionX*=0.9800000190734863D;
  this.motionY*=0.9800000190734863D;
  this.motionZ*=0.9800000190734863D;
  if (this.particleMaxAge-- <= 0) {
    this.setDead();
  }
  if (this.onGround) {
    this.setParticleTextureIndex(114);
    this.motionX*=0.699999988079071D;
    this.motionZ*=0.699999988079071D;
  }
  int x=MathHelper.floor_double(this.posX);
  int y=MathHelper.floor_double(this.posY);
  int z=MathHelper.floor_double(this.posZ);
  Block block=worldObj.getBlock(x,y,z);
  Material material=block.getMaterial();
  if (material.isLiquid() || material.isSolid()) {
    double d0=(double)((float)(MathHelper.floor_double(this.posY) + 1) - ((BlockFluidBase)block).getFilledPercentage(worldObj,x,y,z));
    if (this.posY < d0) {
      this.setDead();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called to update the entity's position/logic.
 */
@Override public void onUpdate(){
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  this.motionY-=(double)this.particleGravity;
  if (this.bobTimer-- > 0) {
    this.motionX*=0.02D;
    this.motionY*=0.02D;
    this.motionZ*=0.02D;
    this.setParticleTextureIndex(113);
  }
 else {
    this.setParticleTextureIndex(112);
  }
  this.moveEntity(this.motionX,this.motionY,this.motionZ);
  this.motionX*=0.9800000190734863D;
  this.motionY*=0.9800000190734863D;
  this.motionZ*=0.9800000190734863D;
  if (this.particleMaxAge-- <= 0) {
    this.setDead();
  }
  if (this.onGround) {
    this.setParticleTextureIndex(114);
    this.motionX*=0.699999988079071D;
    this.motionZ*=0.699999988079071D;
  }
  int x=MathHelper.floor_double(this.posX);
  int y=MathHelper.floor_double(this.posY);
  int z=MathHelper.floor_double(this.posZ);
  Block block=worldObj.getBlock(x,y,z);
  Material material=block.getMaterial();
  if ((material.isLiquid() || material.isSolid()) && block instanceof IFluidBlock) {
    double d0=(double)((float)(MathHelper.floor_double(this.posY) + 1) - ((IFluidBlock)block).getFilledPercentage(worldObj,x,y,z));
    if (this.posY < d0) {
      this.setDead();
    }
  }
}
Program: 156907
Project: 156907
Buggy source:
public void sendToPlayers(Packet packet,World world,int x,int y,int z,int maxDistance){
  channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
  channels.get(Side.SERVER).writeOutbound(packet);
}

Fixed version (ground truth):
public void sendToPlayers(BuildCraftPacket packet,World world,int x,int y,int z,int maxDistance){
  channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
  channels.get(Side.SERVER).writeOutbound(packet);
}
Program: 156908
Project: 156908
Buggy source:
private boolean testStrings(String[] excludedBlocks,World world,int i,int j,int k){
  Block block=world.getBlock(i,j,k);
  if (block == null)   return false;
  int meta=world.getBlockMetadata(i,j,k);
  for (  String excluded : excludedBlocks) {
    if (excluded.equals(block.getUnlocalizedName()))     return false;
    String[] tokens=excluded.split("String_Node_Str");
    if (tokens[0].equals(Integer.toString(id)) && (tokens.length == 1 || tokens[1].equals(Integer.toString(meta))))     return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean testStrings(String[] excludedBlocks,World world,int i,int j,int k){
  Block block=world.getBlock(i,j,k);
  if (block == null)   return false;
  int meta=world.getBlockMetadata(i,j,k);
  return true;
}
Program: 156909
Project: 156909
Buggy source:
@Override public int hashCode(){
  int hash=5;
  hash=67 * hash + stack.itemID;
  hash=67 * hash + stack.getItemDamage();
  if (stack.stackTagCompound != null)   hash=67 * hash + stack.stackTagCompound.hashCode();
  return hash;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hash=5;
  hash=67 * hash + Item.itemRegistry.getIDForObject(stack.getItem());
  hash=67 * hash + stack.getItemDamage();
  if (stack.stackTagCompound != null)   hash=67 * hash + stack.stackTagCompound.hashCode();
  return hash;
}
Program: 156910
Project: 156910
Buggy source:
public BlockMarker(){
  super(Material.circuits);
  setLightValue(0.5F);
  setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}

Fixed version (ground truth):
public BlockMarker(){
  super(Material.circuits);
  setLightLevel(0.5F);
  setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
Program: 156911
Project: 156911
Buggy source:
@Override public void initialize(){
  super.initialize();
  if (CoreProxy.proxy.isRenderWorld(worldObj))   return;
  for (int x=xCoord - 1; x <= xCoord + 1; ++x) {
    for (int y=yCoord - 1; y <= yCoord + 1; ++y) {
      for (int z=zCoord - 1; z <= zCoord + 1; ++z) {
        TileEntity tile=worldObj.getTileEntity(x,y,z);
        if (tile instanceof TilePathMarker) {
          path=((TilePathMarker)tile).getPath();
          for (          BlockIndex b : path) {
            worldObj.setBlock(b.x,b.y,b.z,null);
            BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(worldObj,b.x,b.y,b.z,BuildCraftBuilders.pathMarkerBlock,0);
          }
          break;
        }
      }
    }
  }
  if (path != null && pathLasers == null) {
    path.getFirst().x=xCoord;
    path.getFirst().y=yCoord;
    path.getFirst().z=zCoord;
    createLasersForPath();
  }
  iterateBpt();
}

Fixed version (ground truth):
@Override public void initialize(){
  super.initialize();
  if (CoreProxy.proxy.isRenderWorld(worldObj))   return;
  for (int x=xCoord - 1; x <= xCoord + 1; ++x) {
    for (int y=yCoord - 1; y <= yCoord + 1; ++y) {
      for (int z=zCoord - 1; z <= zCoord + 1; ++z) {
        TileEntity tile=worldObj.getTileEntity(x,y,z);
        if (tile instanceof TilePathMarker) {
          path=((TilePathMarker)tile).getPath();
          for (          BlockIndex b : path) {
            worldObj.setBlock(b.x,b.y,b.z,null);
            BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(worldObj,b.x,b.y,b.z,0,0);
          }
          break;
        }
      }
    }
  }
  if (path != null && pathLasers == null) {
    path.getFirst().x=xCoord;
    path.getFirst().y=yCoord;
    path.getFirst().z=zCoord;
    createLasersForPath();
  }
  iterateBpt();
}
Program: 156912
Project: 156912
Buggy source:
private static void breakBlock(World world,int x,int y,int z){
  Block block=world.getBlock(x,y,z);
  if (block != null)   world.playSoundEffect(x + 0.5F,y + 0.5F,z + 0.5F,block.stepSound.getPlaceSound(),(block.stepSound.getVolume() + 1.0F) / 2.0F,block.stepSound.getPitch() * 0.8F);
  if (BuildCraftBuilders.fillerDestroy) {
    world.setBlockToAir(x,y,z);
  }
 else   if (BlockUtil.isToughBlock(world,x,y,z)) {
    BlockUtil.breakBlock(world,x,y,z,BuildCraftBuilders.fillerLifespanTough);
  }
 else {
    BlockUtil.breakBlock(world,x,y,z,BuildCraftBuilders.fillerLifespanNormal);
  }
}

Fixed version (ground truth):
private static void breakBlock(World world,int x,int y,int z){
  Block block=world.getBlock(x,y,z);
  if (block != null) {
  }
  if (BuildCraftBuilders.fillerDestroy) {
    world.setBlockToAir(x,y,z);
  }
 else   if (BlockUtil.isToughBlock(world,x,y,z)) {
    BlockUtil.breakBlock(world,x,y,z,BuildCraftBuilders.fillerLifespanTough);
  }
 else {
    BlockUtil.breakBlock(world,x,y,z,BuildCraftBuilders.fillerLifespanNormal);
  }
}
Program: 156913
Project: 156913
Buggy source:
public BlockSpring(){
  super(Material.rock);
  setBlockUnbreakable();
  setResistance(6000000.0F);
  setStepSound(soundStoneFootstep);
  disableStats();
  setTickRandomly(true);
  setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}

Fixed version (ground truth):
public BlockSpring(){
  super(Material.rock);
  setBlockUnbreakable();
  setResistance(6000000.0F);
  disableStats();
  setTickRandomly(true);
  setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
Program: 156914
Project: 156914
Buggy source:
@SideOnly(Side.CLIENT) @SubscribeEvent public void tickEnd(PlayerTickEvent evt){
  if (nagged) {
    return;
  }
  EntityPlayer player=evt.player;
  if (Version.needsUpdateNoticeAndMarkAsSeen()) {
    player.addChatMessage(String.format("String_Node_Str",Version.getRecommendedVersion(),CoreProxy.proxy.getMinecraftVersion()));
    for (    String updateLine : Version.getChangelog()) {
      player.addChatMessage("String_Node_Str" + updateLine);
    }
    player.addChatMessage("String_Node_Str");
  }
  nagged=true;
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @SubscribeEvent public void tickEnd(PlayerTickEvent evt){
  if (nagged) {
    return;
  }
  EntityPlayer player=evt.player;
  if (Version.needsUpdateNoticeAndMarkAsSeen()) {
    player.addChatMessage(new ChatComponentText(String.format("String_Node_Str",Version.getRecommendedVersion(),CoreProxy.proxy.getMinecraftVersion())));
    for (    String updateLine : Version.getChangelog()) {
      player.addChatMessage(new ChatComponentText("String_Node_Str" + updateLine));
    }
    player.addChatMessage(new ChatComponentText("String_Node_Str"));
  }
  nagged=true;
}
Program: 156915
Project: 156915
Buggy source:
@Override public Packet getDescriptionPacket(){
  return new PacketTileUpdate(this).getPacket();
}

Fixed version (ground truth):
@Override public Packet getDescriptionPacket(){
  return null;
}
Program: 156916
Project: 156916
Buggy source:
@Override public Packet getUpdatePacket(){
  return new PacketTileUpdate(this).getPacket();
}

Fixed version (ground truth):
@Override public BuildCraftPacket getUpdatePacket(){
  return new PacketTileUpdate(this);
}
Program: 156917
Project: 156917
Buggy source:
@Override public void handleDescriptionPacket(PacketUpdate packet) throws IOException {
  if (packet.payload instanceof PacketPayloadArrays)   descriptionPacket.fromPayload(this,(PacketPayloadArrays)packet.payload);
}

Fixed version (ground truth):
@Override public void handleDescriptionPacket(PacketUpdate packet) throws IOException {
  if (packet.payload instanceof PacketPayloadArrays) {
    descriptionPacket.fromPayload(this,(PacketPayloadArrays)packet.payload);
  }
}
Program: 156918
Project: 156918
Buggy source:
public void handleWidgetClientData(int widgetId,DataInputStream data) throws IOException {
  widgets.get(widgetId).handleClientPacketData(data);
}

Fixed version (ground truth):
public void handleWidgetClientData(int widgetId,ByteBuf data){
  InputStream input=new ByteBufInputStream(data);
  DataInputStream stream=new DataInputStream(input);
  try {
    widgets.get(widgetId).handleClientPacketData(stream);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 156919
Project: 156919
Buggy source:
public void sendWidgetDataToClient(Widget widget,ICrafting player,byte[] data){
  PacketGuiWidget pkt=new PacketGuiWidget(windowId,widgets.indexOf(widget),data);
  PacketDispatcher.sendPacketToPlayer(pkt.getPacket(),(Player)player);
}

Fixed version (ground truth):
public void sendWidgetDataToClient(Widget widget,ICrafting player,byte[] data){
  PacketGuiWidget pkt=new PacketGuiWidget(windowId,widgets.indexOf(widget),data);
  BuildCraftCore.instance.sendToPlayer((EntityPlayer)player,pkt);
}
Program: 156920
Project: 156920
Buggy source:
public void drawStack(ItemStack item){
  if (item != null) {
    int cornerX=(width - xSize) / 2;
    int cornerY=(height - ySize) / 2;
    itemRenderer.zLevel=200F;
    itemRenderer.renderItemAndEffectIntoGUI(fontRendererObj,mc.renderEngine,item,cornerX + x,cornerY + y);
    itemRenderer.renderItemOverlayIntoGUI(fontRendererObj,mc.renderEngine,item,cornerX + x,cornerY + y);
    itemRenderer.zLevel=0.0F;
  }
}

Fixed version (ground truth):
public void drawStack(ItemStack item){
  if (item != null) {
    int cornerX=(width - xSize) / 2;
    int cornerY=(height - ySize) / 2;
    itemRender.zLevel=200F;
    itemRender.renderItemAndEffectIntoGUI(fontRendererObj,mc.renderEngine,item,cornerX + x,cornerY + y);
    itemRender.renderItemOverlayIntoGUI(fontRendererObj,mc.renderEngine,item,cornerX + x,cornerY + y);
    itemRender.zLevel=0.0F;
  }
}
Program: 156922
Project: 156922
Buggy source:
public static ItemStack consumeItem(ItemStack stack){
  if (stack.stackSize == 1) {
    if (stack.getItem().hasContainerItem()) {
      return stack.getItem().getContainerItemStack(stack);
    }
 else {
      return null;
    }
  }
 else {
    stack.splitStack(1);
    return stack;
  }
}

Fixed version (ground truth):
public static ItemStack consumeItem(ItemStack stack){
  if (stack.stackSize == 1) {
    if (stack.getItem().hasContainerItem()) {
      return stack.getItem().getContainerItem(stack);
    }
 else {
      return null;
    }
  }
 else {
    stack.splitStack(1);
    return stack;
  }
}
Program: 156923
Project: 156923
Buggy source:
public Packet getUpdatePacket();

Fixed version (ground truth):
public BuildCraftPacket getUpdatePacket();
Program: 156924
Project: 156924
Buggy source:
public void sendPacket(){
  PacketDispatcher.sendPacketToServer(getPacket());
}

Fixed version (ground truth):
public void sendPacket(){
  BuildCraftCore.instance.sendToServer(this);
}
Program: 156925
Project: 156925
Buggy source:
public static boolean placePipe(Pipe pipe,World world,int i,int j,int k,int blockId,int meta){
  if (world.isRemote)   return true;
  boolean placed=world.setBlock(i,j,k,blockId,meta,1);
  if (placed) {
    TileGenericPipe tile=(TileGenericPipe)world.getBlockTileEntity(i,j,k);
    tile.initialize(pipe);
  }
  return placed;
}

Fixed version (ground truth):
public static boolean placePipe(Pipe pipe,World world,int i,int j,int k,int blockId,int meta){
  if (world.isRemote)   return true;
  boolean placed=world.setBlock(i,j,k,blockId,meta,1);
  if (placed) {
    TileGenericPipe tile=(TileGenericPipe)world.getBlockTileEntity(i,j,k);
    tile.initialize(pipe);
    tile.sendUpdateToClient();
  }
  return placed;
}
Program: 156926
Project: 156926
Buggy source:
public static ResourceLocation getFluidSheet(Fluid liquid){
  if (liquid.canBePlacedInWorld())   return BLOCK_TEXTURE;
 else   return ITEM_TEXTURE;
}

Fixed version (ground truth):
public static ResourceLocation getFluidSheet(Fluid liquid){
  return BLOCK_TEXTURE;
}
Program: 156927
Project: 156927
Buggy source:
public static ResourceLocation getFluidSheet(Fluid liquid){
  return BLOCK_TEXTURE;
}

Fixed version (ground truth):
public static ResourceLocation getFluidSheet(Fluid liquid){
  if (liquid.canBePlacedInWorld())   return BLOCK_TEXTURE;
 else   return ITEM_TEXTURE;
}
Program: 156928
Project: 156928
Buggy source:
@Override public float getPistonSpeed(){
  if (CoreProxy.proxy.isSimulating(worldObj))   return Math.max(0.8f * getHeatLevel(),0.01f);
switch (getEnergyStage()) {
case BLUE:
    return 0.01F;
case GREEN:
  return 0.02F;
case YELLOW:
return 0.04F;
case RED:
return 0.08F;
default :
return 0;
}
}

Fixed version (ground truth):
@Override public float getPistonSpeed(){
  if (CoreProxy.proxy.isSimulating(worldObj))   return Math.max(0.08f * getHeatLevel(),0.01f);
switch (getEnergyStage()) {
case GREEN:
    return 0.02F;
case YELLOW:
  return 0.04F;
case RED:
return 0.08F;
default :
return 0.01F;
}
}
Program: 156929
Project: 156929
Buggy source:
@Override public float maxEnergyExtracted(){
  return 1;
}

Fixed version (ground truth):
@Override public float maxEnergyExtracted(){
  return 1 + PowerHandler.PerditionCalculator.MIN_POWERLOSS;
}
Program: 156930
Project: 156930
Buggy source:
@Override public void engineUpdate(){
  super.engineUpdate();
  if (isRedstonePowered)   if (worldObj.getTotalWorldTime() % 20 == 0)   addEnergy(1);
}

Fixed version (ground truth):
@Override public void engineUpdate(){
  super.engineUpdate();
  if (isRedstonePowered)   if (worldObj.getTotalWorldTime() % 16 == 0)   addEnergy(1);
}
Program: 156933
Project: 156933
Buggy source:
public static PacketPayload makePayload(int type){
  if (type == Type.ARRAY.ordinal())   return new PacketPayloadArrays();
  if (type == Type.STREAM.ordinal())   return null;
  return null;
}

Fixed version (ground truth):
public static PacketPayload makePayload(int type){
  if (type == Type.ARRAY.ordinal())   return new PacketPayloadArrays();
  if (type == Type.STREAM.ordinal())   return new PacketPayloadStream();
  return null;
}
Program: 156934
Project: 156934
Buggy source:
@Override public void registerBlockRenderers(){
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,0),new RenderEngine(DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str"));
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,1),new RenderEngine(DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str"));
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,2),new RenderEngine(DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str"));
}

Fixed version (ground truth):
@Override public void registerBlockRenderers(){
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,0),new RenderEngine(TileEngine.WOOD_TEXTURE));
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,1),new RenderEngine(TileEngine.STONE_TEXTURE));
  RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock,2),new RenderEngine(TileEngine.IRON_TEXTURE));
}
Program: 156935
Project: 156935
Buggy source:
public abstract String getTextureFile();

Fixed version (ground truth):
public abstract ResourceLocation getTextureFile();
Program: 156936
Project: 156936
Buggy source:
@Override public String getTextureFile(){
  return DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str";
}

Fixed version (ground truth):
@Override public ResourceLocation getTextureFile(){
  return IRON_TEXTURE;
}
Program: 156937
Project: 156937
Buggy source:
@Override public String getTextureFile(){
  return DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str";
}

Fixed version (ground truth):
@Override public ResourceLocation getTextureFile(){
  return WOOD_TEXTURE;
}
Program: 156938
Project: 156938
Buggy source:
@Override public String getTextureFile(){
  return DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str";
}

Fixed version (ground truth):
@Override public ResourceLocation getTextureFile(){
  return STONE_TEXTURE;
}
Program: 156939
Project: 156939
Buggy source:
@Override public String getTextureFile(){
  return DefaultProps.TEXTURE_PATH_BLOCKS + "String_Node_Str";
}

Fixed version (ground truth):
@Override public ResourceLocation getTextureFile(){
  return WOOD_TEXTURE;
}
Program: 156940
Project: 156940
Buggy source:
public RenderEngine(String baseTexture){
  this();
  this.baseTexture=baseTexture;
  setTileEntityRenderer(TileEntityRenderer.instance);
}

Fixed version (ground truth):
public RenderEngine(ResourceLocation baseTexture){
  this();
  this.baseTexture=baseTexture;
  setTileEntityRenderer(TileEntityRenderer.instance);
}
Program: 156942
Project: 156942
Buggy source:
@Override public void handleUpdatePacket(PacketUpdate packet) throws IOException {
  if (packet.payload != null) {
    DataInputStream stream=((PacketPayloadStream)packet.payload).stream;
    animationSpeed=stream.readFloat();
    tankManager.readData(stream);
  }
}

Fixed version (ground truth):
@Override public void handleUpdatePacket(PacketUpdate packet) throws IOException {
  DataInputStream stream=((PacketPayloadStream)packet.payload).stream;
  animationSpeed=stream.readFloat();
  tankManager.readData(stream);
}
Program: 156943
Project: 156943
Buggy source:
@Override protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
  nbttagcompound.setDouble("String_Node_Str",iSize);
  nbttagcompound.setDouble("String_Node_Str",jSize);
  nbttagcompound.setDouble("String_Node_Str",kSize);
}

Fixed version (ground truth):
@Override protected void writeEntityToNBT(NBTTagCompound data){
  data.setDouble("String_Node_Str",iSize);
  data.setDouble("String_Node_Str",jSize);
  data.setDouble("String_Node_Str",kSize);
}
Program: 156944
Project: 156944
Buggy source:
@Override public int getBrightnessForRender(float par1){
  return 210;
}

Fixed version (ground truth):
@Override public int getBrightnessForRender(float par1){
  return brightness > 0 ? brightness : super.getBrightnessForRender(par1);
}
Program: 156945
Project: 156945
Buggy source:
@Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
  iSize=nbttagcompound.getDouble("String_Node_Str");
  jSize=nbttagcompound.getDouble("String_Node_Str");
  kSize=nbttagcompound.getDouble("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void readEntityFromNBT(NBTTagCompound data){
  iSize=data.getDouble("String_Node_Str");
  jSize=data.getDouble("String_Node_Str");
  kSize=data.getDouble("String_Node_Str");
}
Program: 156946
Project: 156946
Buggy source:
public static EntityBlock createLaser(World world,Position p1,Position p2,LaserKind kind){
  if (p1.equals(p2)) {
    return null;
  }
  double iSize=p2.x - p1.x;
  double jSize=p2.y - p1.y;
  double kSize=p2.z - p1.z;
  double i=p1.x;
  double j=p1.y;
  double k=p1.z;
  if (iSize != 0) {
    i+=0.5;
    j+=0.45;
    k+=0.45;
    jSize=0.10;
    kSize=0.10;
  }
 else   if (jSize != 0) {
    i+=0.45;
    j+=0.5;
    k+=0.45;
    iSize=0.10;
    kSize=0.10;
  }
 else   if (kSize != 0) {
    i+=0.45;
    j+=0.45;
    k+=0.5;
    iSize=0.10;
    jSize=0.10;
  }
  EntityBlock block=CoreProxy.proxy.newEntityBlock(world,i,j,k,iSize,jSize,kSize,kind);
  world.spawnEntityInWorld(block);
  return block;
}

Fixed version (ground truth):
public static EntityBlock createLaser(World world,Position p1,Position p2,LaserKind kind){
  if (p1.equals(p2)) {
    return null;
  }
  double iSize=p2.x - p1.x;
  double jSize=p2.y - p1.y;
  double kSize=p2.z - p1.z;
  double i=p1.x;
  double j=p1.y;
  double k=p1.z;
  if (iSize != 0) {
    i+=0.5;
    j+=0.45;
    k+=0.45;
    jSize=0.10;
    kSize=0.10;
  }
 else   if (jSize != 0) {
    i+=0.45;
    j+=0.5;
    k+=0.45;
    iSize=0.10;
    kSize=0.10;
  }
 else   if (kSize != 0) {
    i+=0.45;
    j+=0.45;
    k+=0.5;
    iSize=0.10;
    jSize=0.10;
  }
  EntityBlock block=CoreProxy.proxy.newEntityBlock(world,i,j,k,iSize,jSize,kSize,kind);
  block.setBrightness(210);
  world.spawnEntityInWorld(block);
  return block;
}
Program: 156947
Project: 156947
Buggy source:
public long durationOfLastDelay(){
  return duration;
}

Fixed version (ground truth):
public long durationOfLastDelay(){
  return marked ? duration : 0;
}
Program: 156948
Project: 156948
Buggy source:
/** 
 * Return true if a given delay has passed since last time marked was called successfully.
 */
public boolean markTimeIfDelay(World world,long delay){
  if (world == null)   return false;
  long currentTime=world.getWorldTime();
  if (currentTime < lastMark) {
    lastMark=currentTime;
    return false;
  }
 else   if (lastMark + delay <= currentTime) {
    duration=currentTime - lastMark;
    lastMark=world.getWorldTime();
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
/** 
 * Return true if a given delay has passed since last time marked was called successfully.
 */
public boolean markTimeIfDelay(World world,long delay){
  if (world == null)   return false;
  long currentTime=world.getWorldTime();
  if (currentTime < lastMark) {
    lastMark=currentTime;
    return false;
  }
 else   if (lastMark + delay <= currentTime) {
    duration=currentTime - lastMark;
    lastMark=world.getWorldTime();
    marked=true;
    return true;
  }
 else   return false;
}
Program: 156949
Project: 156949
Buggy source:
private void applyPerdition(){
  if (energyStored > 0) {
    if (perditionTracker.markTimeIfDelay(receptor.getWorldObj(),1)) {
      for (int i=0; i < perditionTracker.durationOfLastDelay(); i++) {
        float newEnergy=getPerdition().applyPerdition(this,energyStored);
        if (newEnergy == 0 || newEnergy < energyStored) {
          energyStored=newEnergy;
        }
 else {
          energyStored=DEFUALT_PERDITION.applyPerdition(this,energyStored);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void applyPerdition(){
  if (perditionTracker.markTimeIfDelay(receptor.getWorldObj(),1) && energyStored > 0) {
    float newEnergy=getPerdition().applyPerdition(this,energyStored,perditionTracker.durationOfLastDelay());
    if (newEnergy == 0 || newEnergy < energyStored) {
      energyStored=newEnergy;
    }
 else {
      energyStored=DEFUALT_PERDITION.applyPerdition(this,energyStored,perditionTracker.durationOfLastDelay());
    }
    validateEnergy();
  }
}
Program: 156950
Project: 156950
Buggy source:
public void setPerdition(PerditionCalculator perdition){
  this.perdition=perdition;
}

Fixed version (ground truth):
/** 
 * Allows you to define a new PerditionCalculator class to handler perdition calculations. For example if you want exponentially increasing loss bases on amount stored.
 * @param perdition
 */
public void setPerdition(PerditionCalculator perdition){
  this.perdition=perdition;
}
Program: 156951
Project: 156951
Buggy source:
/** 
 * Extract energy from the PowerHandler. You must call this even if doWork() triggers.
 * @param min
 * @param max
 * @param doUse
 * @return amount used
 */
public float useEnergy(float min,float max,boolean doUse){
  float result=0;
  if (energyStored >= min) {
    if (energyStored <= max) {
      result=energyStored;
      if (doUse) {
        energyStored=0;
      }
    }
 else {
      result=max;
      if (doUse) {
        energyStored-=max;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Extract energy from the PowerHandler. You must call this even if doWork() triggers.
 * @param min
 * @param max
 * @param doUse
 * @return amount used
 */
public float useEnergy(float min,float max,boolean doUse){
  applyPerdition();
  float result=0;
  if (energyStored >= min) {
    if (energyStored <= max) {
      result=energyStored;
      if (doUse) {
        energyStored=0;
      }
    }
 else {
      result=max;
      if (doUse) {
        energyStored-=max;
      }
    }
  }
  validateEnergy();
  return result;
}
Program: 156952
Project: 156952
Buggy source:
public void configurePowerPerdition(int powerLoss,int powerLossRegularity){
  if (powerLoss == 0 || powerLossRegularity == 0) {
    perdition=new PerditionCalculator(0);
    return;
  }
  perdition=new PerditionCalculator((float)powerLoss / (float)powerLossRegularity * 10.0F);
}

Fixed version (ground truth):
public void configurePowerPerdition(int powerLoss,int powerLossRegularity){
  if (powerLoss == 0 || powerLossRegularity == 0) {
    perdition=new PerditionCalculator(0);
    return;
  }
  perdition=new PerditionCalculator((float)powerLoss / (float)powerLossRegularity);
}
Program: 156953
Project: 156953
Buggy source:
public void setEnergy(float quantity){
  this.energyStored=quantity;
  if (energyStored > maxEnergyStored) {
    energyStored=maxEnergyStored;
  }
 else   if (energyStored < 0) {
    energyStored=0;
  }
}

Fixed version (ground truth):
public void setEnergy(float quantity){
  this.energyStored=quantity;
  validateEnergy();
}
Program: 156955
Project: 156955
Buggy source:
@Override public void engineUpdate(){
  final ItemStack stack=getStackInSlot(0);
  if (stack != null) {
    LiquidStack liquid=LiquidContainerRegistry.getLiquidForFilledItem(stack);
    if (liquid == null && heat > IDEAL_HEAT) {
      liquid=IronEngineCoolant.getLiquidCoolant(stack);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        setInventorySlotContents(0,Utils.consumeItem(stack));
      }
    }
  }
  if (heat > IDEAL_HEAT) {
    float extraHeat=heat - IDEAL_HEAT;
    LiquidStack coolant=this.coolantTank.getLiquid();
    Coolant currentCoolant=IronEngineCoolant.getCoolant(coolant);
    if (currentCoolant != null) {
      float cooling=currentCoolant.getDegreesCoolingPerMB(heat);
      if (coolant.amount * cooling > extraHeat) {
        coolant.amount-=Math.round(extraHeat / cooling);
        heat=IDEAL_HEAT;
      }
 else {
        heat-=coolant.amount * cooling;
        coolantTank.setLiquid(null);
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !isRedstonePowered)) {
    heat-=COOLDOWN_RATE;
  }
  if (heat <= MIN_HEAT) {
    heat=MIN_HEAT;
  }
  if (heat <= MIN_HEAT && penaltyCooling > 0) {
    penaltyCooling--;
  }
}

Fixed version (ground truth):
@Override public void engineUpdate(){
  final ItemStack stack=getStackInSlot(0);
  if (stack != null) {
    LiquidStack liquid=LiquidContainerRegistry.getLiquidForFilledItem(stack);
    if (liquid == null && heat > IDEAL_HEAT) {
      liquid=IronEngineCoolant.getLiquidCoolant(stack);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        setInventorySlotContents(0,Utils.consumeItem(stack));
      }
    }
  }
  if (heat > IDEAL_HEAT) {
    float extraHeat=heat - IDEAL_HEAT;
    LiquidStack coolant=this.coolantTank.getLiquid();
    Coolant currentCoolant=IronEngineCoolant.getCoolant(coolant);
    if (currentCoolant != null) {
      float cooling=currentCoolant.getDegreesCoolingPerMB(heat);
      if (coolant.amount * cooling > extraHeat) {
        coolant.amount-=Math.round(extraHeat / cooling);
        heat=IDEAL_HEAT;
      }
 else {
        heat-=coolant.amount * cooling;
        coolantTank.setLiquid(null);
      }
    }
  }
  if (heat > MIN_HEAT && (penaltyCooling > 0 || !isRedstonePowered)) {
    heat-=COOLDOWN_RATE;
  }
  if (heat <= MIN_HEAT) {
    heat=MIN_HEAT;
  }
  if (heat <= MIN_HEAT && penaltyCooling > 0) {
    penaltyCooling--;
  }
}
Program: 156957
Project: 156957
Buggy source:
@Override public void engineUpdate(){
  final ItemStack stack=getStackInSlot(0);
  if (stack != null) {
    LiquidStack liquid=LiquidContainerRegistry.getLiquidForFilledItem(stack);
    if (liquid == null && heat > IDEAL_HEAT) {
      liquid=IronEngineCoolant.getLiquidCoolant(stack);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        setInventorySlotContents(0,Utils.consumeItem(stack));
      }
    }
  }
  if (heat > IDEAL_HEAT) {
    float extraHeat=heat - IDEAL_HEAT;
    LiquidStack coolant=this.coolantTank.getLiquid();
    Coolant currentCoolant=IronEngineCoolant.getCoolant(coolant);
    if (currentCoolant != null) {
      float cooling=currentCoolant.getDegreesCoolingPerMB(heat);
      if (coolant.amount * cooling > extraHeat) {
        coolant.amount-=Math.round(extraHeat / cooling);
        heat=IDEAL_HEAT;
      }
 else {
        heat-=coolant.amount * cooling;
        coolantTank.setLiquid(null);
      }
    }
  }
  if (heat > 0 && (penaltyCooling > 0 || !isRedstonePowered)) {
    heat-=COOLDOWN_RATE;
  }
  if (heat <= MIN_HEAT) {
    heat=MIN_HEAT;
  }
  if (heat <= MIN_HEAT && penaltyCooling > 0) {
    penaltyCooling--;
  }
}

Fixed version (ground truth):
@Override public void engineUpdate(){
  final ItemStack stack=getStackInSlot(0);
  if (stack != null) {
    LiquidStack liquid=LiquidContainerRegistry.getLiquidForFilledItem(stack);
    if (liquid == null && heat > IDEAL_HEAT) {
      liquid=IronEngineCoolant.getLiquidCoolant(stack);
    }
    if (liquid != null) {
      if (fill(ForgeDirection.UNKNOWN,liquid,false) == liquid.amount) {
        fill(ForgeDirection.UNKNOWN,liquid,true);
        setInventorySlotContents(0,Utils.consumeItem(stack));
      }
    }
  }
  if (heat > IDEAL_HEAT) {
    float extraHeat=heat - IDEAL_HEAT;
    LiquidStack coolant=this.coolantTank.getLiquid();
    Coolant currentCoolant=IronEngineCoolant.getCoolant(coolant);
    if (currentCoolant != null) {
      float cooling=currentCoolant.getDegreesCoolingPerMB(heat);
      if (coolant.amount * cooling > extraHeat) {
        coolant.amount-=Math.round(extraHeat / cooling);
        heat=IDEAL_HEAT;
      }
 else {
        heat-=coolant.amount * cooling;
        coolantTank.setLiquid(null);
      }
    }
  }
  if (heat > MIN_HEAT && (penaltyCooling > 0 || !isRedstonePowered)) {
    heat-=COOLDOWN_RATE;
  }
  if (heat <= MIN_HEAT) {
    heat=MIN_HEAT;
  }
  if (heat <= MIN_HEAT && penaltyCooling > 0) {
    penaltyCooling--;
  }
}
Program: 156958
Project: 156958
Buggy source:
@Override public void readFromNBT(NBTTagCompound data){
  super.readFromNBT(data);
  powerHandler.readFromNBT(data);
  initPowerProvider();
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound data){
  super.readFromNBT(data);
  powerHandler.readFromNBT(data);
  initPowerProvider();
  for (int i=0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
    powerSources[i]=data.getBoolean("String_Node_Str" + i + "String_Node_Str");
  }
}
Program: 156959
Project: 156959
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (worldObj.isRemote)   return;
  if (powerHandler.getEnergyStored() <= 0)   return;
  int sources=0;
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    if (!container.isPipeConnected(o)) {
      powerSources[o.ordinal()]=false;
      continue;
    }
    if (powerHandler.isPowerSource(o)) {
      powerSources[o.ordinal()]=true;
    }
    if (powerSources[o.ordinal()]) {
      sources++;
    }
  }
  if (sources <= 0)   return;
  float energyToRemove;
  if (powerHandler.getEnergyStored() > 40) {
    energyToRemove=powerHandler.getEnergyStored() / 40 + 4;
  }
 else   if (powerHandler.getEnergyStored() > 10) {
    energyToRemove=powerHandler.getEnergyStored() / 10;
  }
 else {
    energyToRemove=1;
  }
  energyToRemove/=(float)sources;
  PipeTransportPower trans=(PipeTransportPower)transport;
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    if (!powerSources[o.ordinal()])     continue;
    float energyUsable=powerHandler.useEnergy(0,energyToRemove,false);
    float energySend=trans.receiveEnergy(o,energyUsable);
    if (energySend > 0) {
      powerHandler.useEnergy(0,energySend,true);
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (worldObj.isRemote)   return;
  if (powerHandler.getEnergyStored() <= 0)   return;
  int sources=0;
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    if (!container.isPipeConnected(o)) {
      powerSources[o.ordinal()]=false;
      continue;
    }
    if (powerHandler.isPowerSource(o)) {
      powerSources[o.ordinal()]=true;
    }
    if (powerSources[o.ordinal()]) {
      sources++;
    }
  }
  if (sources <= 0) {
    powerHandler.useEnergy(5,5,true);
    return;
  }
  float energyToRemove;
  if (powerHandler.getEnergyStored() > 40) {
    energyToRemove=powerHandler.getEnergyStored() / 40 + 4;
  }
 else   if (powerHandler.getEnergyStored() > 10) {
    energyToRemove=powerHandler.getEnergyStored() / 10;
  }
 else {
    energyToRemove=1;
  }
  energyToRemove/=(float)sources;
  PipeTransportPower trans=(PipeTransportPower)transport;
  for (  ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
    if (!powerSources[o.ordinal()])     continue;
    float energyUsable=powerHandler.useEnergy(0,energyToRemove,false);
    float energySend=trans.receiveEnergy(o,energyUsable);
    if (energySend > 0) {
      powerHandler.useEnergy(0,energySend,true);
    }
  }
}
Program: 156960
Project: 156960
Buggy source:
@Override public void writeToNBT(NBTTagCompound data){
  super.writeToNBT(data);
  powerHandler.writeToNBT(data);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound data){
  super.writeToNBT(data);
  powerHandler.writeToNBT(data);
  for (int i=0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
    data.setBoolean("String_Node_Str" + i + "String_Node_Str",powerSources[i]);
  }
}
Program: 156961
Project: 156961
Buggy source:
public double receiveEnergy(ForgeDirection from,double val){
  step();
  if (this.container.pipe instanceof IPipeTransportPowerHook) {
    return ((IPipeTransportPowerHook)this.container.pipe).receiveEnergy(from,val);
  }
 else {
    internalNextPower[from.ordinal()]+=val;
    if (internalNextPower[from.ordinal()] > maxPower) {
      val=internalNextPower[from.ordinal()] - maxPower;
      internalNextPower[from.ordinal()]=maxPower;
    }
  }
  return val;
}

Fixed version (ground truth):
public double receiveEnergy(ForgeDirection from,double val){
  step();
  if (this.container.pipe instanceof IPipeTransportPowerHook) {
    return ((IPipeTransportPowerHook)this.container.pipe).receiveEnergy(from,val);
  }
 else {
    internalNextPower[from.ordinal()]+=val;
    if (internalNextPower[from.ordinal()] > maxPower) {
      val-=internalNextPower[from.ordinal()] - maxPower;
      internalNextPower[from.ordinal()]=maxPower;
    }
  }
  return val;
}
Program: 156962
Project: 156962
Buggy source:
public void step(){
  if (currentDate != worldObj.getWorldTime()) {
    currentDate=worldObj.getWorldTime();
    powerQuery=nextPowerQuery;
    nextPowerQuery=new int[6];
    double[] next=internalPower;
    internalPower=internalNextPower;
    internalNextPower=next;
    for (int i=0; i < powerQuery.length; i++) {
      int sum=0;
      for (int j=0; j < powerQuery.length; j++) {
        if (i != j) {
          sum+=powerQuery[j];
        }
      }
      if (sum == 0 && internalNextPower[i] > 0) {
        internalNextPower[i]-=1;
        if (internalNextPower[i] < 0) {
          internalNextPower[i]=0;
        }
      }
    }
  }
}

Fixed version (ground truth):
public void step(){
  if (currentDate != worldObj.getWorldTime()) {
    currentDate=worldObj.getWorldTime();
    powerQuery=nextPowerQuery;
    nextPowerQuery=new int[6];
    double[] next=internalPower;
    internalPower=internalNextPower;
    internalNextPower=next;
  }
}
Program: 156963
Project: 156963
Buggy source:
@Override public int powerRequest(ForgeDirection from){
  return 0;
}

Fixed version (ground truth):
@Override public int powerRequest(ForgeDirection from){
  return getPowerProvider().getMaxEnergyReceived();
}
Program: 156964
Project: 156964
Buggy source:
@Override public final void onCraftMatrixChanged(IInventory inv){
  super.onCraftMatrixChanged(inv);
  ItemStack output=tile.findRecipeOutput();
  if (output != null && tile.isLast()) {
    Utils.addItemToolTip(output,"String_Node_Str",EnumChatFormatting.YELLOW + StringUtils.localize("String_Node_Str"));
  }
  craftResult.setInventorySlotContents(0,output);
}

Fixed version (ground truth):
@Override public final void onCraftMatrixChanged(IInventory inv){
  super.onCraftMatrixChanged(inv);
  ItemStack output=tile.findRecipeOutput();
  craftResult.setInventorySlotContents(0,output);
}
Program: 156965
Project: 156965
Buggy source:
public ContainerAutoWorkbench(InventoryPlayer inventoryplayer,TileAutoWorkbench t){
  super(t.getSizeInventory());
  craftResult=new InventoryCraftResult();
  this.tile=t;
  addSlotToContainer(new SlotUntouchable(craftResult,0,93,27){
    @Override public void onPickupFromSlot(    EntityPlayer player,    ItemStack itemstack){
      tile.useLast=true;
    }
  }
);
  addSlotToContainer(new SlotOutput(tile,TileAutoWorkbench.SLOT_RESULT,124,35));
  for (int y=0; y < 3; y++) {
    for (int x=0; x < 3; x++) {
      addSlotToContainer(new SlotWorkbench(tile.craftMatrix,x + y * 3,30 + x * 18,17 + y * 18));
    }
  }
  for (int y=0; y < 3; y++) {
    for (int x=0; x < 9; x++) {
      addSlotToContainer(new Slot(inventoryplayer,x + y * 9 + 9,8 + x * 18,84 + y * 18));
    }
  }
  for (int x=0; x < 9; x++) {
    addSlotToContainer(new Slot(inventoryplayer,x,8 + x * 18,142));
  }
  onCraftMatrixChanged(tile);
}

Fixed version (ground truth):
public ContainerAutoWorkbench(InventoryPlayer inventoryplayer,TileAutoWorkbench t){
  super(t.getSizeInventory());
  craftResult=new InventoryCraftResult(){
    @Override public void setInventorySlotContents(    int slot,    ItemStack stack){
      super.setInventorySlotContents(slot,stack);
      if (stack != null && tile.isLast() && CoreProxy.proxy.isRenderWorld(tile.worldObj)) {
        Utils.addItemToolTip(stack,"String_Node_Str",EnumChatFormatting.YELLOW + StringUtils.localize("String_Node_Str"));
      }
    }
  }
;
  this.tile=t;
  addSlotToContainer(new SlotUntouchable(craftResult,0,93,27){
    @Override public void onPickupFromSlot(    EntityPlayer player,    ItemStack itemstack){
      tile.useLast=true;
    }
  }
);
  addSlotToContainer(new SlotOutput(tile,TileAutoWorkbench.SLOT_RESULT,124,35));
  for (int y=0; y < 3; y++) {
    for (int x=0; x < 3; x++) {
      addSlotToContainer(new SlotWorkbench(tile.craftMatrix,x + y * 3,30 + x * 18,17 + y * 18));
    }
  }
  for (int y=0; y < 3; y++) {
    for (int x=0; x < 9; x++) {
      addSlotToContainer(new Slot(inventoryplayer,x + y * 9 + 9,8 + x * 18,84 + y * 18));
    }
  }
  for (int x=0; x < 9; x++) {
    addSlotToContainer(new Slot(inventoryplayer,x,8 + x * 18,142));
  }
  onCraftMatrixChanged(tile);
}
Program: 156966
Project: 156966
Buggy source:
/** 
 * Moves items out of the hidden input buffer into the craft grid.
 */
private void processHiddenBuffer(){
  for (  IInvSlot slot : InventoryIterator.getIterable(invBuffer,ForgeDirection.UP)) {
    ItemStack stack=slot.getStackInSlot();
    if (stack == null) {
      continue;
    }
    if (!gridHasRoomFor(stack)) {
      Utils.dropItems(worldObj,stack,xCoord,yCoord + 1,zCoord);
      continue;
    }
    stack.stackSize-=transactor.add(stack,ForgeDirection.DOWN,true).stackSize;
    if (stack.stackSize <= 0) {
      slot.setStackInSlot(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Moves items out of the hidden input buffer into the craft grid.
 */
private void processHiddenBuffer(){
  for (  IInvSlot slot : InventoryIterator.getIterable(invBuffer,ForgeDirection.UP)) {
    ItemStack stack=slot.getStackInSlot();
    if (stack == null) {
      continue;
    }
    if (!gridHasRoomFor(stack)) {
      slot.setStackInSlot(null);
      Utils.dropItems(worldObj,stack,xCoord,yCoord + 1,zCoord);
      continue;
    }
    stack.stackSize-=transactor.add(stack,ForgeDirection.DOWN,true).stackSize;
    if (stack.stackSize <= 0) {
      slot.setStackInSlot(null);
    }
  }
}
Program: 156967
Project: 156967
Buggy source:
public void onBlockRemoval(){
  if (wireSet[IPipe.WireColor.Red.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.redPipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Blue.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.bluePipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Green.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.greenPipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Yellow.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.yellowPipeWire),xCoord,yCoord,zCoord);
  }
  if (hasGate()) {
    gate.dropGate(worldObj,xCoord,yCoord,zCoord);
  }
  for (  ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
    if (container.hasFacade(direction)) {
      container.dropFacade(direction);
    }
  }
  if (broadcastRedstone) {
    updateNeighbors(false);
  }
}

Fixed version (ground truth):
public void onBlockRemoval(){
  if (wireSet[IPipe.WireColor.Red.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.redPipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Blue.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.bluePipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Green.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.greenPipeWire),xCoord,yCoord,zCoord);
  }
  if (wireSet[IPipe.WireColor.Yellow.ordinal()]) {
    Utils.dropItems(worldObj,new ItemStack(BuildCraftTransport.yellowPipeWire),xCoord,yCoord,zCoord);
  }
  if (hasGate()) {
    gate.dropGate(worldObj,xCoord,yCoord,zCoord);
  }
  for (  ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
    if (container.hasFacade(direction)) {
      container.dropFacade(direction);
    }
    if (container.hasPlug(direction)) {
      container.removeAndDropPlug(direction);
    }
  }
  if (broadcastRedstone) {
    updateNeighbors(false);
  }
}
Program: 156969
Project: 156969
Buggy source:
private void pipePlugRenderer(RenderBlocks renderblocks,Block block,PipeRenderState state,int x,int y,int z){
  float zFightOffset=1F / 4096F;
  float[][] zeroState=new float[3][2];
  zeroState[0][0]=0.25F - zFightOffset / 2;
  zeroState[0][1]=0.75F + zFightOffset / 2;
  zeroState[1][0]=0.75F;
  zeroState[1][1]=0.875F - zFightOffset;
  zeroState[2][0]=0.25F;
  zeroState[2][1]=0.75F;
  state.currentTexture=BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone);
  for (  ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
    if (state.plugMatrix.isConnected(direction)) {
      float[][] rotated=deepClone(zeroState);
      transform(rotated,direction);
      block.setBlockBounds(rotated[0][0],rotated[1][0],rotated[2][0],rotated[0][1],rotated[1][1],rotated[2][1]);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block,x,y,z);
    }
  }
}

Fixed version (ground truth):
private void pipePlugRenderer(RenderBlocks renderblocks,Block block,PipeRenderState state,int x,int y,int z){
  float zFightOffset=1F / 4096F;
  float[][] zeroState=new float[3][2];
  zeroState[0][0]=0.25F - zFightOffset / 2;
  zeroState[0][1]=0.75F + zFightOffset / 2;
  zeroState[1][0]=0.125F;
  zeroState[1][1]=0.25F;
  zeroState[2][0]=0.25F;
  zeroState[2][1]=0.75F;
  state.currentTexture=BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone);
  for (  ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
    if (state.plugMatrix.isConnected(direction)) {
      float[][] rotated=deepClone(zeroState);
      transform(rotated,direction);
      block.setBlockBounds(rotated[0][0],rotated[1][0],rotated[2][0],rotated[0][1],rotated[1][1],rotated[2][1]);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block,x,y,z);
    }
  }
}