nus-yam/ex-repair huggingface dataset:
Program: 165943
Project: 165943
Buggy source:
@Override public void setInventorySlotContents(int index,ItemStack stack){
  if (index < RemoteStorageContainer.SLOT_LINKER) {
    copyFromModule(stack,index);
  }
  inventoryHelper.setInventorySlotContents(getInventoryStackLimit(),index,stack);
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  if (!worldObj.isRemote) {
    link(index);
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int index,ItemStack stack){
  inventoryHelper.setInventorySlotContents(getInventoryStackLimit(),index,stack);
  if (index < RemoteStorageContainer.SLOT_LINKER) {
    copyFromModule(stack,index);
  }
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  if (!worldObj.isRemote) {
    link(index);
  }
}
Program: 165944
Project: 165944
Buggy source:
public void copyToModule(int si){
  ItemStack stack=inventoryHelper.getStackInSlot(si);
  if (stack == null) {
    return;
  }
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeSlotsToNBT(tagCompound,"String_Node_Str",si);
  tagCompound.setInteger("String_Node_Str",cnt);
  setMaxSize(si,0);
}

Fixed version (ground truth):
public void copyToModule(int si){
  ItemStack stack=inventoryHelper.getStackInSlot(si);
  if (stack == null) {
    return;
  }
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeSlotsToNBT(tagCompound,"String_Node_Str",si);
  tagCompound.setInteger("String_Node_Str",cnt);
}
Program: 165945
Project: 165945
Buggy source:
private void clearInvisibleBlocks(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  if (meta == 2) {
    clearInvisibleBlockSafe(world,x - 1,y,z);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x - 1,y - 1,z);
  }
  if (meta == 3) {
    clearInvisibleBlockSafe(world,x + 1,y,z);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x + 1,y - 1,z);
  }
  if (meta == 4) {
    clearInvisibleBlockSafe(world,x,y,z + 1);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x,y - 1,z + 1);
  }
  if (meta == 5) {
    clearInvisibleBlockSafe(world,x,y,z - 1);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x,y - 1,z - 1);
  }
}

Fixed version (ground truth):
private void clearInvisibleBlocks(World world,int x,int y,int z,int meta){
  if (meta == 2) {
    clearInvisibleBlockSafe(world,x - 1,y,z);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x - 1,y - 1,z);
  }
  if (meta == 3) {
    clearInvisibleBlockSafe(world,x + 1,y,z);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x + 1,y - 1,z);
  }
  if (meta == 4) {
    clearInvisibleBlockSafe(world,x,y,z + 1);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x,y - 1,z + 1);
  }
  if (meta == 5) {
    clearInvisibleBlockSafe(world,x,y,z - 1);
    clearInvisibleBlockSafe(world,x,y - 1,z);
    clearInvisibleBlockSafe(world,x,y - 1,z - 1);
  }
}
Program: 165946
Project: 165946
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof ScreenTileEntity) {
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)te;
    if (screenTileEntity.isLarge()) {
      clearInvisibleBlocks(world,x,y,z);
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof ScreenTileEntity) {
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)te;
    if (screenTileEntity.isLarge()) {
      clearInvisibleBlocks(world,x,y,z,meta);
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}
Program: 165947
Project: 165947
Buggy source:
@Override protected boolean wrenchUse(World world,int x,int y,int z,EntityPlayer player){
  ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
  if (screenTileEntity.isTransparent() && screenTileEntity.isLarge()) {
    screenTileEntity.setTransparent(false);
  }
 else   if (screenTileEntity.isLarge()) {
    screenTileEntity.setLarge(false);
    clearInvisibleBlocks(world,x,y,z);
  }
 else   if (screenTileEntity.isTransparent()) {
    screenTileEntity.setLarge(true);
    setInvisibleBlocks(world,x,y,z);
  }
 else {
    screenTileEntity.setTransparent(true);
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean wrenchUse(World world,int x,int y,int z,EntityPlayer player){
  ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
  if (screenTileEntity.isTransparent() && screenTileEntity.isLarge()) {
    screenTileEntity.setTransparent(false);
  }
 else   if (screenTileEntity.isLarge()) {
    screenTileEntity.setLarge(false);
    int meta=world.getBlockMetadata(x,y,z);
    clearInvisibleBlocks(world,x,y,z,meta);
  }
 else   if (screenTileEntity.isTransparent()) {
    screenTileEntity.setLarge(true);
    setInvisibleBlocks(world,x,y,z);
  }
 else {
    screenTileEntity.setTransparent(true);
  }
  return true;
}
Program: 165948
Project: 165948
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entityLivingBase,ItemStack itemStack){
  super.onBlockPlacedBy(world,x,y,z,entityLivingBase,itemStack);
  if (entityLivingBase instanceof EntityPlayer) {
    Achievements.trigger((EntityPlayer)entityLivingBase,Achievements.clearVision);
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entityLivingBase,ItemStack itemStack){
  super.onBlockPlacedBy(world,x,y,z,entityLivingBase,itemStack);
  if (entityLivingBase instanceof EntityPlayer) {
    Achievements.trigger((EntityPlayer)entityLivingBase,Achievements.clearVision);
  }
  TileEntity tileEntity=world.getTileEntity(x,y,z);
  if (tileEntity instanceof ScreenTileEntity) {
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)tileEntity;
    if (screenTileEntity.isLarge()) {
      setInvisibleBlocks(world,x,y,z);
    }
  }
}
Program: 165949
Project: 165949
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof ShieldTEBase) {
    ShieldTEBase shieldTileEntity=(ShieldTEBase)te;
    BlockTools.emptyInventoryInWorld(world,x,y,z,block,shieldTileEntity);
    if (!world.isRemote) {
      if (shieldTileEntity.isShieldComposed()) {
        shieldTileEntity.decomposeShield();
      }
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te instanceof ShieldTEBase) {
    if (!world.isRemote) {
      ShieldTEBase shieldTileEntity=(ShieldTEBase)te;
      if (shieldTileEntity.isShieldComposed()) {
        shieldTileEntity.decomposeShield();
      }
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}
Program: 165950
Project: 165950
Buggy source:
public void addDimension(int id){
  data.writeByte(id);
}

Fixed version (ground truth):
public void addDimension(int id){
  data.writeInt(id);
}
Program: 165951
Project: 165951
Buggy source:
public void execute(){
  for (  byte id : dimensions) {
    RFTools.log("String_Node_Str" + id);
    if (!DimensionManager.isDimensionRegistered(id)) {
      DimensionManager.registerProviderType(id,GenericWorldProvider.class,false);
      DimensionManager.registerDimension(id,id);
    }
  }
}

Fixed version (ground truth):
public void execute(){
  for (  int id : dimensions) {
    RFTools.log("String_Node_Str" + id);
    if (!DimensionManager.isDimensionRegistered(id)) {
      DimensionManager.registerProviderType(id,GenericWorldProvider.class,false);
      DimensionManager.registerDimension(id,id);
    }
  }
}
Program: 165952
Project: 165952
Buggy source:
public void consumePacket(ByteBuf data){
  dimensions=new byte[data.readableBytes()];
  data.readBytes(dimensions);
}

Fixed version (ground truth):
public void consumePacket(ByteBuf data){
  int cnt=data.readableBytes() / 4;
  dimensions=new int[cnt];
  for (int i=0; i < cnt; i++) {
    dimensions[i]=data.readInt();
  }
}
Program: 165953
Project: 165953
Buggy source:
@Override protected Slot createSlot(SlotFactory slotFactory,IInventory inventory,int index,int x,int y,SlotType slotType){
  if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT) {
    return new BaseSlot(inventory,index,x,y){
      @Override public boolean isItemValid(      ItemStack stack){
        if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(),stack)) {
          return false;
        }
        return super.isItemValid(stack);
      }
    }
;
  }
  return super.createSlot(slotFactory,inventory,index,x,y,slotType);
}

Fixed version (ground truth):
@Override protected Slot createSlot(SlotFactory slotFactory,IInventory inventory,int index,int x,int y,SlotType slotType){
  if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT && slotType == SlotType.SLOT_INPUT) {
    return new BaseSlot(inventory,index,x,y){
      @Override public boolean isItemValid(      ItemStack stack){
        if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(),stack)) {
          return false;
        }
        return super.isItemValid(stack);
      }
    }
;
  }
  return super.createSlot(slotFactory,inventory,index,x,y,slotType);
}
Program: 165954
Project: 165954
Buggy source:
public Object[] getContentsValue(long millis,long contents,long maxContents){
  if (showdiff) {
    if (prevMillis == 0 || millis <= prevMillis) {
      prevMillis=millis;
      prevContents=contents;
      return new Object[]{contents,maxContents,0L};
    }
 else {
      long diff=millis - prevMillis;
      int ticks=(int)(diff * 20 / 1000);
      if (ticks == 0) {
        ticks=1;
      }
      long diffEnergy=contents - prevContents;
      prevMillis=millis;
      prevContents=contents;
      return new Object[]{contents,maxContents,diffEnergy / ticks};
    }
  }
 else {
    return new Object[]{contents,maxContents,0L};
  }
}

Fixed version (ground truth):
public Object[] getContentsValue(long millis,long contents,long maxContents){
  if (showdiff) {
    if (prevMillis == 0 || millis <= prevMillis + 100) {
      prevMillis=millis;
      prevContents=contents;
      return new Object[]{contents,maxContents,lastPerTick};
    }
 else {
      long diff=millis - prevMillis;
      int ticks=(int)(diff * 20 / 1000);
      if (ticks == 0) {
        ticks=1;
      }
      long diffEnergy=contents - prevContents;
      prevMillis=millis;
      prevContents=contents;
      lastPerTick=diffEnergy / ticks;
      return new Object[]{contents,maxContents,lastPerTick};
    }
  }
 else {
    return new Object[]{contents,maxContents,0L};
  }
}
Program: 165956
Project: 165956
Buggy source:
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty + 2,color);
    xoffset=7 + 80;
  }
 else {
    xoffset=7 + 5;
  }
  boolean act=false;
  if (toggle) {
    if (screenData != null && screenData.length >= 1) {
      act=((Integer)screenData[0]) > 0;
    }
  }
 else {
    act=activated;
  }
  RenderHelper.drawBeveledBox(xoffset - 5,currenty,130 - 7,currenty + 12,act ? 0xff333333 : 0xffeeeeee,act ? 0xffeeeeee : 0xff333333,0xff666666);
  fontRenderer.drawString(fontRenderer.trimStringToWidth(button,130 - 7 - xoffset),xoffset + (act ? 1 : 0),currenty + 2 + (act ? 1 : 0),buttonColor);
}

Fixed version (ground truth):
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty + 2,color);
    xoffset=7 + 80;
  }
 else {
    xoffset=7 + 5;
  }
  boolean act=false;
  if (toggle) {
    if (screenData != null && screenData.length >= 1 && screenData[0] instanceof Integer) {
      act=((Integer)screenData[0]) > 0;
    }
  }
 else {
    act=activated;
  }
  RenderHelper.drawBeveledBox(xoffset - 5,currenty,130 - 7,currenty + 12,act ? 0xff333333 : 0xffeeeeee,act ? 0xffeeeeee : 0xff333333,0xff666666);
  fontRenderer.drawString(fontRenderer.trimStringToWidth(button,130 - 7 - xoffset),xoffset + (act ? 1 : 0),currenty + 2 + (act ? 1 : 0),buttonColor);
}
Program: 165957
Project: 165957
Buggy source:
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,color);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (coordinate.isValid()) {
    int counter;
    if (screenData != null && screenData.length > 0) {
      counter=(Integer)screenData[0];
    }
 else {
      counter=0;
    }
    fontRenderer.drawString(ClientScreenModuleHelper.format(String.valueOf(counter),format),xoffset,currenty,cntcolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}

Fixed version (ground truth):
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,color);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (coordinate.isValid()) {
    int counter;
    if (screenData != null && screenData.length > 0 && screenData[0] instanceof Integer) {
      counter=(Integer)screenData[0];
    }
 else {
      counter=0;
    }
    fontRenderer.drawString(ClientScreenModuleHelper.format(String.valueOf(counter),format),xoffset,currenty,cntcolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}
Program: 165958
Project: 165958
Buggy source:
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,labcolor);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (coordinate.isValid() && screenData != null && screenData.length >= 1) {
    fontRenderer.drawString((String)screenData[0],xoffset,currenty,txtcolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}

Fixed version (ground truth):
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,labcolor);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (coordinate.isValid() && screenData != null && screenData.length >= 1 && screenData[0] instanceof String) {
    fontRenderer.drawString((String)screenData[0],xoffset,currenty,txtcolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}
Program: 165959
Project: 165959
Buggy source:
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,color);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (screenData != null && screenData.length > 0) {
    boolean rs=(Boolean)screenData[0];
    fontRenderer.drawString(rs ? yestext : notext,xoffset,currenty,rs ? yescolor : nocolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}

Fixed version (ground truth):
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  GL11.glDisable(GL11.GL_LIGHTING);
  int xoffset;
  if (!line.isEmpty()) {
    fontRenderer.drawString(line,7,currenty,color);
    xoffset=7 + 40;
  }
 else {
    xoffset=7;
  }
  if (screenData != null && screenData.length > 0 && screenData[0] instanceof Boolean) {
    boolean rs=(Boolean)screenData[0];
    fontRenderer.drawString(rs ? yestext : notext,xoffset,currenty,rs ? yescolor : nocolor);
  }
 else {
    fontRenderer.drawString("String_Node_Str",xoffset,currenty,0xff0000);
  }
}
Program: 165960
Project: 165960
Buggy source:
@Override public String getLongLabel(ItemStack stack){
  if (stack.getItem() == DimletSetup.knownDimlet) {
    DimletKey key=KnownDimletConfiguration.getDimletKey(stack,null);
    if (key != null) {
      DimletEntry entry=KnownDimletConfiguration.getEntry(key);
      return PATTERN.matcher(stack.getDisplayName()).replaceAll("String_Node_Str") + "String_Node_Str" + entry.getRarity()+ "String_Node_Str";
    }
  }
  return stack.getDisplayName();
}

Fixed version (ground truth):
@Override public String getLongLabel(ItemStack stack){
  if (stack.getItem() == DimletSetup.knownDimlet) {
    DimletKey key=KnownDimletConfiguration.getDimletKey(stack,null);
    if (key != null) {
      DimletEntry entry=KnownDimletConfiguration.getEntry(key);
      if (entry != null) {
        return PATTERN.matcher(stack.getDisplayName()).replaceAll("String_Node_Str") + "String_Node_Str" + entry.getRarity()+ "String_Node_Str";
      }
    }
  }
  return stack.getDisplayName();
}
Program: 165961
Project: 165961
Buggy source:
private Slot findEmptySlot(){
  for (  Object slotObject : inventorySlots.inventorySlots) {
    Slot slot=(Slot)slotObject;
    if ((!slot.getHasStack()) || slot.getStack().stackSize == 0) {
      return slot;
    }
  }
  return null;
}

Fixed version (ground truth):
private Slot findEmptySlot(){
  for (  Object slotObject : inventorySlots.inventorySlots) {
    Slot slot=(Slot)slotObject;
    if (tileEntity != null && slot.getSlotIndex() < ModularStorageContainer.SLOT_STORAGE) {
      continue;
    }
    if ((!slot.getHasStack()) || slot.getStack().stackSize == 0) {
      return slot;
    }
  }
  return null;
}
Program: 165962
Project: 165962
Buggy source:
public ModularStorageItemInventory(EntityPlayer player){
  this.entityPlayer=player;
  int maxSize=getMaxSize();
  stacks=new ItemStack[maxSize];
  NBTTagCompound tagCompound=entityPlayer.getHeldItem().getTagCompound();
  tagCompound.setInteger("String_Node_Str",maxSize);
  NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  for (int i=0; i < Math.min(bufferTagList.tagCount(),maxSize); i++) {
    NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
    stacks[i]=ItemStack.loadItemStackFromNBT(nbtTagCompound);
  }
}

Fixed version (ground truth):
public ModularStorageItemInventory(EntityPlayer player){
  this.entityPlayer=player;
  int maxSize=getMaxSize();
  stacks=new ItemStack[maxSize];
  NBTTagCompound tagCompound=entityPlayer.getHeldItem().getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    entityPlayer.getHeldItem().setTagCompound(tagCompound);
  }
  tagCompound.setInteger("String_Node_Str",maxSize);
  NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  for (int i=0; i < Math.min(bufferTagList.tagCount(),maxSize); i++) {
    NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
    stacks[i]=ItemStack.loadItemStackFromNBT(nbtTagCompound);
  }
}
Program: 165964
Project: 165964
Buggy source:
private boolean craftOneItem(CraftingRecipe craftingRecipe){
  List<InventoryHelper.SlotModifier> undo=new ArrayList<InventoryHelper.SlotModifier>();
  int amountLeft=placeResult(craftingRecipe.isCraftInternal(),craftingRecipe.getResult(),undo);
  if (amountLeft == 0 && !craftingRecipe.getContainerItems().isEmpty()) {
    for (    ItemStack stack : craftingRecipe.getContainerItems()) {
      amountLeft=placeResult(craftingRecipe.isCraftInternal(),stack,undo);
      if (amountLeft != 0) {
        break;
      }
    }
  }
  if (amountLeft == 0) {
    consumeCraftingItems(craftingRecipe.getStacksWithCount(),craftingRecipe.isKeepOne() ? 1 : 0);
    return true;
  }
 else {
    for (    InventoryHelper.SlotModifier modifier : undo) {
      inventoryHelper.getStacks()[modifier.getSlot()]=modifier.getOld();
    }
    return false;
  }
}

Fixed version (ground truth):
private boolean craftOneItem(CraftingRecipe craftingRecipe){
  List<InventoryHelper.SlotModifier> undo=new ArrayList<InventoryHelper.SlotModifier>();
  int amountLeft=placeResult(craftingRecipe.isCraftInternal(),craftingRecipe.getResult(),undo);
  if (amountLeft == 0 && !craftingRecipe.getContainerItems().isEmpty()) {
  }
  if (amountLeft == 0) {
    consumeCraftingItems(craftingRecipe.isCraftInternal(),craftingRecipe.getStacksWithCount(),craftingRecipe.isKeepOne() ? 1 : 0);
    return true;
  }
 else {
    for (    InventoryHelper.SlotModifier modifier : undo) {
      inventoryHelper.getStacks()[modifier.getSlot()]=modifier.getOld();
    }
    return false;
  }
}
Program: 165965
Project: 165965
Buggy source:
private void consumeCraftingItems(List<CraftingRecipe.StackWithCount> stackWithCounts,int keep){
  for (  CraftingRecipe.StackWithCount stackWithCount : stackWithCounts) {
    ItemStack stack=stackWithCount.getStack();
    int count=stackWithCount.getCount();
    for (int j=0; j < CrafterContainer.BUFFER_SIZE; j++) {
      ItemStack input=inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j];
      if (input != null && input.stackSize > keep) {
        if (OreDictionary.itemMatches(stack,input,false)) {
          int ss=count;
          if (input.stackSize - ss < keep) {
            ss=input.stackSize - keep;
          }
          count-=ss;
          input.splitStack(ss);
          if (input.stackSize == 0) {
            inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j]=null;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void consumeCraftingItems(boolean internal,List<CraftingRecipe.StackWithCount> stackWithCounts,int keep){
  for (  CraftingRecipe.StackWithCount stackWithCount : stackWithCounts) {
    ItemStack stack=stackWithCount.getStack();
    int count=stackWithCount.getCount();
    for (int j=0; j < CrafterContainer.BUFFER_SIZE; j++) {
      ItemStack input=inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j];
      if (input != null && input.stackSize > keep) {
        if (OreDictionary.itemMatches(stack,input,false)) {
          if (input.getItem().hasContainerItem(input)) {
            ItemStack containerItem=input.getItem().getContainerItem(input);
            if (containerItem != null && containerItem.isItemStackDamageable() && containerItem.getItemDamage() > containerItem.getMaxDamage()) {
            }
 else {
              placeResult(internal,containerItem,null);
            }
          }
          int ss=count;
          if (input.stackSize - ss < keep) {
            ss=input.stackSize - keep;
          }
          count-=ss;
          input.splitStack(ss);
          if (input.stackSize == 0) {
            inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j]=null;
          }
        }
      }
    }
  }
}
Program: 165966
Project: 165966
Buggy source:
private boolean craftOneItem(CraftingRecipe craftingRecipe){
  List<InventoryHelper.SlotModifier> undo=new ArrayList<InventoryHelper.SlotModifier>();
  int amountLeft=placeResult(craftingRecipe.isCraftInternal(),craftingRecipe.getResult(),undo);
  if (amountLeft == 0 && !craftingRecipe.getContainerItems().isEmpty()) {
  }
  if (amountLeft == 0) {
    consumeCraftingItems(craftingRecipe.isCraftInternal(),craftingRecipe.getStacksWithCount(),craftingRecipe.isKeepOne() ? 1 : 0);
    return true;
  }
 else {
    for (    InventoryHelper.SlotModifier modifier : undo) {
      inventoryHelper.getStacks()[modifier.getSlot()]=modifier.getOld();
    }
    return false;
  }
}

Fixed version (ground truth):
private boolean craftOneItem(CraftingRecipe craftingRecipe){
  List<InventoryHelper.SlotModifier> undo=new ArrayList<InventoryHelper.SlotModifier>();
  int amountLeft=placeResult(craftingRecipe.isCraftInternal(),craftingRecipe.getResult(),undo);
  if (amountLeft == 0 && !craftingRecipe.getContainerItems().isEmpty()) {
    List<InventoryHelper.SlotModifier> undoContainers=new ArrayList<InventoryHelper.SlotModifier>();
    for (    ItemStack stack : craftingRecipe.getContainerItems()) {
      amountLeft=placeResult(craftingRecipe.isCraftInternal(),stack,undoContainers);
      if (amountLeft != 0) {
        break;
      }
    }
    undo(undoContainers);
  }
  if (amountLeft == 0) {
    consumeCraftingItems(craftingRecipe.isCraftInternal(),craftingRecipe.getStacksWithCount(),craftingRecipe.isKeepOne() ? 1 : 0);
    return true;
  }
 else {
    undo(undo);
    return false;
  }
}
Program: 165967
Project: 165967
Buggy source:
private void consumeCraftingItems(boolean internal,List<CraftingRecipe.StackWithCount> stackWithCounts,int keep){
  for (  CraftingRecipe.StackWithCount stackWithCount : stackWithCounts) {
    ItemStack stack=stackWithCount.getStack();
    int count=stackWithCount.getCount();
    for (int j=0; j < CrafterContainer.BUFFER_SIZE; j++) {
      ItemStack input=inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j];
      if (input != null && input.stackSize > keep) {
        if (OreDictionary.itemMatches(stack,input,false)) {
          if (input.getItem().hasContainerItem(input)) {
            ItemStack containerItem=input.getItem().getContainerItem(input);
            if (containerItem != null && containerItem.isItemStackDamageable() && containerItem.getItemDamage() > containerItem.getMaxDamage()) {
            }
 else {
              placeResult(internal,containerItem,null);
            }
          }
          int ss=count;
          if (input.stackSize - ss < keep) {
            ss=input.stackSize - keep;
          }
          count-=ss;
          input.splitStack(ss);
          if (input.stackSize == 0) {
            inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j]=null;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void consumeCraftingItems(boolean internal,List<CraftingRecipe.StackWithCount> stackWithCounts,int keep){
  for (  CraftingRecipe.StackWithCount stackWithCount : stackWithCounts) {
    ItemStack stack=stackWithCount.getStack();
    int count=stackWithCount.getCount();
    for (int j=0; j < CrafterContainer.BUFFER_SIZE; j++) {
      ItemStack input=inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j];
      if (input != null && input.stackSize > keep) {
        if (OreDictionary.itemMatches(stack,input,false)) {
          if (input.getItem().hasContainerItem(input)) {
            ItemStack containerItem=input.getItem().getContainerItem(input);
            if (containerItem != null) {
              if ((!containerItem.isItemStackDamageable()) || containerItem.getItemDamage() <= containerItem.getMaxDamage()) {
                placeResult(internal,containerItem,null);
              }
            }
          }
          int ss=count;
          if (input.stackSize - ss < keep) {
            ss=input.stackSize - keep;
          }
          count-=ss;
          input.splitStack(ss);
          if (input.stackSize == 0) {
            inventoryHelper.getStacks()[CrafterContainer.SLOT_BUFFER + j]=null;
          }
        }
      }
    }
  }
}
Program: 165968
Project: 165968
Buggy source:
private void findContainerItems(){
  containerItems=new ArrayList<ItemStack>();
  for (int i=0; i < inv.getSizeInventory(); i++) {
    ItemStack stack=inv.getStackInSlot(i);
    if (stack != null && stack.getItem() != null) {
      ItemStack containerItem=stack.getItem().getContainerItem(stack);
      if (containerItem != null) {
        containerItems.add(containerItem);
      }
    }
  }
}

Fixed version (ground truth):
private void findContainerItems(){
  containerItems=new ArrayList<ItemStack>();
  for (int i=0; i < inv.getSizeInventory(); i++) {
    ItemStack stack=inv.getStackInSlot(i);
    if (stack != null && stack.getItem() != null) {
      ItemStack containerItem=stack.getItem().getContainerItem(stack);
      if (containerItem != null) {
        boolean found=false;
        for (        ItemStack item : containerItems) {
          if (item.isItemEqual(containerItem)) {
            item.stackSize+=containerItem.stackSize;
            found=true;
            break;
          }
        }
        if (!found) {
          containerItems.add(containerItem);
        }
      }
    }
  }
}
Program: 165970
Project: 165970
Buggy source:
@SubscribeEvent public void onBlockBreakEvent(BlockEvent.BreakEvent event){
  int id=event.world.provider.dimensionId;
  BlockProtectors blockProtectors=BlockProtectors.getProtectors(event.world);
  Collection<GlobalCoordinate> protectors=blockProtectors.findProtectors(event.x,event.y,event.z,id,2);
  for (  GlobalCoordinate protector : protectors) {
    int cx=protector.getCoordinate().getX();
    int cy=protector.getCoordinate().getY();
    int cz=protector.getCoordinate().getZ();
    TileEntity te=event.world.getTileEntity(cx,cy,cz);
    if (te instanceof BlockProtectorTileEntity) {
      BlockProtectorTileEntity blockProtectorTileEntity=(BlockProtectorTileEntity)te;
      Coordinate relative=blockProtectorTileEntity.absoluteToRelative(event.x,event.y,event.z);
      boolean b=blockProtectorTileEntity.isProtected(relative);
      if (b) {
        if (blockProtectorTileEntity.attemptHarvestProtection()) {
          event.setCanceled(true);
        }
 else {
          blockProtectorTileEntity.removeProtection(relative);
        }
        return;
      }
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onBlockBreakEvent(BlockEvent.BreakEvent event){
  BlockProtectors blockProtectors=BlockProtectors.getProtectors(event.world);
  if (blockProtectors == null) {
    return;
  }
  int id=event.world.provider.dimensionId;
  Collection<GlobalCoordinate> protectors=blockProtectors.findProtectors(event.x,event.y,event.z,id,2);
  for (  GlobalCoordinate protector : protectors) {
    int cx=protector.getCoordinate().getX();
    int cy=protector.getCoordinate().getY();
    int cz=protector.getCoordinate().getZ();
    TileEntity te=event.world.getTileEntity(cx,cy,cz);
    if (te instanceof BlockProtectorTileEntity) {
      BlockProtectorTileEntity blockProtectorTileEntity=(BlockProtectorTileEntity)te;
      Coordinate relative=blockProtectorTileEntity.absoluteToRelative(event.x,event.y,event.z);
      boolean b=blockProtectorTileEntity.isProtected(relative);
      if (b) {
        if (blockProtectorTileEntity.attemptHarvestProtection()) {
          event.setCanceled(true);
        }
 else {
          blockProtectorTileEntity.removeProtection(relative);
        }
        return;
      }
    }
  }
}
Program: 165971
Project: 165971
Buggy source:
private static void renderPlanet(float partialTickTime,WorldClient world,TextureManager renderEngine,Tessellator tessellator,CelestialBodyDescriptor body,float size){
  GL11.glTranslatef(0.0F,0.0F,0.0F);
  GL11.glRotatef(body.getyAngle(),0.0F,1.0F,0.0F);
  float angle=world.provider.calculateCelestialAngle((long)(world.getWorldInfo().getWorldTime() * body.getTimeFactor() + body.getTimeOffset()),partialTickTime);
  GL11.glRotatef(angle * 360.0F,1.0F,0.0F,0.0F);
  renderEngine.bindTexture(locationPlanetPng);
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV((-size),100.0D,(-size),0.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,(-size),1.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,size,1.0D,1.0D);
  tessellator.addVertexWithUV((-size),100.0D,size,0.0D,1.0D);
  tessellator.draw();
}

Fixed version (ground truth):
private static void renderPlanet(float partialTickTime,WorldClient world,TextureManager renderEngine,Tessellator tessellator,CelestialBodyDescriptor body,float size){
  GL11.glTranslatef(0.0F,0.0F,0.0F);
  GL11.glRotatef(body.getyAngle(),0.0F,1.0F,0.0F);
  float angle=world.provider.calculateCelestialAngle(world.getWorldInfo().getWorldTime(),partialTickTime);
  angle*=body.getTimeFactor() + body.getTimeOffset();
  GL11.glRotatef(angle * 360.0F,1.0F,0.0F,0.0F);
  renderEngine.bindTexture(locationPlanetPng);
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV((-size),100.0D,(-size),0.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,(-size),1.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,size,1.0D,1.0D);
  tessellator.addVertexWithUV((-size),100.0D,size,0.0D,1.0D);
  tessellator.draw();
}
Program: 165972
Project: 165972
Buggy source:
private static void renderSun(float partialTickTime,WorldClient world,TextureManager renderEngine,Tessellator tessellator,CelestialBodyDescriptor body,float size){
  GL11.glTranslatef(0.0F,0.0F,0.0F);
  GL11.glRotatef(body.getyAngle(),0.0F,1.0F,0.0F);
  float angle=world.provider.calculateCelestialAngle((long)(world.getWorldInfo().getWorldTime() * body.getTimeFactor() + body.getTimeOffset()),partialTickTime);
  GL11.glRotatef(angle * 360.0F,1.0F,0.0F,0.0F);
  renderEngine.bindTexture(locationSunPng);
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV((-size),100.0D,(-size),0.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,(-size),1.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,size,1.0D,1.0D);
  tessellator.addVertexWithUV((-size),100.0D,size,0.0D,1.0D);
  tessellator.draw();
}

Fixed version (ground truth):
private static void renderSun(float partialTickTime,WorldClient world,TextureManager renderEngine,Tessellator tessellator,CelestialBodyDescriptor body,float size){
  GL11.glTranslatef(0.0F,0.0F,0.0F);
  GL11.glRotatef(body.getyAngle(),0.0F,1.0F,0.0F);
  float angle=world.provider.calculateCelestialAngle(world.getWorldInfo().getWorldTime(),partialTickTime);
  angle*=body.getTimeFactor() + body.getTimeOffset();
  GL11.glRotatef(angle * 360.0F,1.0F,0.0F,0.0F);
  renderEngine.bindTexture(locationSunPng);
  tessellator.startDrawingQuads();
  tessellator.addVertexWithUV((-size),100.0D,(-size),0.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,(-size),1.0D,0.0D);
  tessellator.addVertexWithUV(size,100.0D,size,1.0D,1.0D);
  tessellator.addVertexWithUV((-size),100.0D,size,0.0D,1.0D);
  tessellator.draw();
}
Program: 165973
Project: 165973
Buggy source:
public void generate(World world,int chunkX,int chunkZ,Block[] ablock,byte[] ameta){
  BlockMeta[] blocks=large ? provider.dimensionInformation.getHugeLiquidSphereBlocks() : provider.dimensionInformation.getLiquidSphereBlocks();
  Block[] fluids=large ? provider.dimensionInformation.getHugeLiquidSphereFluids() : provider.dimensionInformation.getLiquidSphereFluids();
  for (int cx=-r; cx <= r; cx++) {
    for (int cz=-r; cz <= r; cz++) {
      Random random=new Random((world.getSeed() + (chunkX + cx)) * 37 + (chunkZ + cz) * 5 + 113);
      random.nextFloat();
      if (random.nextFloat() < .05f) {
        int x=cx * 16 + random.nextInt(16);
        int y=40 + random.nextInt(40);
        int z=cz * 16 + random.nextInt(16);
        int radius=random.nextInt(large ? 20 : 6) + (large ? 10 : 4);
        int index=0;
        if (blocks.length > 1) {
          index=random.nextInt(blocks.length);
        }
        int flindex=0;
        if (fluids.length > 1) {
          flindex=random.nextInt(fluids.length);
        }
        fillSphere(ablock,ameta,x,y,z,radius,blocks[index],fluids[flindex]);
      }
    }
  }
}

Fixed version (ground truth):
public void generate(World world,int chunkX,int chunkZ,Block[] ablock,byte[] ameta){
  BlockMeta[] blocks=large ? provider.dimensionInformation.getHugeLiquidSphereBlocks() : provider.dimensionInformation.getLiquidSphereBlocks();
  Block[] fluids=large ? provider.dimensionInformation.getHugeLiquidSphereFluids() : provider.dimensionInformation.getLiquidSphereFluids();
  for (int cx=-r; cx <= r; cx++) {
    for (int cz=-r; cz <= r; cz++) {
      Random random=new Random((world.getSeed() + (chunkX + cx)) * 37 + (chunkZ + cz) * 5 + 113);
      random.nextFloat();
      if (random.nextFloat() < .05f) {
        int x=cx * 16 + random.nextInt(16);
        int y=40 + random.nextInt(40);
        int z=cz * 16 + random.nextInt(16);
        int radius=random.nextInt(large ? 20 : 6) + (large ? 10 : 4);
        BlockMeta block=BlockMeta.STONE;
        if (blocks.length > 1) {
          block=blocks[random.nextInt(blocks.length)];
        }
 else         if (blocks.length == 1) {
          block=blocks[0];
        }
        Block fluid=Blocks.water;
        if (fluids.length > 1) {
          fluid=fluids[random.nextInt(fluids.length)];
        }
 else         if (fluids.length == 1) {
          fluid=fluids[0];
        }
        fillSphere(ablock,ameta,x,y,z,radius,block,fluid);
      }
    }
  }
}
Program: 165974
Project: 165974
Buggy source:
public void generate(World world,int chunkX,int chunkZ,Block[] ablock,byte[] ameta){
  BlockMeta[] blocks=large ? provider.dimensionInformation.getHugeSphereBlocks() : provider.dimensionInformation.getSphereBlocks();
  for (int cx=-r; cx <= r; cx++) {
    for (int cz=-r; cz <= r; cz++) {
      Random random=new Random((world.getSeed() + (chunkX + cx)) * 113 + (chunkZ + cz) * 31 + 77);
      random.nextFloat();
      if (random.nextFloat() < .05f) {
        int x=cx * 16 + random.nextInt(16);
        int y=40 + random.nextInt(40);
        int z=cz * 16 + random.nextInt(16);
        int radius=random.nextInt(large ? 20 : 6) + (large ? 10 : 4);
        int index=0;
        if (blocks.length > 1) {
          index=random.nextInt(blocks.length);
        }
        fillSphere(ablock,ameta,x,y,z,radius,blocks[index]);
      }
    }
  }
}

Fixed version (ground truth):
public void generate(World world,int chunkX,int chunkZ,Block[] ablock,byte[] ameta){
  BlockMeta[] blocks=large ? provider.dimensionInformation.getHugeSphereBlocks() : provider.dimensionInformation.getSphereBlocks();
  for (int cx=-r; cx <= r; cx++) {
    for (int cz=-r; cz <= r; cz++) {
      Random random=new Random((world.getSeed() + (chunkX + cx)) * 113 + (chunkZ + cz) * 31 + 77);
      random.nextFloat();
      if (random.nextFloat() < .05f) {
        int x=cx * 16 + random.nextInt(16);
        int y=40 + random.nextInt(40);
        int z=cz * 16 + random.nextInt(16);
        int radius=random.nextInt(large ? 20 : 6) + (large ? 10 : 4);
        BlockMeta block=BlockMeta.STONE;
        if (blocks.length > 1) {
          block=blocks[random.nextInt(blocks.length)];
        }
 else         if (blocks.length == 1) {
          block=blocks[0];
        }
        fillSphere(ablock,ameta,x,y,z,radius,block);
      }
    }
  }
}
Program: 165975
Project: 165975
Buggy source:
@Override public void onBlockClicked(World world,int x,int y,int z,EntityPlayer player){
  if (world.isRemote) {
    ScreenHitTileEntity screenHitTileEntity=(ScreenHitTileEntity)world.getTileEntity(x,y,z);
    int dx=screenHitTileEntity.getDx();
    int dy=screenHitTileEntity.getDy();
    int dz=screenHitTileEntity.getDz();
    Block block=world.getBlock(x + dx,y + dy,z + dz);
    if (block != ScreenSetup.screenBlock) {
      return;
    }
    MovingObjectPosition mouseOver=Minecraft.getMinecraft().objectMouseOver;
    PacketHandler.INSTANCE.sendToServer(new PacketServerCommand(x + dx,y + dy,z + dz,ScreenTileEntity.CMD_CLICK,new Argument("String_Node_Str",mouseOver.hitVec.xCoord - x - dx),new Argument("String_Node_Str",mouseOver.hitVec.yCoord - y - dy),new Argument("String_Node_Str",mouseOver.hitVec.zCoord - z - dz),new Argument("String_Node_Str",mouseOver.sideHit)));
  }
}

Fixed version (ground truth):
@Override public void onBlockClicked(World world,int x,int y,int z,EntityPlayer player){
  if (world.isRemote) {
    ScreenHitTileEntity screenHitTileEntity=(ScreenHitTileEntity)world.getTileEntity(x,y,z);
    int dx=screenHitTileEntity.getDx();
    int dy=screenHitTileEntity.getDy();
    int dz=screenHitTileEntity.getDz();
    Block block=world.getBlock(x + dx,y + dy,z + dz);
    if (block != ScreenSetup.screenBlock) {
      return;
    }
    MovingObjectPosition mouseOver=Minecraft.getMinecraft().objectMouseOver;
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x + dx,y + dy,z + dz);
    screenTileEntity.hitScreenClient(mouseOver.hitVec.xCoord - x - dx,mouseOver.hitVec.yCoord - y - dy,mouseOver.hitVec.zCoord - z - dz,mouseOver.sideHit);
  }
}
Program: 165976
Project: 165976
Buggy source:
@Override public Widget mouseClick(Window window,int x,int y,int button){
  if (isEnabledAndVisible()) {
    int index=choiceList.indexOf(currentChoice);
    index++;
    if (index >= choiceList.size()) {
      index=0;
    }
    currentChoice=choiceList.get(index);
    setText(currentChoice);
    fireChoiceEvents(currentChoice);
  }
  return null;
}

Fixed version (ground truth):
@Override public Widget mouseClick(Window window,int x,int y,int button){
  if (isEnabledAndVisible()) {
    if (choiceList.isEmpty()) {
      return null;
    }
    int index=choiceList.indexOf(currentChoice);
    index++;
    if (index >= choiceList.size()) {
      index=0;
    }
    currentChoice=choiceList.get(index);
    setText(currentChoice);
    fireChoiceEvents(currentChoice);
  }
  return null;
}
Program: 165977
Project: 165977
Buggy source:
/** 
 * Break a block in the world, convert it to an entity and remember all the settings for this block in the itemstack.
 * @param world
 * @param x
 * @param y
 * @param z
 */
protected void breakAndRemember(World world,int x,int y,int z){
  if (!world.isRemote) {
    world.setBlockToAir(x,y,z);
  }
}

Fixed version (ground truth):
/** 
 * Break a block in the world, convert it to an entity and remember all the settings for this block in the itemstack.
 */
protected void breakAndRemember(World world,EntityPlayer player,int x,int y,int z){
  if (!world.isRemote) {
    harvestBlock(world,player,x,y,z,world.getBlockMetadata(x,y,z));
  }
}
Program: 165978
Project: 165978
Buggy source:
/** 
 * In your onBlockActivated implementation you can use this method to get the default wrench usage (rotate/pick up with remembering).
 * @param world
 * @param x
 * @param y
 * @param z
 * @param player
 * @return
 */
protected boolean onBlockActivatedDefaultWrench(World world,int x,int y,int z,EntityPlayer player){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    rotateBlock(world,x,y,z);
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
/** 
 * In your onBlockActivated implementation you can use this method to get the default wrench usage (rotate/pick up with remembering).
 * @param world
 * @param x
 * @param y
 * @param z
 * @param player
 * @return
 */
protected boolean onBlockActivatedDefaultWrench(World world,int x,int y,int z,EntityPlayer player){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    rotateBlock(world,x,y,z);
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}
Program: 165979
Project: 165979
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      endergenicTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      endergenicTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}
Program: 165980
Project: 165980
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
    if (screenTileEntity.isTransparent() && screenTileEntity.isLarge()) {
      screenTileEntity.setTransparent(false);
    }
 else     if (screenTileEntity.isLarge()) {
      screenTileEntity.setLarge(false);
    }
 else     if (screenTileEntity.isTransparent()) {
      screenTileEntity.setLarge(true);
    }
 else {
      screenTileEntity.setTransparent(true);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    ItemStack itemStack=player.getHeldItem();
    if (itemStack != null && itemStack.getItem() == Items.dye) {
      int damage=itemStack.getItemDamage();
      if (damage < 0) {
        damage=0;
      }
 else       if (damage > 15) {
        damage=15;
      }
      int color=ItemDye.field_150922_c[damage];
      ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
      screenTileEntity.setColor(color);
      return true;
    }
 else {
      return openGui(world,x,y,z,player);
    }
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
    if (screenTileEntity.isTransparent() && screenTileEntity.isLarge()) {
      screenTileEntity.setTransparent(false);
    }
 else     if (screenTileEntity.isLarge()) {
      screenTileEntity.setLarge(false);
    }
 else     if (screenTileEntity.isTransparent()) {
      screenTileEntity.setLarge(true);
    }
 else {
      screenTileEntity.setTransparent(true);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    ItemStack itemStack=player.getHeldItem();
    if (itemStack != null && itemStack.getItem() == Items.dye) {
      int damage=itemStack.getItemDamage();
      if (damage < 0) {
        damage=0;
      }
 else       if (damage > 15) {
        damage=15;
      }
      int color=ItemDye.field_150922_c[damage];
      ScreenTileEntity screenTileEntity=(ScreenTileEntity)world.getTileEntity(x,y,z);
      screenTileEntity.setColor(color);
      return true;
    }
 else {
      return openGui(world,x,y,z,player);
    }
  }
}
Program: 165981
Project: 165981
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sidex,float sidey,float sidez){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    composeDecomposeShield(world,x,y,z);
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sidex,float sidey,float sidez){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    composeDecomposeShield(world,x,y,z);
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}