nus-yam/ex-repair huggingface dataset:
Program: 165847
Project: 165847
Buggy source:
private void sendOutEnergy(){
  int energyStored=getEnergyStored(EnumFacing.DOWN);
  for (  EnumFacing face : EnumFacing.values()) {
    if (modes[face.ordinal()] == Mode.MODE_OUTPUT) {
      BlockPos pos=getPos().offset(face);
      TileEntity te=worldObj.getTileEntity(pos);
      if (EnergyTools.isEnergyTE(te)) {
        if ((!(te instanceof PowerCellTileEntity)) || getNetworkId() == -1 || ((PowerCellTileEntity)te).getNetworkId() != getNetworkId()) {
          IEnergyConnection connection=(IEnergyConnection)te;
          EnumFacing opposite=face.getOpposite();
          if (connection.canConnectEnergy(opposite)) {
            float infusedFactor=getInfusedFactor();
            float factor;
            if (getNetworkId() == -1) {
              factor=1.0f;
            }
 else {
              factor=getNetwork().calculateCostFactor(getGlobalPos());
              factor=(factor - 1) * (1 - infusedFactor / 2) + 1;
            }
            int rfPerTick=(int)(PowerCellConfiguration.rfPerTick * getAdvancedFactor() * (infusedFactor * .5 + 1));
            int rfToGive;
            if (rfPerTick <= ((int)(energyStored / factor))) {
              rfToGive=rfPerTick;
            }
 else {
              rfToGive=(int)(energyStored / factor);
            }
            int received=EnergyTools.receiveEnergy(te,opposite,rfToGive);
            energyStored-=extractEnergy(EnumFacing.DOWN,(int)(received * factor),false);
            if (energyStored <= 0) {
              break;
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void sendOutEnergy(){
  int energyStored=getEnergyStored(EnumFacing.DOWN);
  for (  EnumFacing face : EnumFacing.values()) {
    if (modes[face.ordinal()] == Mode.MODE_OUTPUT) {
      BlockPos pos=getPos().offset(face);
      TileEntity te=worldObj.getTileEntity(pos);
      if (EnergyTools.isEnergyTE(te)) {
        if ((!(te instanceof PowerCellTileEntity)) || getNetworkId() == -1 || ((PowerCellTileEntity)te).getNetworkId() != getNetworkId()) {
          IEnergyConnection connection=(IEnergyConnection)te;
          EnumFacing opposite=face.getOpposite();
          if (connection.canConnectEnergy(opposite)) {
            float factor=getCostFactor();
            int rfPerTick=getRfPerTickPerSide();
            int rfToGive;
            if (rfPerTick <= ((int)(energyStored / factor))) {
              rfToGive=rfPerTick;
            }
 else {
              rfToGive=(int)(energyStored / factor);
            }
            int received=EnergyTools.receiveEnergy(te,opposite,rfToGive);
            energyStored-=extractEnergy(EnumFacing.DOWN,(int)(received * factor),false);
            if (energyStored <= 0) {
              break;
            }
          }
        }
      }
    }
  }
}
Program: 165848
Project: 165848
Buggy source:
private boolean isAdvanced(){
  return blockType == PowerCellSetup.advancedPowerCellBlock;
}

Fixed version (ground truth):
private boolean isAdvanced(){
  return worldObj.getBlockState(getPos()).getBlock() == PowerCellSetup.advancedPowerCellBlock;
}
Program: 165849
Project: 165849
Buggy source:
private void checkStateServer(){
  boolean pulse=powered && !prevIn;
  prevIn=powered;
  if (pulse) {
    handlePulse();
  }
  markDirty();
  timer--;
  if (timer <= 0) {
    timer=delay;
  }
 else {
    return;
  }
  boolean newout=currentStep != -1 && getCycleBit(currentStep);
  if (newout != redstoneOut) {
    redstoneOut=newout;
    IBlockState state=worldObj.getBlockState(getPos());
    worldObj.setBlockState(getPos(),state.withProperty(LogicSlabBlock.OUTPUTPOWER,redstoneOut),2);
    worldObj.notifyNeighborsOfStateChange(this.pos,this.getBlockType());
    worldObj.markBlockForUpdate(this.pos);
  }
  handleCycle(powered);
}

Fixed version (ground truth):
private void checkStateServer(){
  boolean pulse=powered && !prevIn;
  prevIn=powered;
  if (pulse) {
    handlePulse();
  }
  markDirty();
  timer--;
  if (timer <= 0) {
    timer=delay;
  }
 else {
    return;
  }
  boolean newout=currentStep != -1 && getCycleBit(currentStep);
  if (newout != redstoneOut) {
    redstoneOut=newout;
    IBlockState state=worldObj.getBlockState(getPos());
    worldObj.setBlockState(getPos(),state.withProperty(LogicSlabBlock.OUTPUTPOWER,redstoneOut),2);
    worldObj.notifyNeighborsOfStateChange(this.pos,this.getBlockType());
    worldObj.notifyBlockUpdate(this.pos,state,state,3);
  }
  handleCycle(powered);
}
Program: 165850
Project: 165850
Buggy source:
@Override public IMessage onMessage(PacketGetAdjacentBlocks message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetAdjacentBlocks message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165851
Project: 165851
Buggy source:
@Override public IMessage onMessage(PacketGetAdjacentTankBlocks message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetAdjacentTankBlocks message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165852
Project: 165852
Buggy source:
@Override public ScreenModuleGuiBuilder block(String tagnamePos){
  String monitoring;
  if (currentData.hasKey(tagnamePos + "String_Node_Str")) {
    int dim;
    if (currentData.hasKey(tagnamePos + "String_Node_Str")) {
      dim=currentData.getInteger(tagnamePos + "String_Node_Str");
    }
 else {
      dim=currentData.getInteger("String_Node_Str");
    }
    World world=mc.thePlayer.worldObj;
    if (dim == world.provider.getDimensionId()) {
      int x=currentData.getInteger(tagnamePos + "String_Node_Str");
      int y=currentData.getInteger(tagnamePos + "String_Node_Str");
      int z=currentData.getInteger(tagnamePos + "String_Node_Str");
      monitoring=currentData.getString(tagnamePos + "String_Node_Str");
      Block block=world.getBlockState(new BlockPos(x,y,z)).getBlock();
      row.add(new BlockRender(mc,gui).setRenderItem(block).setDesiredWidth(20));
      row.add(new Label(mc,gui).setText(x + "String_Node_Str" + y+ "String_Node_Str"+ z).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(150));
    }
 else {
      monitoring="String_Node_Str";
    }
  }
 else {
    monitoring="String_Node_Str";
  }
  row.add(new Label(mc,gui).setText(monitoring));
  return this;
}

Fixed version (ground truth):
@Override public ScreenModuleGuiBuilder block(String tagnamePos){
  String monitoring;
  if (currentData.hasKey(tagnamePos + "String_Node_Str")) {
    int dim;
    if (currentData.hasKey(tagnamePos + "String_Node_Str")) {
      dim=currentData.getInteger(tagnamePos + "String_Node_Str");
    }
 else {
      dim=currentData.getInteger("String_Node_Str");
    }
    World world=mc.thePlayer.worldObj;
    if (dim == world.provider.getDimension()) {
      int x=currentData.getInteger(tagnamePos + "String_Node_Str");
      int y=currentData.getInteger(tagnamePos + "String_Node_Str");
      int z=currentData.getInteger(tagnamePos + "String_Node_Str");
      monitoring=currentData.getString(tagnamePos + "String_Node_Str");
      Block block=world.getBlockState(new BlockPos(x,y,z)).getBlock();
      row.add(new BlockRender(mc,gui).setRenderItem(block).setDesiredWidth(20));
      row.add(new Label(mc,gui).setText(x + "String_Node_Str" + y+ "String_Node_Str"+ z).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(150));
    }
 else {
      monitoring="String_Node_Str";
    }
  }
 else {
    monitoring="String_Node_Str";
  }
  row.add(new Label(mc,gui).setText(monitoring));
  return this;
}
Program: 165853
Project: 165853
Buggy source:
@Override public IMessage onMessage(PacketGetScreenData message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetScreenData message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165854
Project: 165854
Buggy source:
private void handle(PacketGetScreenData message,MessageContext ctx){
  World world=ctx.getServerHandler().playerEntity.worldObj;
  if (message.pos.getDimension() != world.provider.getDimensionId()) {
    return;
  }
  TileEntity te=world.getTileEntity(message.pos.getCoordinate());
  if (!(te instanceof ScreenTileEntity)) {
    Logging.logError("String_Node_Str");
    return;
  }
  Map<Integer,IModuleData> screenData=((ScreenTileEntity)te).getScreenData(message.millis);
  SimpleNetworkWrapper wrapper=PacketHandler.modNetworking.get(message.modid);
  PacketReturnScreenData msg=new PacketReturnScreenData(message.pos,screenData);
  wrapper.sendTo(msg,ctx.getServerHandler().playerEntity);
}

Fixed version (ground truth):
private void handle(PacketGetScreenData message,MessageContext ctx){
  World world=ctx.getServerHandler().playerEntity.worldObj;
  if (message.pos.getDimension() != world.provider.getDimension()) {
    return;
  }
  TileEntity te=world.getTileEntity(message.pos.getCoordinate());
  if (!(te instanceof ScreenTileEntity)) {
    Logging.logError("String_Node_Str");
    return;
  }
  Map<Integer,IModuleData> screenData=((ScreenTileEntity)te).getScreenData(message.millis);
  SimpleNetworkWrapper wrapper=PacketHandler.modNetworking.get(message.modid);
  PacketReturnScreenData msg=new PacketReturnScreenData(message.pos,screenData);
  wrapper.sendTo(msg,ctx.getServerHandler().playerEntity);
}
Program: 165855
Project: 165855
Buggy source:
@Override public IMessage onMessage(PacketGetFilters message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetFilters message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165856
Project: 165856
Buggy source:
public static RemoteStorageTileEntity getRemoteStorage(World world,int id){
  RemoteStorageIdRegistry registry=RemoteStorageIdRegistry.getRegistry(world);
  if (registry == null) {
    return null;
  }
  GlobalCoordinate coordinate=registry.getStorage(id);
  if (coordinate == null) {
    return null;
  }
  World w=DimensionManager.getWorld(coordinate.getDimension());
  if (w == null) {
    return null;
  }
  BlockPos c=coordinate.getCoordinate();
  boolean exists=w.getChunkProvider().chunkExists(c.getX() >> 4,c.getZ() >> 4);
  if (!exists) {
    return null;
  }
  TileEntity te=w.getTileEntity(c);
  if (te instanceof RemoteStorageTileEntity) {
    RemoteStorageTileEntity remoteStorageTileEntity=(RemoteStorageTileEntity)te;
    int index=remoteStorageTileEntity.findRemoteIndex(id);
    if (index == -1) {
      return null;
    }
    if (remoteStorageTileEntity.isGlobal(index) || world.provider.getDimensionId() == coordinate.getDimension()) {
      return remoteStorageTileEntity;
    }
 else {
      return null;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static RemoteStorageTileEntity getRemoteStorage(World world,int id){
  RemoteStorageIdRegistry registry=RemoteStorageIdRegistry.getRegistry(world);
  if (registry == null) {
    return null;
  }
  GlobalCoordinate coordinate=registry.getStorage(id);
  if (coordinate == null) {
    return null;
  }
  World w=DimensionManager.getWorld(coordinate.getDimension());
  if (w == null) {
    return null;
  }
  BlockPos c=coordinate.getCoordinate();
  boolean exists=w.getChunkProvider().getLoadedChunk(c.getX() >> 4,c.getZ() >> 4) != null;
  if (!exists) {
    return null;
  }
  TileEntity te=w.getTileEntity(c);
  if (te instanceof RemoteStorageTileEntity) {
    RemoteStorageTileEntity remoteStorageTileEntity=(RemoteStorageTileEntity)te;
    int index=remoteStorageTileEntity.findRemoteIndex(id);
    if (index == -1) {
      return null;
    }
    if (remoteStorageTileEntity.isGlobal(index) || world.provider.getDimension() == coordinate.getDimension()) {
      return remoteStorageTileEntity;
    }
 else {
      return null;
    }
  }
 else {
    return null;
  }
}
Program: 165857
Project: 165857
Buggy source:
@Override public IMessage onMessage(PacketGetPlayers message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetPlayers message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165858
Project: 165858
Buggy source:
@Override public IMessage onMessage(PacketGetReceivers message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetReceivers message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165859
Project: 165859
Buggy source:
@Override public IMessage onMessage(PacketGetTransmitters message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetTransmitters message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165860
Project: 165860
Buggy source:
public static void teleportToDimension(EntityPlayer player,int dimension,double x,double y,double z){
  int oldDimension=player.worldObj.provider.getDimension();
  EntityPlayerMP entityPlayerMP=(EntityPlayerMP)player;
  MinecraftServer server=((EntityPlayerMP)player).worldObj.getMinecraftServer();
  WorldServer worldServer=server.worldServerForDimension(dimension);
  player.addExperienceLevel(0);
  MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension(entityPlayerMP,dimension,new RfToolsTeleporter(worldServer,x,y,z));
  if (oldDimension == 1) {
    player.setPositionAndUpdate(x,y,z);
    worldServer.spawnEntityInWorld(player);
    worldServer.updateEntityWithOptionalForce(player,false);
  }
}

Fixed version (ground truth):
public static void teleportToDimension(EntityPlayer player,int dimension,double x,double y,double z){
  int oldDimension=player.worldObj.provider.getDimension();
  EntityPlayerMP entityPlayerMP=(EntityPlayerMP)player;
  MinecraftServer server=((EntityPlayerMP)player).worldObj.getMinecraftServer();
  WorldServer worldServer=server.worldServerForDimension(dimension);
  player.addExperienceLevel(0);
  if (oldDimension == 1) {
    player.setPositionAndUpdate(x,y,z);
    worldServer.spawnEntityInWorld(player);
    worldServer.updateEntityWithOptionalForce(player,false);
  }
}
Program: 165862
Project: 165862
Buggy source:
@Override public IMessage onMessage(PacketGetAllReceivers message,MessageContext ctx){
  MinecraftServer.getServer().addScheduledTask(() -> handle(message,ctx));
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketGetAllReceivers message,MessageContext ctx){
  FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message,ctx));
  return null;
}
Program: 165863
Project: 165863
Buggy source:
private void addDimensions(List<TeleportDestinationClientInfo> destinationList){
  WorldServer[] worlds=DimensionManager.getWorlds();
  for (  WorldServer world : worlds) {
    int id=world.provider.getDimensionId();
    TeleportDestination destination=new TeleportDestination(new BlockPos(0,70,0),id);
    destination.setName("String_Node_Str" + id);
    TeleportDestinationClientInfo teleportDestinationClientInfo=new TeleportDestinationClientInfo(destination);
    String dimName=world.provider.getDimensionName();
    teleportDestinationClientInfo.setDimensionName(dimName);
    destinationList.add(teleportDestinationClientInfo);
  }
}

Fixed version (ground truth):
private void addDimensions(List<TeleportDestinationClientInfo> destinationList){
  WorldServer[] worlds=DimensionManager.getWorlds();
  for (  WorldServer world : worlds) {
    int id=world.provider.getDimension();
    TeleportDestination destination=new TeleportDestination(new BlockPos(0,70,0),id);
    destination.setName("String_Node_Str" + id);
    TeleportDestinationClientInfo teleportDestinationClientInfo=new TeleportDestinationClientInfo(destination);
    String dimName=world.provider.getDimensionType().getName();
    teleportDestinationClientInfo.setDimensionName(dimName);
    destinationList.add(teleportDestinationClientInfo);
  }
}
Program: 165864
Project: 165864
Buggy source:
public TeleportProbeItem(){
  setUnlocalizedName("String_Node_Str");
  setCreativeTab(RFTools.tabRfTools);
  setMaxStackSize(1);
  GameRegistry.registerItem(this,"String_Node_Str");
}

Fixed version (ground truth):
public TeleportProbeItem(){
  setUnlocalizedName("String_Node_Str");
  setRegistryName("String_Node_Str");
  setCreativeTab(RFTools.tabRfTools);
  setMaxStackSize(1);
  GameRegistry.registerItem(this);
}
Program: 165865
Project: 165865
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (world.isRemote) {
    player.openGui(RFTools.instance,RFTools.GUI_TELEPORTPROBE,player.worldObj,(int)player.posX,(int)player.posY,(int)player.posZ);
    return stack;
  }
  return stack;
}

Fixed version (ground truth):
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack,World world,EntityPlayer player,EnumHand hand){
  if (world.isRemote) {
    player.openGui(RFTools.instance,RFTools.GUI_TELEPORTPROBE,player.worldObj,(int)player.posX,(int)player.posY,(int)player.posZ);
    return new ActionResult<>(EnumActionResult.SUCCESS,stack);
  }
  return new ActionResult<>(EnumActionResult.SUCCESS,stack);
}
Program: 165866
Project: 165866
Buggy source:
@SideOnly(Side.CLIENT) public void initModel(){
  ModelLoader.setCustomModelResourceLocation(this,0,new ModelResourceLocation(RFTools.MODID + "String_Node_Str" + getUnlocalizedName().substring(5),"String_Node_Str"));
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) public void initModel(){
  ModelLoader.setCustomModelResourceLocation(this,0,new ModelResourceLocation(getRegistryName(),"String_Node_Str"));
}
Program: 165867
Project: 165867
Buggy source:
public static PlayerExtendedProperties getProperties(EntityPlayer player){
  IExtendedEntityProperties properties=player.getExtendedProperties(ID);
  return (PlayerExtendedProperties)properties;
}

Fixed version (ground truth):
public static PlayerExtendedProperties getProperties(EntityPlayer player){
  return null;
}
Program: 165868
Project: 165868
Buggy source:
@SubscribeEvent public void tickEnd(TickEvent.WorldTickEvent event){
  if (event.side != Side.SERVER) {
    return;
  }
  World world=event.world;
  int dim=world.provider.getDimensionId();
  if (event.phase == TickEvent.Phase.END) {
    ArrayDeque<RetroChunkCoord> chunks=chunksToGen.get(dim);
    if (chunks != null && !chunks.isEmpty()) {
      RetroChunkCoord r=chunks.pollFirst();
      Pair<Integer,Integer> c=r.coord;
      Logging.log("String_Node_Str" + c.toString() + "String_Node_Str");
      long worldSeed=world.getSeed();
      Random rand=new Random(worldSeed);
      long xSeed=rand.nextLong() >> 2 + 1L;
      long zSeed=rand.nextLong() >> 2 + 1L;
      rand.setSeed(xSeed * c.getLeft() + zSeed * c.getRight() ^ worldSeed);
      RFToolsWorldGenerator.instance.generateWorld(rand,r.coord.getLeft(),r.coord.getRight(),world,false);
      chunksToGen.put(dim,chunks);
    }
 else     if (chunks != null) {
      chunksToGen.remove(dim);
    }
  }
 else {
    Deque<Pair<Integer,Integer>> chunks=chunksToPreGen.get(dim);
    if (chunks != null && !chunks.isEmpty()) {
      Pair<Integer,Integer> c=chunks.pollFirst();
      Logging.log("String_Node_Str" + c.toString() + "String_Node_Str");
      world.getChunkFromChunkCoords(c.getLeft(),c.getRight());
    }
 else     if (chunks != null) {
      chunksToPreGen.remove(dim);
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void tickEnd(TickEvent.WorldTickEvent event){
  if (event.side != Side.SERVER) {
    return;
  }
  World world=event.world;
  int dim=world.provider.getDimension();
  if (event.phase == TickEvent.Phase.END) {
    ArrayDeque<RetroChunkCoord> chunks=chunksToGen.get(dim);
    if (chunks != null && !chunks.isEmpty()) {
      RetroChunkCoord r=chunks.pollFirst();
      Pair<Integer,Integer> c=r.coord;
      Logging.log("String_Node_Str" + c.toString() + "String_Node_Str");
      long worldSeed=world.getSeed();
      Random rand=new Random(worldSeed);
      long xSeed=rand.nextLong() >> 2 + 1L;
      long zSeed=rand.nextLong() >> 2 + 1L;
      rand.setSeed(xSeed * c.getLeft() + zSeed * c.getRight() ^ worldSeed);
      RFToolsWorldGenerator.instance.generateWorld(rand,r.coord.getLeft(),r.coord.getRight(),world,false);
      chunksToGen.put(dim,chunks);
    }
 else     if (chunks != null) {
      chunksToGen.remove(dim);
    }
  }
 else {
    Deque<Pair<Integer,Integer>> chunks=chunksToPreGen.get(dim);
    if (chunks != null && !chunks.isEmpty()) {
      Pair<Integer,Integer> c=chunks.pollFirst();
      Logging.log("String_Node_Str" + c.toString() + "String_Node_Str");
      world.getChunkFromChunkCoords(c.getLeft(),c.getRight());
    }
 else     if (chunks != null) {
      chunksToPreGen.remove(dim);
    }
  }
}
Program: 165869
Project: 165869
Buggy source:
public void setAnchor(int anchor){
  if (supportMode) {
    clearSupportBlocks();
  }
  boxValid=false;
  this.anchor=anchor;
  if (isShapeCard()) {
    ItemStack shapeCard=inventoryHelper.getStackInSlot(BuilderContainer.SLOT_TAB);
    BlockPos dimension=ShapeCardItem.getDimension(shapeCard);
    BlockPos minBox=positionBox(dimension);
    int dx=dimension.getX();
    int dy=dimension.getY();
    int dz=dimension.getZ();
    BlockPos offset=new BlockPos(minBox.getX() + (int)Math.ceil(dx / 2),minBox.getY() + (int)Math.ceil(dy / 2),minBox.getZ() + (int)Math.ceil(dz / 2));
    NBTTagCompound tagCompound=shapeCard.getTagCompound();
    tagCompound.setInteger("String_Node_Str",offset.getX());
    tagCompound.setInteger("String_Node_Str",offset.getY());
    tagCompound.setInteger("String_Node_Str",offset.getZ());
  }
  if (supportMode) {
    makeSupportBlocks();
  }
  markDirtyClient();
}

Fixed version (ground truth):
public void setAnchor(int anchor){
  if (supportMode) {
    clearSupportBlocks();
  }
  boxValid=false;
  this.anchor=anchor;
  if (isShapeCard()) {
    ItemStack shapeCard=inventoryHelper.getStackInSlot(BuilderContainer.SLOT_TAB);
    BlockPos dimension=ShapeCardItem.getDimension(shapeCard);
    BlockPos minBox=positionBox(dimension);
    int dx=dimension.getX();
    int dy=dimension.getY();
    int dz=dimension.getZ();
    BlockPos offset=new BlockPos(minBox.getX() + (int)Math.ceil(dx / 2),minBox.getY() + (int)Math.ceil(dy / 2),minBox.getZ() + (int)Math.ceil(dz / 2));
    NBTTagCompound tagCompound=shapeCard.getTagCompound();
    if (tagCompound == null) {
      tagCompound=new NBTTagCompound();
      shapeCard.setTagCompound(tagCompound);
    }
    tagCompound.setInteger("String_Node_Str",offset.getX());
    tagCompound.setInteger("String_Node_Str",offset.getY());
    tagCompound.setInteger("String_Node_Str",offset.getZ());
  }
  if (supportMode) {
    makeSupportBlocks();
  }
  markDirtyClient();
}
Program: 165870
Project: 165870
Buggy source:
public void setShieldBlock(BlockPos c){
  shieldBlock=c;
  markDirty();
  worldObj.markBlockForUpdate(getPos());
}

Fixed version (ground truth):
public void setShieldBlock(BlockPos c){
  shieldBlock=c;
  markDirty();
  if (worldObj != null) {
    worldObj.markBlockForUpdate(getPos());
  }
}
Program: 165871
Project: 165871
Buggy source:
public void setCamoBlock(int camoId,int hasTe){
  this.camoId=camoId;
  this.hasTe=hasTe;
  if (camoId == -1) {
    block=null;
  }
 else {
    block=Block.getBlockById(camoId);
  }
  markDirty();
  worldObj.markBlockForUpdate(getPos());
}

Fixed version (ground truth):
public void setCamoBlock(int camoId,int hasTe){
  this.camoId=camoId;
  this.hasTe=hasTe;
  if (camoId == -1) {
    block=null;
  }
 else {
    block=Block.getBlockById(camoId);
  }
  markDirty();
  if (worldObj != null) {
    worldObj.markBlockForUpdate(getPos());
  }
}
Program: 165872
Project: 165872
Buggy source:
@Override public boolean isMouseOverSlot(Slot slotIn,int x,int y){
  if (slotIn.inventory == tileEntity) {
    Widget widget=window.getToplevel().getWidgetAtPosition(x,y);
    if (widget instanceof BlockRender) {
      Object userObject=widget.getUserObject();
      if (userObject instanceof Integer) {
        Integer slotIndex=(Integer)userObject;
        return slotIndex == slotIn.getSlotIndex();
      }
    }
    return false;
  }
 else {
    return super.isMouseOverSlot(slotIn,x,y);
  }
}

Fixed version (ground truth):
@Override public boolean isMouseOverSlot(Slot slotIn,int x,int y){
  if (slotIn.inventory == tileEntity) {
    Widget widget=window.getToplevel().getWidgetAtPosition(x,y);
    if (widget instanceof BlockRender) {
      Object userObject=widget.getUserObject();
      if (userObject instanceof Integer) {
        Integer slotIndex=(Integer)userObject;
        return slotIndex == slotIn.getSlotIndex();
      }
    }
 else {
      return super.isMouseOverSlot(slotIn,x,y);
    }
    return false;
  }
 else {
    return super.isMouseOverSlot(slotIn,x,y);
  }
}
Program: 165873
Project: 165873
Buggy source:
@Override public boolean isItemValidForSlot(int index,ItemStack stack){
  if (index == CoalGeneratorContainer.SLOT_CHARGEITEM) {
    return stack.getItem() instanceof IEnergyContainerItem;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isItemValidForSlot(int index,ItemStack stack){
  if (index == CoalGeneratorContainer.SLOT_CHARGEITEM) {
    return stack.getItem() instanceof IEnergyContainerItem;
  }
 else   if (index == CoalGeneratorContainer.SLOT_COALINPUT) {
    return stack.getItem() == Items.coal;
  }
  return true;
}
Program: 165874
Project: 165874
Buggy source:
public void setWhitelistMode(boolean w){
  whitelistMode=w;
  markDirty();
}

Fixed version (ground truth):
public void setWhitelistMode(boolean w){
  whitelistMode=w;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 165875
Project: 165875
Buggy source:
/** 
 * Returns TRUE if the TileEntity can connect on a given side.
 */
boolean canConnectEnergy(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns TRUE if the TileEntity can connect on a given side.
 */
boolean canConnectEnergy(EnumFacing from);
Program: 165876
Project: 165876
Buggy source:
/** 
 * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
 * @param from Orientation the energy is extracted from.
 * @param maxExtract Maximum amount of energy to extract.
 * @param simulate If TRUE, the extraction will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) extracted.
 */
@Override int extractEnergy(ForgeDirection from,int maxExtract,boolean simulate);

Fixed version (ground truth):
/** 
 * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
 * @param from Orientation the energy is extracted from.
 * @param maxExtract Maximum amount of energy to extract.
 * @param simulate If TRUE, the extraction will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) extracted.
 */
@Override int extractEnergy(EnumFacing from,int maxExtract,boolean simulate);
Program: 165877
Project: 165877
Buggy source:
/** 
 * Returns the amount of energy currently stored.
 */
@Override int getEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the amount of energy currently stored.
 */
@Override int getEnergyStored(EnumFacing from);
Program: 165878
Project: 165878
Buggy source:
/** 
 * Returns the maximum amount of energy that can be stored.
 */
@Override int getMaxEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the maximum amount of energy that can be stored.
 */
@Override int getMaxEnergyStored(EnumFacing from);
Program: 165879
Project: 165879
Buggy source:
/** 
 * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
 * @param from Orientation the energy is received from.
 * @param maxReceive Maximum amount of energy to receive.
 * @param simulate If TRUE, the charge will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) received.
 */
@Override int receiveEnergy(ForgeDirection from,int maxReceive,boolean simulate);

Fixed version (ground truth):
/** 
 * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
 * @param from Orientation the energy is received from.
 * @param maxReceive Maximum amount of energy to receive.
 * @param simulate If TRUE, the charge will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) received.
 */
@Override int receiveEnergy(EnumFacing from,int maxReceive,boolean simulate);
Program: 165880
Project: 165880
Buggy source:
/** 
 * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
 * @param from Orientation the energy is extracted from.
 * @param maxExtract Maximum amount of energy to extract.
 * @param simulate If TRUE, the extraction will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) extracted.
 */
int extractEnergy(ForgeDirection from,int maxExtract,boolean simulate);

Fixed version (ground truth):
/** 
 * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
 * @param from Orientation the energy is extracted from.
 * @param maxExtract Maximum amount of energy to extract.
 * @param simulate If TRUE, the extraction will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) extracted.
 */
int extractEnergy(EnumFacing from,int maxExtract,boolean simulate);
Program: 165881
Project: 165881
Buggy source:
/** 
 * Returns the amount of energy currently stored.
 */
int getEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the amount of energy currently stored.
 */
int getEnergyStored(EnumFacing from);
Program: 165882
Project: 165882
Buggy source:
/** 
 * Returns the maximum amount of energy that can be stored.
 */
int getMaxEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the maximum amount of energy that can be stored.
 */
int getMaxEnergyStored(EnumFacing from);
Program: 165883
Project: 165883
Buggy source:
/** 
 * Returns the amount of energy currently stored.
 */
int getEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the amount of energy currently stored.
 */
int getEnergyStored(EnumFacing from);
Program: 165884
Project: 165884
Buggy source:
/** 
 * Returns the maximum amount of energy that can be stored.
 */
int getMaxEnergyStored(ForgeDirection from);

Fixed version (ground truth):
/** 
 * Returns the maximum amount of energy that can be stored.
 */
int getMaxEnergyStored(EnumFacing from);
Program: 165885
Project: 165885
Buggy source:
/** 
 * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
 * @param from Orientation the energy is received from.
 * @param maxReceive Maximum amount of energy to receive.
 * @param simulate If TRUE, the charge will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) received.
 */
int receiveEnergy(ForgeDirection from,int maxReceive,boolean simulate);

Fixed version (ground truth):
/** 
 * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
 * @param from Orientation the energy is received from.
 * @param maxReceive Maximum amount of energy to receive.
 * @param simulate If TRUE, the charge will only be simulated.
 * @return Amount of energy that was (or would have been, if simulated) received.
 */
int receiveEnergy(EnumFacing from,int maxReceive,boolean simulate);
Program: 165886
Project: 165886
Buggy source:
@Override public int extractEnergy(ItemStack container,int maxExtract,boolean simulate){
  if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("String_Node_Str")) {
    return 0;
  }
  int energy=container.stackTagCompound.getInteger("String_Node_Str");
  int energyExtracted=Math.min(energy,Math.min(this.maxExtract,maxExtract));
  if (!simulate) {
    energy-=energyExtracted;
    container.stackTagCompound.setInteger("String_Node_Str",energy);
  }
  return energyExtracted;
}

Fixed version (ground truth):
@Override public int extractEnergy(ItemStack container,int maxExtract,boolean simulate){
  if (container.getTagCompound() == null || !container.getTagCompound().hasKey("String_Node_Str")) {
    return 0;
  }
  int energy=container.getTagCompound().getInteger("String_Node_Str");
  int energyExtracted=Math.min(energy,Math.min(this.maxExtract,maxExtract));
  if (!simulate) {
    energy-=energyExtracted;
    container.getTagCompound().setInteger("String_Node_Str",energy);
  }
  return energyExtracted;
}
Program: 165887
Project: 165887
Buggy source:
@Override public int getEnergyStored(ItemStack container){
  if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("String_Node_Str")) {
    return 0;
  }
  return container.stackTagCompound.getInteger("String_Node_Str");
}

Fixed version (ground truth):
@Override public int getEnergyStored(ItemStack container){
  if (container.getTagCompound() == null || !container.getTagCompound().hasKey("String_Node_Str")) {
    return 0;
  }
  return container.getTagCompound().getInteger("String_Node_Str");
}
Program: 165888
Project: 165888
Buggy source:
@Override public int receiveEnergy(ItemStack container,int maxReceive,boolean simulate){
  if (container.stackTagCompound == null) {
    container.stackTagCompound=new NBTTagCompound();
  }
  int energy=container.stackTagCompound.getInteger("String_Node_Str");
  int energyReceived=Math.min(capacity - energy,Math.min(this.maxReceive,maxReceive));
  if (!simulate) {
    energy+=energyReceived;
    container.stackTagCompound.setInteger("String_Node_Str",energy);
  }
  return energyReceived;
}

Fixed version (ground truth):
@Override public int receiveEnergy(ItemStack container,int maxReceive,boolean simulate){
  if (container.getTagCompound() == null) {
    container.setTagCompound(new NBTTagCompound());
  }
  int energy=container.getTagCompound().getInteger("String_Node_Str");
  int energyReceived=Math.min(capacity - energy,Math.min(this.maxReceive,maxReceive));
  if (!simulate) {
    energy+=energyReceived;
    container.getTagCompound().setInteger("String_Node_Str",energy);
  }
  return energyReceived;
}
Program: 165889
Project: 165889
Buggy source:
@Override public boolean canConnectEnergy(ForgeDirection from){
  return true;
}

Fixed version (ground truth):
@Override public boolean canConnectEnergy(EnumFacing from){
  return true;
}
Program: 165890
Project: 165890
Buggy source:
@Override public int extractEnergy(ForgeDirection from,int maxExtract,boolean simulate){
  return storage.extractEnergy(maxExtract,simulate);
}

Fixed version (ground truth):
@Override public int extractEnergy(EnumFacing from,int maxExtract,boolean simulate){
  return storage.extractEnergy(maxExtract,simulate);
}
Program: 165891
Project: 165891
Buggy source:
@Override public int getEnergyStored(ForgeDirection from){
  return storage.getEnergyStored();
}

Fixed version (ground truth):
@Override public int getEnergyStored(EnumFacing from){
  return storage.getEnergyStored();
}
Program: 165892
Project: 165892
Buggy source:
@Override public int getMaxEnergyStored(ForgeDirection from){
  return storage.getMaxEnergyStored();
}

Fixed version (ground truth):
@Override public int getMaxEnergyStored(EnumFacing from){
  return storage.getMaxEnergyStored();
}
Program: 165893
Project: 165893
Buggy source:
@Override public int receiveEnergy(ForgeDirection from,int maxReceive,boolean simulate){
  return storage.receiveEnergy(maxReceive,simulate);
}

Fixed version (ground truth):
@Override public int receiveEnergy(EnumFacing from,int maxReceive,boolean simulate){
  return storage.receiveEnergy(maxReceive,simulate);
}
Program: 165894
Project: 165894
Buggy source:
boolean shouldRedstoneConduitConnect(World world,int x,int y,int z,ForgeDirection from);

Fixed version (ground truth):
boolean shouldRedstoneConduitConnect(World world,int x,int y,int z,EnumFacing from);
Program: 165895
Project: 165895
Buggy source:
/** 
 * If false this connection will be treated the same a regular powered block. No power will be drawn over the connection and it will not be used to balance capacitor bank levels
 * @param direction
 * @return
 */
boolean isNetworkControlledIo(ForgeDirection direction);

Fixed version (ground truth):
/** 
 * If false this connection will be treated the same a regular powered block. No power will be drawn over the connection and it will not be used to balance capacitor bank levels
 * @param direction
 * @return
 */
boolean isNetworkControlledIo(EnumFacing direction);
Program: 165896
Project: 165896
Buggy source:
boolean isInputEnabled(ForgeDirection direction);

Fixed version (ground truth):
boolean isInputEnabled(EnumFacing direction);
Program: 165897
Project: 165897
Buggy source:
boolean isOutputEnabled(ForgeDirection direction);

Fixed version (ground truth):
boolean isOutputEnabled(EnumFacing direction);
Program: 165898
Project: 165898
Buggy source:
private void teleportEntity(World world,World destWorld,Entity entity,double newX,double newY,double newZ){
  if (entity instanceof EntityPlayer) {
    if (world.provider.dimensionId != destWorld.provider.dimensionId) {
      TeleportationTools.teleportToDimension((EntityPlayer)entity,destWorld.provider.dimensionId,newX,newY,newZ);
    }
    ((EntityPlayer)entity).setPositionAndUpdate(newX,newY,newZ);
  }
 else {
    if (world.provider.dimensionId != destWorld.provider.dimensionId) {
      MinecraftServer.getServer().getConfigurationManager().transferEntityToWorld(entity,destWorld.provider.dimensionId,(WorldServer)world,(WorldServer)destWorld,new RfToolsTeleporter((WorldServer)destWorld,newX,newY,newZ));
    }
    entity.setPosition(newX,newY,newZ);
  }
}

Fixed version (ground truth):
private void teleportEntity(World world,World destWorld,Entity entity,double newX,double newY,double newZ){
  if (entity instanceof EntityPlayer) {
    if (world.provider.dimensionId != destWorld.provider.dimensionId) {
      TeleportationTools.teleportToDimension((EntityPlayer)entity,destWorld.provider.dimensionId,newX,newY,newZ);
    }
    ((EntityPlayer)entity).setPositionAndUpdate(newX,newY,newZ);
  }
 else {
    if (world.provider.dimensionId != destWorld.provider.dimensionId) {
      transferEntityToWorld(entity,(WorldServer)world,(WorldServer)destWorld,new RfToolsTeleporter((WorldServer)destWorld,newX,newY,newZ),newX,newY,newZ);
    }
 else {
      entity.setLocationAndAngles(newX,newY,newZ,entity.rotationYaw,entity.rotationPitch);
      destWorld.updateEntityWithOptionalForce(entity,false);
    }
  }
}
Program: 165899
Project: 165899
Buggy source:
private int rotateMeta(Block block,int meta,SpaceProjectorSetup.BlockInformation information,int rotMode){
  Item item=Item.getItemFromBlock(block);
  if (item.getHasSubtypes()) {
    return meta;
  }
switch (information.getRotateInfo()) {
case SpaceProjectorSetup.BlockInformation.ROTATE_mfff:
switch (rotMode) {
case 0:
      return meta;
case 1:
{
      ForgeDirection dir=ForgeDirection.values()[meta & 7];
      return (meta & 8) | dir.getRotation(ForgeDirection.UP).ordinal();
    }
case 2:
{
    ForgeDirection dir=ForgeDirection.values()[meta & 7];
    return (meta & 8) | dir.getOpposite().ordinal();
  }
case 3:
{
  ForgeDirection dir=ForgeDirection.values()[meta & 7];
  return (meta & 8) | dir.getOpposite().getRotation(ForgeDirection.UP).ordinal();
}
}
break;
case SpaceProjectorSetup.BlockInformation.ROTATE_mmmm:
return meta;
}
return meta;
}

Fixed version (ground truth):
private int rotateMeta(Block block,int meta,SpaceProjectorSetup.BlockInformation information,int rotMode){
  Item item=Item.getItemFromBlock(block);
  if (item != null && item.getHasSubtypes()) {
    return meta;
  }
switch (information.getRotateInfo()) {
case SpaceProjectorSetup.BlockInformation.ROTATE_mfff:
switch (rotMode) {
case 0:
      return meta;
case 1:
{
      ForgeDirection dir=ForgeDirection.values()[meta & 7];
      return (meta & 8) | dir.getRotation(ForgeDirection.UP).ordinal();
    }
case 2:
{
    ForgeDirection dir=ForgeDirection.values()[meta & 7];
    return (meta & 8) | dir.getOpposite().ordinal();
  }
case 3:
{
  ForgeDirection dir=ForgeDirection.values()[meta & 7];
  return (meta & 8) | dir.getOpposite().getRotation(ForgeDirection.UP).ordinal();
}
}
break;
case SpaceProjectorSetup.BlockInformation.ROTATE_mmmm:
return meta;
}
return meta;
}
Program: 165900
Project: 165900
Buggy source:
private void calculateBoxShaped(){
  ItemStack shapeCard=inventoryHelper.getStackInSlot(BuilderContainer.SLOT_TAB);
  Coordinate dimension=ShapeCardItem.getClampedDimension(shapeCard,SpaceProjectorConfiguration.maxBuilderDimension);
  Coordinate offset=ShapeCardItem.getClampedOffset(shapeCard,SpaceProjectorConfiguration.maxBuilderOffset);
  Coordinate minCorner=ShapeCardItem.getMinCorner(getCoordinate(),dimension,offset);
  Coordinate maxCorner=ShapeCardItem.getMaxCorner(getCoordinate(),dimension,offset);
  if (minCorner.getY() < 0) {
    minCorner=new Coordinate(minCorner.getX(),0,minCorner.getZ());
  }
 else   if (minCorner.getY() > 255) {
    minCorner=new Coordinate(minCorner.getX(),255,minCorner.getZ());
  }
  if (maxCorner.getY() < 0) {
    maxCorner=new Coordinate(maxCorner.getX(),0,maxCorner.getZ());
  }
 else   if (maxCorner.getY() > 255) {
    maxCorner=new Coordinate(maxCorner.getX(),255,maxCorner.getZ());
  }
  if (boxValid) {
    if (minCorner.equals(minBox) && maxCorner.equals(maxBox)) {
      return;
    }
  }
  boxValid=true;
  cardType=shapeCard.getItemDamage();
  cachedBlocks=null;
  cachedChunk=null;
  minBox=minCorner;
  maxBox=maxCorner;
  restartScan();
}

Fixed version (ground truth):
private void calculateBoxShaped(){
  ItemStack shapeCard=inventoryHelper.getStackInSlot(BuilderContainer.SLOT_TAB);
  if (shapeCard == null) {
    return;
  }
  Coordinate dimension=ShapeCardItem.getClampedDimension(shapeCard,SpaceProjectorConfiguration.maxBuilderDimension);
  Coordinate offset=ShapeCardItem.getClampedOffset(shapeCard,SpaceProjectorConfiguration.maxBuilderOffset);
  Coordinate minCorner=ShapeCardItem.getMinCorner(getCoordinate(),dimension,offset);
  Coordinate maxCorner=ShapeCardItem.getMaxCorner(getCoordinate(),dimension,offset);
  if (minCorner.getY() < 0) {
    minCorner=new Coordinate(minCorner.getX(),0,minCorner.getZ());
  }
 else   if (minCorner.getY() > 255) {
    minCorner=new Coordinate(minCorner.getX(),255,minCorner.getZ());
  }
  if (maxCorner.getY() < 0) {
    maxCorner=new Coordinate(maxCorner.getX(),0,maxCorner.getZ());
  }
 else   if (maxCorner.getY() > 255) {
    maxCorner=new Coordinate(maxCorner.getX(),255,maxCorner.getZ());
  }
  if (boxValid) {
    if (minCorner.equals(minBox) && maxCorner.equals(maxBox)) {
      return;
    }
  }
  boxValid=true;
  cardType=shapeCard.getItemDamage();
  cachedBlocks=null;
  cachedChunk=null;
  minBox=minCorner;
  maxBox=maxCorner;
  restartScan();
}
Program: 165901
Project: 165901
Buggy source:
private void restartScan(){
  chunkUnload();
  if (loopMode || (powered > 0 && scan == null)) {
    if (getCardType() == ShapeCardItem.CARD_SPACE) {
      calculateBox();
      scan=minBox;
    }
 else {
      calculateBoxShaped();
      scan=new Coordinate(minBox.getX(),maxBox.getY(),minBox.getZ());
    }
    cachedBlocks=null;
    cachedChunk=null;
  }
 else {
    scan=null;
  }
}

Fixed version (ground truth):
private void restartScan(){
  chunkUnload();
  if (loopMode || (powered > 0 && scan == null)) {
    if (getCardType() == ShapeCardItem.CARD_SPACE) {
      calculateBox();
      scan=minBox;
    }
 else     if (getCardType() != ShapeCardItem.CARD_UNKNOWN) {
      calculateBoxShaped();
      scan=new Coordinate(minBox.getX(),maxBox.getY(),minBox.getZ());
    }
    cachedBlocks=null;
    cachedChunk=null;
  }
 else {
    scan=null;
  }
}
Program: 165902
Project: 165902
Buggy source:
public void setAnchor(int anchor){
  if (supportMode) {
    clearSupportBlocks();
  }
  this.anchor=anchor;
  if (supportMode) {
    makeSupportBlocks();
  }
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}

Fixed version (ground truth):
public void setAnchor(int anchor){
  if (supportMode) {
    clearSupportBlocks();
  }
  boxValid=false;
  this.anchor=anchor;
  if (supportMode) {
    makeSupportBlocks();
  }
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 165903
Project: 165903
Buggy source:
public void preInit(FMLPreInitializationEvent e){
  GeneralConfig.preInit(e);
  modConfigDir=e.getModConfigurationDirectory();
  mainConfig=new Configuration(new File(modConfigDir.getPath() + File.separator + "String_Node_Str","String_Node_Str"));
  readMainConfig();
  SimpleNetworkWrapper network=PacketHandler.registerMessages("String_Node_Str");
  RFToolsMessages.registerNetworkMessages(network);
  ModItems.init();
  ModBlocks.init();
  ModCrafting.init();
  ModDimensions.init();
}

Fixed version (ground truth):
public void preInit(FMLPreInitializationEvent e){
  GeneralConfig.preInit(e);
  modConfigDir=e.getModConfigurationDirectory();
  mainConfig=new Configuration(new File(modConfigDir.getPath() + File.separator + "String_Node_Str","String_Node_Str"));
  readMainConfig();
  SimpleNetworkWrapper network=PacketHandler.registerMessages("String_Node_Str");
  RFToolsMessages.registerNetworkMessages(network);
  ModItems.init();
  ModBlocks.init();
  ModCrafting.init();
  ModDimensions.init();
  KnownDimletConfiguration.setupChestLoot();
}
Program: 165905
Project: 165905
Buggy source:
private static void setupChestLoot(String category){
  ChestGenHooks chest=ChestGenHooks.getInfo(category);
  chest.addItem(new WeightedRandomChestContent(DimletSetup.unknownDimlet,0,DimletConfiguration.unknownDimletChestLootMinimum,DimletConfiguration.unknownDimletChestLootMaximum,DimletConfiguration.unknownDimletChestLootRarity));
}

Fixed version (ground truth):
private static void setupChestLoot(String category){
  if (DimletConfiguration.unknownDimletChestLootRarity > 0) {
    ChestGenHooks chest=ChestGenHooks.getInfo(category);
    chest.addItem(new WeightedRandomChestContent(DimletSetup.unknownDimlet,0,DimletConfiguration.unknownDimletChestLootMinimum,DimletConfiguration.unknownDimletChestLootMaximum,DimletConfiguration.unknownDimletChestLootRarity));
  }
}
Program: 165906
Project: 165906
Buggy source:
@Override public void choiceChanged(Widget parent,String newChoice){
  updateShape();
}

Fixed version (ground truth):
@Override public void choiceChanged(Widget parent,String newChoice){
  updateSettings();
}