nus-yam/ex-repair huggingface dataset:
Program: 165811
Project: 165811
Buggy source:
@Override public void addProbeInfo(ProbeMode mode,IProbeInfo probeInfo,EntityPlayer player,World world,IBlockState blockState,IProbeHitData data){
  super.addProbeInfo(mode,probeInfo,player,world,blockState,data);
  TileEntity te=world.getTileEntity(data.getPos());
  if (te instanceof MatterTransmitterTileEntity) {
    MatterTransmitterTileEntity matterTransmitterTileEntity=(MatterTransmitterTileEntity)te;
    probeInfo.text(TextFormatting.GREEN + "String_Node_Str" + matterTransmitterTileEntity.getName());
    if (matterTransmitterTileEntity.isDialed()) {
      if (System.currentTimeMillis() - lastTime > 500) {
        lastTime=System.currentTimeMillis();
        RFToolsMessages.INSTANCE.sendToServer(new PacketGetDestinationInfo(matterTransmitterTileEntity.getTeleportId()));
      }
      String name="String_Node_Str";
      if (ReturnDestinationInfoHelper.id != null && ReturnDestinationInfoHelper.id == matterTransmitterTileEntity.getTeleportId()) {
        name=ReturnDestinationInfoHelper.name;
      }
      probeInfo.text(TextFormatting.YELLOW + "String_Node_Str" + name+ "String_Node_Str");
    }
    if (matterTransmitterTileEntity.isOnce()) {
      probeInfo.text(TextFormatting.YELLOW + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void addProbeInfo(ProbeMode mode,IProbeInfo probeInfo,EntityPlayer player,World world,IBlockState blockState,IProbeHitData data){
  super.addProbeInfo(mode,probeInfo,player,world,blockState,data);
  TileEntity te=world.getTileEntity(data.getPos());
  if (te instanceof MatterTransmitterTileEntity) {
    MatterTransmitterTileEntity matterTransmitterTileEntity=(MatterTransmitterTileEntity)te;
    probeInfo.text(TextFormatting.GREEN + "String_Node_Str" + matterTransmitterTileEntity.getName());
    if (matterTransmitterTileEntity.isDialed()) {
      Integer teleportId=matterTransmitterTileEntity.getTeleportId();
      if (teleportId == null) {
        ReturnDestinationInfoHelper.id=null;
      }
 else {
        if (System.currentTimeMillis() - lastTime > 500) {
          lastTime=System.currentTimeMillis();
          RFToolsMessages.INSTANCE.sendToServer(new PacketGetDestinationInfo(teleportId));
        }
      }
      String name="String_Node_Str";
      if (ReturnDestinationInfoHelper.id != null && ReturnDestinationInfoHelper.id.equals(teleportId)) {
        name=ReturnDestinationInfoHelper.name;
      }
      probeInfo.text(TextFormatting.YELLOW + "String_Node_Str" + name+ "String_Node_Str");
    }
    if (matterTransmitterTileEntity.isOnce()) {
      probeInfo.text(TextFormatting.YELLOW + "String_Node_Str");
    }
  }
}
Program: 165812
Project: 165812
Buggy source:
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  BlockPos pos=getPos();
  for (  EnumFacing dir : EnumFacing.VALUES) {
    BlockPos c=pos.offset(dir);
    TileEntity te=worldObj.getTileEntity(c);
    if (te instanceof EnderMonitorTileEntity) {
      EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
      EnumFacing inputSide=enderMonitorTileEntity.getFacing().getInputSide();
      if (inputSide == dir.getOpposite()) {
        enderMonitorTileEntity.fireFromEndergenic(mode);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  BlockPos pos=getPos();
  for (  EnumFacing dir : EnumFacing.VALUES) {
    BlockPos c=pos.offset(dir);
    TileEntity te=worldObj.getTileEntity(c);
    if (te instanceof EnderMonitorTileEntity) {
      EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
      EnumFacing inputSide=enderMonitorTileEntity.getFacing(worldObj.getBlockState(c)).getInputSide();
      if (inputSide == dir.getOpposite()) {
        enderMonitorTileEntity.fireFromEndergenic(mode);
      }
    }
  }
}
Program: 165813
Project: 165813
Buggy source:
@Override protected int getRedstoneOutput(IBlockState state,IBlockAccess world,BlockPos pos,EnumFacing side){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    if (side == logicTileEntity.getFacing().getInputSide()) {
      return state.getValue(OUTPUTPOWER) ? 15 : 0;
    }
 else {
      return 0;
    }
  }
  return 0;
}

Fixed version (ground truth):
@Override protected int getRedstoneOutput(IBlockState state,IBlockAccess world,BlockPos pos,EnumFacing side){
  TileEntity te=world.getTileEntity(pos);
  if (state.getBlock() instanceof LogicSlabBlock && te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    if (side == logicTileEntity.getFacing(state).getInputSide()) {
      return state.getValue(OUTPUTPOWER) ? 15 : 0;
    }
 else {
      return 0;
    }
  }
  return 0;
}
Program: 165814
Project: 165814
Buggy source:
@Override protected void checkRedstone(World world,BlockPos pos){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    EnumFacing inputSide=logicTileEntity.getFacing().getInputSide();
    int power=getInputStrength(world,pos,inputSide);
    if (power == 0) {
      IBlockState blockState=world.getBlockState(pos.offset(inputSide));
      Block b=blockState.getBlock();
      if (b == Blocks.REDSTONE_WIRE) {
        power=world.isBlockPowered(pos.offset(inputSide)) ? 15 : 0;
      }
    }
    logicTileEntity.setPowerInput(power);
  }
}

Fixed version (ground truth):
@Override protected void checkRedstone(World world,BlockPos pos){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    EnumFacing inputSide=logicTileEntity.getFacing(world.getBlockState(pos)).getInputSide();
    int power=getInputStrength(world,pos,inputSide);
    if (power == 0) {
      IBlockState blockState=world.getBlockState(pos.offset(inputSide));
      Block b=blockState.getBlock();
      if (b == Blocks.REDSTONE_WIRE) {
        power=world.isBlockPowered(pos.offset(inputSide)) ? 15 : 0;
      }
    }
    logicTileEntity.setPowerInput(power);
  }
}
Program: 165815
Project: 165815
Buggy source:
@Override public AxisAlignedBB getBoundingBox(IBlockState state,IBlockAccess world,BlockPos pos){
  if (world.getBlockState(pos).getBlock() instanceof LogicSlabBlock) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof LogicTileEntity) {
      LogicTileEntity logicTileEntity=(LogicTileEntity)te;
      EnumFacing side=logicTileEntity.getFacing().getSide();
switch (side) {
case DOWN:
        return BLOCK_DOWN;
case UP:
      return BLOCK_UP;
case NORTH:
    return BLOCK_NORTH;
case SOUTH:
  return BLOCK_SOUTH;
case WEST:
return BLOCK_WEST;
case EAST:
return BLOCK_EAST;
}
}
}
return BLOCK_DOWN;
}

Fixed version (ground truth):
@Override public AxisAlignedBB getBoundingBox(IBlockState state,IBlockAccess world,BlockPos pos){
  IBlockState blockState=world.getBlockState(pos);
  if (blockState.getBlock() instanceof LogicSlabBlock) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof LogicTileEntity) {
      LogicTileEntity logicTileEntity=(LogicTileEntity)te;
      EnumFacing side=logicTileEntity.getFacing(blockState).getSide();
switch (side) {
case DOWN:
        return BLOCK_DOWN;
case UP:
      return BLOCK_UP;
case NORTH:
    return BLOCK_NORTH;
case SOUTH:
  return BLOCK_SOUTH;
case WEST:
return BLOCK_WEST;
case EAST:
return BLOCK_EAST;
}
}
}
return BLOCK_DOWN;
}
Program: 165816
Project: 165816
Buggy source:
@Override public IBlockState getActualState(IBlockState state,IBlockAccess worldIn,BlockPos pos){
  int meta=state.getValue(META_INTERMEDIATE);
  TileEntity te=worldIn.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    LogicFacing facing=logicTileEntity.getFacing();
    facing=LogicFacing.getFacingWithMeta(facing,meta);
    return state.withProperty(LOGIC_FACING,facing);
  }
 else {
    return state.withProperty(LOGIC_FACING,LogicFacing.DOWN_TONORTH);
  }
}

Fixed version (ground truth):
@Override public IBlockState getActualState(IBlockState state,IBlockAccess worldIn,BlockPos pos){
  int meta=state.getValue(META_INTERMEDIATE);
  TileEntity te=worldIn.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    LogicFacing facing=logicTileEntity.getFacing(state);
    facing=LogicFacing.getFacingWithMeta(facing,meta);
    return state.withProperty(LOGIC_FACING,facing);
  }
 else {
    return state.withProperty(LOGIC_FACING,LogicFacing.DOWN_TONORTH);
  }
}
Program: 165817
Project: 165817
Buggy source:
@Override public boolean rotateBlock(World world,BlockPos pos,EnumFacing axis){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    LogicFacing facing=logicTileEntity.getFacing();
    int meta=facing.getMeta();
switch (meta) {
case 0:
      meta=2;
    break;
case 1:
  meta=3;
break;
case 2:
meta=1;
break;
case 3:
meta=0;
break;
}
LogicFacing newfacing=LogicFacing.getFacingWithMeta(facing,meta);
logicTileEntity.setFacing(newfacing);
world.setBlockState(pos,world.getBlockState(pos).getBlock().getDefaultState().withProperty(META_INTERMEDIATE,meta).withProperty(OUTPUTPOWER,false),3);
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean rotateBlock(World world,BlockPos pos,EnumFacing axis){
  IBlockState state=world.getBlockState(pos);
  TileEntity te=world.getTileEntity(pos);
  if (state.getBlock() instanceof LogicSlabBlock && te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    LogicFacing facing=logicTileEntity.getFacing(state);
    int meta=facing.getMeta();
switch (meta) {
case 0:
      meta=2;
    break;
case 1:
  meta=3;
break;
case 2:
meta=1;
break;
case 3:
meta=0;
break;
}
LogicFacing newfacing=LogicFacing.getFacingWithMeta(facing,meta);
logicTileEntity.setFacing(newfacing);
world.setBlockState(pos,state.getBlock().getDefaultState().withProperty(META_INTERMEDIATE,meta).withProperty(OUTPUTPOWER,false),3);
return true;
}
return false;
}
Program: 165818
Project: 165818
Buggy source:
@Override public boolean canConnectRedstone(IBlockState state,IBlockAccess world,BlockPos pos,EnumFacing side){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    EnumFacing direction=logicTileEntity.getFacing().getInputSide();
switch (direction) {
case NORTH:
case SOUTH:
      return side == NORTH || side == SOUTH;
case WEST:
case EAST:
    return side == WEST || side == EAST;
case DOWN:
case UP:
  return side == DOWN || side == UP;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean canConnectRedstone(IBlockState state,IBlockAccess world,BlockPos pos,EnumFacing side){
  TileEntity te=world.getTileEntity(pos);
  if (state.getBlock() instanceof LogicSlabBlock && te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    EnumFacing direction=logicTileEntity.getFacing(state).getInputSide();
switch (direction) {
case NORTH:
case SOUTH:
      return side == NORTH || side == SOUTH;
case WEST:
case EAST:
    return side == WEST || side == EAST;
case DOWN:
case UP:
  return side == DOWN || side == UP;
}
}
return false;
}
Program: 165819
Project: 165819
Buggy source:
public LogicFacing getFacing(){
  Integer meta=worldObj.getBlockState(pos).getValue(LogicSlabBlock.META_INTERMEDIATE);
  return LogicFacing.getFacingWithMeta(facing,meta);
}

Fixed version (ground truth):
public LogicFacing getFacing(IBlockState state){
  Integer meta=state.getValue(LogicSlabBlock.META_INTERMEDIATE);
  return LogicFacing.getFacingWithMeta(facing,meta);
}
Program: 165820
Project: 165820
Buggy source:
@Override public void update(){
  if (worldObj.isRemote) {
    return;
  }
  checkCounter--;
  if (checkCounter > 0) {
    return;
  }
  checkCounter=10;
  boolean newout=false;
  EnumFacing inputSide=getFacing().getInputSide();
  TileEntity te=worldObj.getTileEntity(getPos().offset(inputSide));
  if (InventoryHelper.isInventory(te)) {
    ItemStack stack=null;
    if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null)) {
      IItemHandler capability=te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null);
      if (slot >= 0 && slot < capability.getSlots()) {
        stack=capability.getStackInSlot(slot);
      }
    }
 else     if (te instanceof IInventory) {
      IInventory inventory=(IInventory)te;
      if (slot >= 0 && slot < inventory.getSizeInventory()) {
        stack=inventory.getStackInSlot(slot);
      }
    }
    if (stack != null) {
      int nr=isItemMatching(stack);
      newout=nr >= amount;
    }
  }
  if (newout != redstoneOut) {
    redstoneOut=newout;
    setRedstoneState(redstoneOut);
  }
}

Fixed version (ground truth):
@Override public void update(){
  if (worldObj.isRemote) {
    return;
  }
  checkCounter--;
  if (checkCounter > 0) {
    return;
  }
  checkCounter=10;
  boolean newout=false;
  EnumFacing inputSide=getFacing(worldObj.getBlockState(getPos())).getInputSide();
  TileEntity te=worldObj.getTileEntity(getPos().offset(inputSide));
  if (InventoryHelper.isInventory(te)) {
    ItemStack stack=null;
    if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null)) {
      IItemHandler capability=te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null);
      if (slot >= 0 && slot < capability.getSlots()) {
        stack=capability.getStackInSlot(slot);
      }
    }
 else     if (te instanceof IInventory) {
      IInventory inventory=(IInventory)te;
      if (slot >= 0 && slot < inventory.getSizeInventory()) {
        stack=inventory.getStackInSlot(slot);
      }
    }
    if (stack != null) {
      int nr=isItemMatching(stack);
      newout=nr >= amount;
    }
  }
  if (newout != redstoneOut) {
    redstoneOut=newout;
    setRedstoneState(redstoneOut);
  }
}
Program: 165821
Project: 165821
Buggy source:
@Override public void update(){
  if (worldObj.isRemote) {
    return;
  }
  checkCounter--;
  if (checkCounter > 0) {
    return;
  }
  checkCounter=10;
  boolean newout=false;
  EnumFacing inputSide=getFacing().getInputSide();
  BlockPos newpos=getPos().offset(inputSide);
switch (sensorType) {
case SENSOR_BLOCK:
    newout=checkBlock(newpos,inputSide);
  break;
case SENSOR_GROWTHLEVEL:
newout=checkGrowthLevel(newpos,inputSide);
break;
case SENSOR_ENTITIES:
newout=checkEntities(newpos,inputSide,Entity.class);
break;
case SENSOR_PLAYERS:
newout=checkEntities(newpos,inputSide,EntityPlayer.class);
break;
case SENSOR_HOSTILE:
newout=checkEntitiesHostile(newpos,inputSide);
break;
case SENSOR_PASSIVE:
newout=checkEntitiesPassive(newpos,inputSide);
break;
}
if (newout != redstoneOut) {
redstoneOut=newout;
setRedstoneState(redstoneOut);
}
}

Fixed version (ground truth):
@Override public void update(){
  if (worldObj.isRemote) {
    return;
  }
  checkCounter--;
  if (checkCounter > 0) {
    return;
  }
  checkCounter=10;
  boolean newout=false;
  EnumFacing inputSide=getFacing(worldObj.getBlockState(getPos())).getInputSide();
  BlockPos newpos=getPos().offset(inputSide);
switch (sensorType) {
case SENSOR_BLOCK:
    newout=checkBlock(newpos,inputSide);
  break;
case SENSOR_GROWTHLEVEL:
newout=checkGrowthLevel(newpos,inputSide);
break;
case SENSOR_ENTITIES:
newout=checkEntities(newpos,inputSide,Entity.class);
break;
case SENSOR_PLAYERS:
newout=checkEntities(newpos,inputSide,EntityPlayer.class);
break;
case SENSOR_HOSTILE:
newout=checkEntitiesHostile(newpos,inputSide);
break;
case SENSOR_PASSIVE:
newout=checkEntitiesPassive(newpos,inputSide);
break;
}
if (newout != redstoneOut) {
redstoneOut=newout;
setRedstoneState(redstoneOut);
}
}
Program: 165822
Project: 165822
Buggy source:
@Override protected void checkRedstone(World world,BlockPos pos){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    EnumFacing downSide=logicTileEntity.getFacing().getSide();
    EnumFacing inputSide=logicTileEntity.getFacing().getInputSide();
    EnumFacing leftSide=rotateLeft(downSide,inputSide);
    EnumFacing rightSide=rotateRight(downSide,inputSide);
    int powered1=getInputStrength(world,pos,leftSide) > 0 ? 1 : 0;
    int powered2=getInputStrength(world,pos,inputSide) > 0 ? 2 : 0;
    int powered3=getInputStrength(world,pos,rightSide) > 0 ? 4 : 0;
    logicTileEntity.setPowerInput(powered1 + powered2 + powered3);
  }
}

Fixed version (ground truth):
@Override protected void checkRedstone(World world,BlockPos pos){
  IBlockState state=world.getBlockState(pos);
  TileEntity te=world.getTileEntity(pos);
  if (state.getBlock() instanceof LogicSlabBlock && te instanceof LogicTileEntity) {
    LogicTileEntity logicTileEntity=(LogicTileEntity)te;
    LogicFacing facing=logicTileEntity.getFacing(state);
    EnumFacing downSide=facing.getSide();
    EnumFacing inputSide=facing.getInputSide();
    EnumFacing leftSide=rotateLeft(downSide,inputSide);
    EnumFacing rightSide=rotateRight(downSide,inputSide);
    int powered1=getInputStrength(world,pos,leftSide) > 0 ? 1 : 0;
    int powered2=getInputStrength(world,pos,inputSide) > 0 ? 2 : 0;
    int powered3=getInputStrength(world,pos,rightSide) > 0 ? 4 : 0;
    logicTileEntity.setPowerInput(powered1 + powered2 + powered3);
  }
}
Program: 165823
Project: 165823
Buggy source:
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  BlockPos pos=getPos();
  for (  EnumFacing dir : HORIZ_DIRECTIONS) {
    BlockPos c=pos.offset(dir);
    TileEntity te=worldObj.getTileEntity(c);
    if (te instanceof EnderMonitorTileEntity) {
      IBlockState state=worldObj.getBlockState(c);
      int meta=state.getBlock().getMetaFromState(state);
      EnumFacing k=BlockTools.getOrientationHoriz(meta);
      if (k == dir.getOpposite()) {
        EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
        enderMonitorTileEntity.fireFromEndergenic(mode);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Something happens, we need to notify all ender monitors.
 * @param mode is the new mode
 */
private void fireMonitors(EnderMonitorMode mode){
  BlockPos pos=getPos();
  for (  EnumFacing dir : EnumFacing.VALUES) {
    BlockPos c=pos.offset(dir);
    TileEntity te=worldObj.getTileEntity(c);
    if (te instanceof EnderMonitorTileEntity) {
      EnderMonitorTileEntity enderMonitorTileEntity=(EnderMonitorTileEntity)te;
      EnumFacing inputSide=enderMonitorTileEntity.getFacing().getInputSide();
      if (inputSide == dir.getOpposite()) {
        enderMonitorTileEntity.fireFromEndergenic(mode);
      }
    }
  }
}
Program: 165824
Project: 165824
Buggy source:
@Override public NBTTagCompound update(NBTTagCompound tagCompound,World world,EntityPlayer player){
  if (dirty >= 0) {
    NBTTagCompound newCompound=tagCompound.copy();
    NBTTagCompound tc=new NBTTagCompound();
    stacks[dirty].writeToNBT(tc);
    newCompound.setTag("String_Node_Str" + dirty,tc);
    if (player != null) {
      SoundTools.playSound(player.worldObj,SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ(),1.0f,1.0f);
    }
    return newCompound;
  }
  return null;
}

Fixed version (ground truth):
@Override public NBTTagCompound update(NBTTagCompound tagCompound,World world,EntityPlayer player){
  if (dirty >= 0) {
    dirty=-1;
    NBTTagCompound newCompound=tagCompound.copy();
    NBTTagCompound tc=new NBTTagCompound();
    stacks[dirty].writeToNBT(tc);
    newCompound.setTag("String_Node_Str" + dirty,tc);
    if (player != null) {
      SoundTools.playSound(player.worldObj,SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP,player.getPosition().getX(),player.getPosition().getY(),player.getPosition().getZ(),1.0f,1.0f);
    }
    return newCompound;
  }
  return null;
}
Program: 165826
Project: 165826
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float v,int i,int i2){
  updateList();
  viewMode.setCurrentChoice(tileEntity.getViewMode());
  sortMode.setCurrentChoice(tileEntity.getSortMode());
  groupMode.setCurrentChoice(tileEntity.isGroupMode() ? 1 : 0);
  filter.setText(tileEntity.getFilter());
  drawWindow();
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float v,int i,int i2){
  updateList();
  if (tileEntity != null) {
    viewMode.setCurrentChoice(tileEntity.getViewMode());
    sortMode.setCurrentChoice(tileEntity.getSortMode());
    groupMode.setCurrentChoice(tileEntity.isGroupMode() ? 1 : 0);
    filter.setText(tileEntity.getFilter());
  }
  drawWindow();
}
Program: 165827
Project: 165827
Buggy source:
@Override public void onBlockPlacedBy(World world,BlockPos pos,IBlockState state,EntityLivingBase placer,ItemStack stack){
  super.onBlockPlacedBy(world,pos,state,placer,stack);
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
    elevatorTileEntity.clearCaches();
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,BlockPos pos,IBlockState state,EntityLivingBase placer,ItemStack stack){
  super.onBlockPlacedBy(world,pos,state,placer,stack);
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
    elevatorTileEntity.clearCaches(world.getBlockState(pos).getValue(GenericBlock.FACING_HORIZ));
  }
}
Program: 165828
Project: 165828
Buggy source:
@Override public void breakBlock(World world,BlockPos pos,IBlockState state){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
    elevatorTileEntity.clearCaches();
  }
  super.breakBlock(world,pos,state);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,BlockPos pos,IBlockState state){
  TileEntity te=world.getTileEntity(pos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
    elevatorTileEntity.clearCaches(state.getValue(GenericBlock.FACING_HORIZ));
  }
  super.breakBlock(world,pos,state);
}
Program: 165829
Project: 165829
Buggy source:
public void clearCaches(){
  EnumFacing side=worldObj.getBlockState(getPos()).getValue(GenericBlock.FACING_HORIZ);
  for (int y=0; y < worldObj.getHeight(); y++) {
    BlockPos pos2=getPosAtY(getPos(),y);
    TileEntity te=worldObj.getTileEntity(pos2);
    if (te instanceof ElevatorTileEntity) {
      EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
      if (side2 == side) {
        ElevatorTileEntity tileEntity=(ElevatorTileEntity)te;
        tileEntity.cachedControllerPos=null;
        tileEntity.cachedLevels=0;
        tileEntity.cachedCurrent=-1;
      }
    }
  }
}

Fixed version (ground truth):
public void clearCaches(EnumFacing side){
  for (int y=0; y < worldObj.getHeight(); y++) {
    BlockPos pos2=getPosAtY(getPos(),y);
    if (worldObj.getBlockState(pos2).getBlock() == ElevatorSetup.elevatorBlock) {
      TileEntity te=worldObj.getTileEntity(pos2);
      if (te instanceof ElevatorTileEntity) {
        EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
        if (side2 == side) {
          ElevatorTileEntity tileEntity=(ElevatorTileEntity)te;
          tileEntity.cachedControllerPos=null;
          tileEntity.cachedLevels=0;
          tileEntity.cachedCurrent=-1;
        }
      }
    }
  }
}
Program: 165830
Project: 165830
Buggy source:
public void toLevel(int level){
  EnumFacing side=worldObj.getBlockState(getPos()).getValue(GenericBlock.FACING_HORIZ);
  BlockPos controllerPos=findBottomElevator();
  for (int y=controllerPos.getY(); y < worldObj.getHeight(); y++) {
    BlockPos pos2=getPosAtY(controllerPos,y);
    TileEntity te2=worldObj.getTileEntity(pos2);
    if (te2 instanceof ElevatorTileEntity) {
      EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
      if (side == side2) {
        if (level == 0) {
          ((ElevatorTileEntity)te2).movePlatformHere();
          return;
        }
        level--;
      }
    }
  }
}

Fixed version (ground truth):
public void toLevel(int level){
  EnumFacing side=worldObj.getBlockState(getPos()).getValue(GenericBlock.FACING_HORIZ);
  BlockPos controllerPos=findBottomElevator();
  for (int y=controllerPos.getY(); y < worldObj.getHeight(); y++) {
    BlockPos pos2=getPosAtY(controllerPos,y);
    if (worldObj.getBlockState(pos2).getBlock() == ElevatorSetup.elevatorBlock) {
      TileEntity te2=worldObj.getTileEntity(pos2);
      if (te2 instanceof ElevatorTileEntity) {
        EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
        if (side == side2) {
          if (level == 0) {
            ((ElevatorTileEntity)te2).movePlatformHere();
            return;
          }
          level--;
        }
      }
    }
  }
}
Program: 165831
Project: 165831
Buggy source:
public int getCurrentLevel(){
  BlockPos controllerPos=findBottomElevator();
  EnumFacing side=worldObj.getBlockState(getPos()).getValue(GenericBlock.FACING_HORIZ);
  TileEntity te=worldObj.getTileEntity(controllerPos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity controller=(ElevatorTileEntity)te;
    if (controller.cachedCurrent == -1) {
      int level=0;
      for (int y=controllerPos.getY(); y < worldObj.getHeight(); y++) {
        BlockPos pos2=getPosAtY(controllerPos,y);
        TileEntity te2=worldObj.getTileEntity(pos2);
        if (te2 instanceof ElevatorTileEntity) {
          EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
          if (side == side2) {
            BlockPos frontPos=pos2.offset(side);
            if (isValidPlatformBlock(frontPos)) {
              controller.cachedCurrent=level;
            }
            level++;
          }
        }
      }
    }
    return controller.cachedCurrent;
  }
  return 0;
}

Fixed version (ground truth):
public int getCurrentLevel(){
  BlockPos controllerPos=findBottomElevator();
  IBlockState blockState=worldObj.getBlockState(getPos());
  if (blockState.getBlock() != ElevatorSetup.elevatorBlock) {
    return 0;
  }
  EnumFacing side=blockState.getValue(GenericBlock.FACING_HORIZ);
  TileEntity te=worldObj.getTileEntity(controllerPos);
  if (te instanceof ElevatorTileEntity) {
    ElevatorTileEntity controller=(ElevatorTileEntity)te;
    if (controller.cachedCurrent == -1) {
      int level=0;
      for (int y=controllerPos.getY(); y < worldObj.getHeight(); y++) {
        BlockPos pos2=getPosAtY(controllerPos,y);
        TileEntity te2=worldObj.getTileEntity(pos2);
        if (te2 instanceof ElevatorTileEntity) {
          EnumFacing side2=worldObj.getBlockState(pos2).getValue(GenericBlock.FACING_HORIZ);
          if (side == side2) {
            BlockPos frontPos=pos2.offset(side);
            if (isValidPlatformBlock(frontPos)) {
              controller.cachedCurrent=level;
            }
            level++;
          }
        }
      }
    }
    return controller.cachedCurrent;
  }
  return 0;
}
Program: 165832
Project: 165832
Buggy source:
@Override public void mouseClick(World world,int x,int y,boolean clicked,EntityPlayer player){
  if (BlockPosTools.INVALID == coordinate) {
    return;
  }
  World w=DimensionManager.getWorld(dim);
  if (w == null) {
    return;
  }
  if (!RFToolsTools.chunkLoaded(world,coordinate)) {
    return;
  }
  TileEntity te=w.getTileEntity(coordinate);
  if (!(te instanceof ElevatorTileEntity)) {
    return;
  }
  ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
  if (vertical) {
    int yoffset=0;
    if (y >= yoffset) {
      int level=(y - yoffset) / (large ? (LARGESIZE - 2) : (SMALLSIZE - 2));
      if (level < 0) {
        return;
      }
      elevatorTileEntity.toLevel(((ElevatorTileEntity)te).getLevelCount() - level - 1);
    }
  }
 else {
    int xoffset=5;
    if (x >= xoffset) {
      int level=(x - xoffset) / (large ? (LARGESIZE - 2) : (SMALLSIZE - 2));
      if (level < 0) {
        return;
      }
      elevatorTileEntity.toLevel(level);
    }
  }
}

Fixed version (ground truth):
@Override public void mouseClick(World world,int x,int y,boolean clicked,EntityPlayer player){
  if (BlockPosTools.INVALID == coordinate) {
    return;
  }
  World w=DimensionManager.getWorld(dim);
  if (w == null) {
    return;
  }
  if (!RFToolsTools.chunkLoaded(world,coordinate)) {
    return;
  }
  TileEntity te=w.getTileEntity(coordinate);
  if (!(te instanceof ElevatorTileEntity)) {
    return;
  }
  ElevatorTileEntity elevatorTileEntity=(ElevatorTileEntity)te;
  int levelCount=elevatorTileEntity.getLevelCount();
  int level=-1;
  if (vertical) {
    int max=large ? 6 : 8;
    boolean twocols=levelCount > max;
    int yoffset=0;
    if (y >= yoffset) {
      level=(y - yoffset) / (large ? (LARGESIZE - 2) : (SMALLSIZE - 2));
      if (level < 0) {
        return;
      }
      if (twocols) {
        if (x > 73) {
          if (level < levelCount - max) {
            level=levelCount - level - 1;
          }
 else {
            level=-1;
          }
        }
 else {
          level=max - level - 1;
        }
      }
 else {
        level=levelCount - level - 1;
      }
      System.out.println("String_Node_Str" + level);
    }
  }
 else {
    int xoffset=5;
    if (x >= xoffset) {
      level=(x - xoffset) / (large ? (LARGESIZE - 2) : (SMALLSIZE - 2));
    }
  }
  if (level >= 0 && level < levelCount) {
    elevatorTileEntity.toLevel(level);
  }
}
Program: 165833
Project: 165833
Buggy source:
@Override public void render(IModuleRenderHelper renderHelper,FontRenderer fontRenderer,int currenty,IModuleDataContents screenData,ModuleRenderInfo renderInfo){
  GlStateManager.disableLighting();
  if (screenData == null) {
    return;
  }
  int currentLevel=(int)screenData.getContents();
  int buttons=(int)screenData.getMaxContents();
  int xoffset=5;
  for (int i=0; i < buttons; i++) {
    int level=vertical ? buttons - i - 1 : i;
    String text;
    if (hasLevelText(level)) {
      text=levels[level];
    }
 else {
      text=String.valueOf(level + (start1 ? 1 : 0));
    }
    int col=level == currentLevel ? this.currentLevelButtonColor : this.buttonColor;
    int textoffset=large ? 3 : 0;
    if (vertical) {
      if (lights) {
        RenderHelper.drawBeveledBox(xoffset,currenty,xoffset + 120,currenty + getDimension() - 2,0xffffffff,0xffffffff,0xff000000 + col);
        if (hasLevelText(level)) {
          fontRenderer.drawString(fontRenderer.trimStringToWidth(levels[level],120),xoffset + 3 + textoffset,currenty + 2 + textoffset,0xffffff);
        }
      }
 else {
        RenderHelper.drawBeveledBox(xoffset,currenty,xoffset + 120,currenty + getDimension() - 2,0xffeeeeee,0xff333333,0xff666666);
        fontRenderer.drawString(fontRenderer.trimStringToWidth(text,120),xoffset + 3 + textoffset,currenty + 2 + textoffset,col);
      }
      currenty+=getDimension() - 2;
    }
 else {
      if (lights) {
        RenderHelper.drawBeveledBox(xoffset,currenty,xoffset + getDimension() - 4,currenty + getDimension() - 2,0xffffffff,0xffffffff,0xff000000 + col);
        if (hasLevelText(level)) {
          fontRenderer.drawString(fontRenderer.trimStringToWidth(levels[level],120),xoffset + 3 + textoffset,currenty + 2 + textoffset,0xffffff);
        }
      }
 else {
        RenderHelper.drawBeveledBox(xoffset,currenty,xoffset + getDimension() - 4,currenty + getDimension() - 2,0xffeeeeee,0xff333333,0xff666666);
        fontRenderer.drawString(fontRenderer.trimStringToWidth(text,getDimension() - 4),xoffset + 3 + textoffset,currenty + 2 + textoffset,col);
      }
      xoffset+=getDimension() - 2;
    }
  }
}

Fixed version (ground truth):
@Override public void render(IModuleRenderHelper renderHelper,FontRenderer fontRenderer,int currenty,IModuleDataContents screenData,ModuleRenderInfo renderInfo){
  GlStateManager.disableLighting();
  if (screenData == null) {
    return;
  }
  int currentLevel=(int)screenData.getContents();
  int buttons=(int)screenData.getMaxContents();
  if (vertical) {
    renderButtonsVertical(fontRenderer,currenty,currentLevel,buttons);
  }
 else {
    renderButtonsHorizontal(fontRenderer,currenty,currentLevel,buttons);
  }
}
Program: 165834
Project: 165834
Buggy source:
@SideOnly(Side.CLIENT) private void handleClientMovement(){
  double d=calculateSpeed();
  handlePlatformMovement(d);
  EntityPlayerSP player=Minecraft.getMinecraft().thePlayer;
  AxisAlignedBB aabb=getAABBAboveElevator(d);
  boolean on=Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().intersectsWith(aabb);
  if (on) {
    player.setPosition(player.posX,movingY + 1,player.posZ);
  }
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) private void handleClientMovement(){
  double d=calculateSpeed();
  handlePlatformMovement(d);
  if (bounds != null) {
    EntityPlayerSP player=Minecraft.getMinecraft().thePlayer;
    AxisAlignedBB aabb=getAABBAboveElevator(d);
    boolean on=Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().intersectsWith(aabb);
    if (on) {
      player.setPosition(player.posX,movingY + 1,player.posZ);
    }
  }
}
Program: 165835
Project: 165835
Buggy source:
@Override public List<ItemStack> getDrops(IBlockAccess blockAccess,BlockPos pos,IBlockState state,int fortune){
  World world=(World)blockAccess;
  List<ItemStack> drops=super.getDrops(world,pos,state,fortune);
  if (!world.isRemote) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof PowerCellTileEntity) {
      PowerCellNetwork.Network network=((PowerCellTileEntity)te).getNetwork();
      if (network != null) {
        int energy=network.getEnergySingleBlock();
        if (!drops.isEmpty()) {
          NBTTagCompound tagCompound=drops.get(0).getTagCompound();
          if (tagCompound == null) {
            tagCompound=new NBTTagCompound();
            drops.get(0).setTagCompound(tagCompound);
          }
          tagCompound.setInteger("String_Node_Str",energy);
        }
      }
    }
  }
  return drops;
}

Fixed version (ground truth):
@Override public List<ItemStack> getDrops(IBlockAccess blockAccess,BlockPos pos,IBlockState state,int fortune){
  World world=(World)blockAccess;
  List<ItemStack> drops=super.getDrops(world,pos,state,fortune);
  if (!world.isRemote) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof PowerCellTileEntity) {
      PowerCellNetwork.Network network=((PowerCellTileEntity)te).getNetwork();
      if (network != null) {
        int energy=network.getEnergySingleBlock(isAdvanced());
        if (!drops.isEmpty()) {
          NBTTagCompound tagCompound=drops.get(0).getTagCompound();
          if (tagCompound == null) {
            tagCompound=new NBTTagCompound();
            drops.get(0).setTagCompound(tagCompound);
          }
          tagCompound.setInteger("String_Node_Str",energy);
        }
      }
    }
  }
  return drops;
}
Program: 165836
Project: 165836
Buggy source:
@Override public void breakBlock(World world,BlockPos pos,IBlockState state){
  if (!world.isRemote) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity cellTileEntity=(PowerCellTileEntity)te;
      PowerCellNetwork.Network network=cellTileEntity.getNetwork();
      if (network != null) {
        network.extractEnergySingleBlock(isAdvanced());
        Block block=world.getBlockState(pos).getBlock();
        network.remove(world,cellTileEntity.getGlobalPos(),PowerCellBlock.isAdvanced(block));
        PowerCellNetwork.getChannels(world).save(world);
      }
    }
  }
  super.breakBlock(world,pos,state);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,BlockPos pos,IBlockState state){
  if (!world.isRemote) {
    TileEntity te=world.getTileEntity(pos);
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity cellTileEntity=(PowerCellTileEntity)te;
      PowerCellNetwork.Network network=cellTileEntity.getNetwork();
      if (network != null) {
        int a=network.extractEnergySingleBlock(isAdvanced());
        Block block=world.getBlockState(pos).getBlock();
        network.remove(world,cellTileEntity.getGlobalPos(),PowerCellBlock.isAdvanced(block));
        PowerCellNetwork.getChannels(world).save(world);
      }
    }
  }
  super.breakBlock(world,pos,state);
}
Program: 165837
Project: 165837
Buggy source:
public int getEnergySingleBlock(){
  return energy / Math.max(1,blocks.size());
}

Fixed version (ground truth):
public int getEnergySingleBlock(boolean advanced){
  int rc=energy / Math.max(1,(blocks.size() - advancedBlocks) + advancedBlocks * PowerCellConfiguration.advancedFactor);
  if (advanced) {
    rc*=PowerCellConfiguration.advancedFactor;
  }
  return rc;
}
Program: 165838
Project: 165838
Buggy source:
public int countStack(ItemStack stack,boolean starred){
  if (stack == null) {
    return 0;
  }
  int cnt=0;
  List<BlockPos> inventories=getInventories();
  for (  BlockPos c : inventories) {
    if ((!starred) || routable.contains(c)) {
      TileEntity tileEntity=worldObj.getTileEntity(c);
      Integer cachedCount=null;
      if (tileEntity instanceof IInventoryTracker) {
        IInventoryTracker tracker=(IInventoryTracker)tileEntity;
        Pair<Integer,Integer> pair=cachedCounts.get(Pair.of(c,stack.getItem()));
        if (pair != null) {
          Integer oldVersion=pair.getLeft();
          if (oldVersion == tracker.getVersion()) {
            cachedCount=pair.getRight();
          }
        }
      }
      if (cachedCount != null) {
        cnt+=cachedCount;
      }
 else {
        final int[] cc={0};
        InventoryHelper.getItems(tileEntity,s -> s.isItemEqual(stack)).forEach(s -> {
          cc[0]+=s.stackSize;
        }
);
        cnt+=cc[0];
        if (tileEntity instanceof IInventoryTracker) {
          IInventoryTracker tracker=(IInventoryTracker)tileEntity;
          cachedCounts.put(Pair.of(c,stack.getItem()),Pair.of(tracker.getVersion(),cc[0]));
        }
      }
    }
  }
  return cnt;
}

Fixed version (ground truth):
public int countStack(ItemStack stack,boolean starred){
  if (stack == null) {
    return 0;
  }
  int cnt=0;
  List<BlockPos> inventories=getInventories();
  for (  BlockPos c : inventories) {
    if ((!starred) || routable.contains(c)) {
      TileEntity tileEntity=worldObj.getTileEntity(c);
      Integer cachedCount=null;
      if (tileEntity instanceof IInventoryTracker) {
        IInventoryTracker tracker=(IInventoryTracker)tileEntity;
        CachedItemCount itemCount=cachedCounts.get(new CachedItemKey(c,stack.getItem(),stack.getItemDamage()));
        if (itemCount != null) {
          Integer oldVersion=itemCount.getVersion();
          if (oldVersion == tracker.getVersion()) {
            cachedCount=itemCount.getCount();
          }
        }
      }
      if (cachedCount != null) {
        cnt+=cachedCount;
      }
 else {
        final int[] cc={0};
        InventoryHelper.getItems(tileEntity,stack::isItemEqual).forEach(s -> {
          cc[0]+=s.stackSize;
        }
);
        cnt+=cc[0];
        if (tileEntity instanceof IInventoryTracker) {
          IInventoryTracker tracker=(IInventoryTracker)tileEntity;
          cachedCounts.put(new CachedItemKey(c,stack.getItem(),stack.getItemDamage()),new CachedItemCount(tracker.getVersion(),cc[0]));
        }
      }
    }
  }
  return cnt;
}
Program: 165839
Project: 165839
Buggy source:
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (heldItem != null && heldItem.getItem() instanceof EnvModuleProvider) {
    if (RFToolsTools.installModule(player,heldItem,hand,pos,EnvironmentalControllerContainer.SLOT_MODULES,EnvironmentalControllerContainer.SLOT_MODULES + EnvironmentalControllerContainer.ENV_MODULES)) {
      return true;
    }
  }
  return super.onBlockActivated(world,pos,state,player,hand,heldItem,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (heldItem != null && heldItem.getItem() instanceof EnvModuleProvider) {
    if (RFToolsTools.installModule(player,heldItem,hand,pos,EnvironmentalControllerContainer.SLOT_MODULES,EnvironmentalControllerContainer.SLOT_MODULES + EnvironmentalControllerContainer.ENV_MODULES - 1)) {
      return true;
    }
  }
  return super.onBlockActivated(world,pos,state,player,hand,heldItem,side,hitX,hitY,hitZ);
}
Program: 165840
Project: 165840
Buggy source:
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (heldItem != null && heldItem.getItem() instanceof IModuleProvider) {
    if (RFToolsTools.installModule(player,heldItem,hand,pos,ScreenContainer.SLOT_MODULES,ScreenContainer.SLOT_MODULES + +ScreenContainer.SCREEN_MODULES)) {
      return true;
    }
  }
  return super.onBlockActivated(world,pos,state,player,hand,heldItem,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (heldItem != null && heldItem.getItem() instanceof IModuleProvider) {
    if (RFToolsTools.installModule(player,heldItem,hand,pos,ScreenContainer.SLOT_MODULES,ScreenContainer.SLOT_MODULES + ScreenContainer.SCREEN_MODULES - 1)) {
      return true;
    }
  }
  return super.onBlockActivated(world,pos,state,player,hand,heldItem,side,hitX,hitY,hitZ);
}
Program: 165841
Project: 165841
Buggy source:
@SubscribeEvent public void onRenderBlockOutline(DrawBlockHighlightEvent evt){
  BlockPos pos=evt.getTarget().getBlockPos();
  Block block=evt.getPlayer().getEntityWorld().getBlockState(pos).getBlock();
  if (block == ScreenSetup.screenBlock || block == ScreenSetup.screenHitBlock) {
    evt.setCanceled(true);
  }
}

Fixed version (ground truth):
@SubscribeEvent public void onRenderBlockOutline(DrawBlockHighlightEvent evt){
  RayTraceResult target=evt.getTarget();
  if (target != null && target.typeOfHit == RayTraceResult.Type.BLOCK) {
    BlockPos pos=target.getBlockPos();
    if (pos == null || evt.getPlayer() == null) {
      return;
    }
    Block block=evt.getPlayer().getEntityWorld().getBlockState(pos).getBlock();
    if (block == ScreenSetup.screenBlock || block == ScreenSetup.screenHitBlock) {
      evt.setCanceled(true);
    }
  }
}
Program: 165842
Project: 165842
Buggy source:
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(energy);
  buf.writeInt(blocks);
  buf.writeInt(advancedBlocks);
  buf.writeInt(totalInserted);
  buf.writeInt(totalExtracted);
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(energy);
  buf.writeInt(blocks);
  buf.writeInt(advancedBlocks);
  buf.writeInt(totalInserted);
  buf.writeInt(totalExtracted);
  buf.writeInt(rfPerTick);
  buf.writeFloat(costFactor);
}
Program: 165843
Project: 165843
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  energy=buf.readInt();
  blocks=buf.readInt();
  advancedBlocks=buf.readInt();
  totalInserted=buf.readInt();
  totalExtracted=buf.readInt();
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  energy=buf.readInt();
  blocks=buf.readInt();
  advancedBlocks=buf.readInt();
  totalInserted=buf.readInt();
  totalExtracted=buf.readInt();
  rfPerTick=buf.readInt();
  costFactor=buf.readFloat();
}
Program: 165844
Project: 165844
Buggy source:
@Override public void onMessageClient(EntityPlayerSP player){
  tooltipEnergy=energy;
  tooltipBlocks=blocks;
  tooltipAdvancedBlocks=advancedBlocks;
  tooltipInserted=totalInserted;
  tooltipExtracted=totalExtracted;
}

Fixed version (ground truth):
@Override public void onMessageClient(EntityPlayerSP player){
  tooltipEnergy=energy;
  tooltipBlocks=blocks;
  tooltipAdvancedBlocks=advancedBlocks;
  tooltipInserted=totalInserted;
  tooltipExtracted=totalExtracted;
  tooltipRfPerTick=rfPerTick;
  tooltipCostFactor=costFactor;
}
Program: 165845
Project: 165845
Buggy source:
public PowerCellInfoPacketClient(int energy,int blocks,int advancedBlocks,int totalInserted,int totalExtracted){
  this.energy=energy;
  this.blocks=blocks;
  this.advancedBlocks=advancedBlocks;
  this.totalInserted=totalInserted;
  this.totalExtracted=totalExtracted;
}

Fixed version (ground truth):
public PowerCellInfoPacketClient(int energy,int blocks,int advancedBlocks,int totalInserted,int totalExtracted,int rfPerTick,float costFactor){
  this.energy=energy;
  this.blocks=blocks;
  this.advancedBlocks=advancedBlocks;
  this.totalInserted=totalInserted;
  this.totalExtracted=totalExtracted;
  this.rfPerTick=rfPerTick;
  this.costFactor=costFactor;
}
Program: 165846
Project: 165846
Buggy source:
@Override public Optional<InfoPacketClient> onMessageServer(EntityPlayerMP player){
  World world=player.worldObj;
  TileEntity te=world.getTileEntity(pos);
  if (id == -1) {
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity powerCellTileEntity=(PowerCellTileEntity)te;
      return Optional.of(new PowerCellInfoPacketClient(powerCellTileEntity.getEnergy(),1,world.getBlockState(pos).getBlock() == PowerCellSetup.advancedPowerCellBlock ? 1 : 0,powerCellTileEntity.getTotalInserted(),powerCellTileEntity.getTotalExtracted()));
    }
 else {
      return Optional.empty();
    }
  }
 else {
    PowerCellNetwork generatorNetwork=PowerCellNetwork.getChannels(world);
    PowerCellNetwork.Network network=generatorNetwork.getChannel(id);
    int totInserted=0;
    int totExtracted=0;
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity powerCellTileEntity=(PowerCellTileEntity)te;
      totInserted=powerCellTileEntity.getTotalInserted();
      totExtracted=powerCellTileEntity.getTotalExtracted();
    }
    return Optional.of(new PowerCellInfoPacketClient(network.getEnergy(),network.getBlockCount(),network.getAdvancedBlockCount(),totInserted,totExtracted));
  }
}

Fixed version (ground truth):
@Override public Optional<InfoPacketClient> onMessageServer(EntityPlayerMP player){
  World world=player.worldObj;
  TileEntity te=world.getTileEntity(pos);
  if (id == -1) {
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity powerCellTileEntity=(PowerCellTileEntity)te;
      return Optional.of(new PowerCellInfoPacketClient(powerCellTileEntity.getEnergy(),1,world.getBlockState(pos).getBlock() == PowerCellSetup.advancedPowerCellBlock ? 1 : 0,powerCellTileEntity.getTotalInserted(),powerCellTileEntity.getTotalExtracted(),powerCellTileEntity.getRfPerTickPerSide(),1.0f));
    }
 else {
      return Optional.empty();
    }
  }
 else {
    PowerCellNetwork generatorNetwork=PowerCellNetwork.getChannels(world);
    PowerCellNetwork.Network network=generatorNetwork.getChannel(id);
    int totInserted=0;
    int totExtracted=0;
    int rfPerTick=0;
    float costFactor=0;
    if (te instanceof PowerCellTileEntity) {
      PowerCellTileEntity powerCellTileEntity=(PowerCellTileEntity)te;
      totInserted=powerCellTileEntity.getTotalInserted();
      totExtracted=powerCellTileEntity.getTotalExtracted();
      rfPerTick=powerCellTileEntity.getRfPerTickPerSide();
      costFactor=powerCellTileEntity.getCostFactor();
    }
    return Optional.of(new PowerCellInfoPacketClient(network.getEnergy(),network.getBlockCount(),network.getAdvancedBlockCount(),totInserted,totExtracted,rfPerTick,costFactor));
  }
}