nus-yam/ex-repair huggingface dataset:
Program: 169628
Project: 169628
Buggy source:
/** 
 * Called to split a network when a tile is removed
 * @param splitPoint
 */
public void split(TileAntennaPart splitPoint){
  if (splitPoint == base) {
    base=null;
    kill();
  }
 else   if (splitPoint.connections.size() > 1) {
    kill();
  }
 else {
    remove(splitPoint);
    splitPoint.network=null;
    base=null;
  }
}

Fixed version (ground truth):
/** 
 * Called to split a network when a tile is removed
 * @param splitPoint
 */
public void split(TileAntennaPart splitPoint){
  TileAntenna base=this.base;
  kill();
  if (splitPoint != base) {
    base.doInitScan();
  }
}
Program: 169629
Project: 169629
Buggy source:
public void kill(){
  for (  TileAntennaPart tile : this) {
    tile.network=null;
  }
  this.clear();
  if (base != null) {
    base.doInitScan();
  }
}

Fixed version (ground truth):
public void kill(){
  for (  TileAntennaPart tile : this) {
    tile.network=null;
  }
  this.clear();
  base=null;
}
Program: 169630
Project: 169630
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  TileEntity tile=world.getTileEntity(x,y,z);
  if (tile instanceof TileAntennaPart && ((TileAntennaPart)tile).network != null) {
    ((TileAntennaPart)tile).network.split((TileAntennaPart)tile);
    if (((TileAntennaPart)tile).connections.size() > 0) {
      for (      TileEntity t : ((TileAntennaPart)tile).connections.values()) {
        if (t instanceof TileAntennaPart) {
          ((TileAntennaPart)t).doConnectionUpdate=true;
        }
      }
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  if (!world.isRemote) {
    TileEntity tile=world.getTileEntity(x,y,z);
    if (tile instanceof TileAntennaPart && ((TileAntennaPart)tile).network != null) {
      ((TileAntennaPart)tile).network.split((TileAntennaPart)tile);
      if (((TileAntennaPart)tile).connections.size() > 0) {
        for (        TileEntity t : ((TileAntennaPart)tile).connections.values()) {
          if (t instanceof TileAntennaPart) {
            ((TileAntennaPart)t).doConnectionUpdate=true;
          }
        }
      }
    }
  }
  super.breakBlock(world,x,y,z,block,meta);
}
Program: 169631
Project: 169631
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (ticks % randomTick == 0) {
    randomTick=MathHelper.rand.nextInt(200) + 1000;
    if (ticks != 30 || !hasInitScanned) {
      doInitScan();
    }
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!world().isRemote) {
    if (ticks >= randomTick) {
      int addition=MathHelper.rand.nextInt(200) + 1000;
      if (addition + ticks < 0) {
        randomTick=addition - (Integer.MAX_VALUE - ticks);
      }
 else {
        randomTick=ticks + addition;
      }
      doInitScan();
    }
  }
}
Program: 169632
Project: 169632
Buggy source:
@Override public void invalidate(){
  super.invalidate();
  network.kill();
  RadioRegistry.remove(this);
}

Fixed version (ground truth):
@Override public void invalidate(){
  super.invalidate();
  if (network != null) {
    network.kill();
  }
  RadioRegistry.remove(this);
}
Program: 169633
Project: 169633
Buggy source:
/** 
 * Called to scan the structure of the antenna
 */
public void doInitScan(){
  hasInitScanned=true;
  if (network == null) {
    network=new AntennaNetwork();
    network.base=this;
  }
  if (connections.isEmpty()) {
    updateConnections();
  }
  long time=System.nanoTime();
  ICBM.INSTANCE.logger().info(this + "String_Node_Str");
  List<TileAntennaPart> pathedTiles=new ArrayList();
  Queue<TileAntennaPart> stack=new LinkedList();
  stack.offer(this);
  while (!stack.isEmpty()) {
    TileAntennaPart currentNode=stack.poll();
    pathedTiles.add(currentNode);
    if (currentNode != this) {
      network.add(currentNode);
    }
    if (currentNode.connections.size() == 0) {
      currentNode.updateConnections();
    }
    if (currentNode.connections.size() > 1) {
      for (      TileEntity tile : currentNode.connections.values()) {
        if (tile instanceof TileAntennaPart && !pathedTiles.contains(tile)) {
          stack.offer((TileAntennaPart)tile);
        }
      }
    }
  }
  time=System.nanoTime() - time;
  ICBM.INSTANCE.logger().info(this + "String_Node_Str" + StringHelpers.formatNanoTime(time));
  network.updateBounds();
  RadioRegistry.addOrUpdate(this);
  this.invalidate();
}

Fixed version (ground truth):
/** 
 * Called to scan the structure of the antenna
 */
public void doInitScan(){
  hasInitScanned=true;
  if (network == null) {
    network=new AntennaNetwork();
    network.add(this);
    network.base=this;
  }
  if (connections.isEmpty()) {
    updateConnections();
  }
  long time=System.nanoTime();
  ICBM.INSTANCE.logger().info(this + "String_Node_Str");
  List<TileAntennaPart> pathedTiles=new ArrayList();
  Queue<TileAntennaPart> stack=new LinkedList();
  stack.offer(this);
  while (!stack.isEmpty()) {
    TileAntennaPart currentNode=stack.poll();
    pathedTiles.add(currentNode);
    if (currentNode != this) {
      network.add(currentNode);
    }
    if (currentNode.connections.size() == 0) {
      currentNode.updateConnections();
    }
    if (currentNode.connections.size() > 1) {
      for (      TileEntity tile : currentNode.connections.values()) {
        if (tile instanceof TileAntennaPart && !pathedTiles.contains(tile)) {
          stack.offer((TileAntennaPart)tile);
        }
      }
    }
  }
  time=System.nanoTime() - time;
  ICBM.INSTANCE.logger().info(this + "String_Node_Str" + StringHelpers.formatNanoTime(time));
  network.updateBounds();
  RadioRegistry.addOrUpdate(this);
}
Program: 169634
Project: 169634
Buggy source:
private void nodeWarheadRecipes(){
  ItemStack micro_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,(ItemStack)null).toStack();
  ItemStack small_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_SMALL,(ItemStack)null).toStack();
  ItemStack taintBottleMicroMissile=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,ExplosiveRegistry.get("String_Node_Str")).toStack();
  AspectList aspects=new AspectList();
  aspects.add(Aspect.TOOL,1).add(Aspect.MECHANISM,2).add(Aspect.TRAVEL,1);
  InfusionRecipeJar recipeJar=new InfusionRecipeJar("String_Node_Str",0,new AspectList().add(Aspect.ORDER,25).add(Aspect.FIRE,25),new ItemStack[]{micro_warhead_empty});
  InfusionRecipeJar recipeJar1=new InfusionRecipeJar("String_Node_Str",0,new AspectList().add(Aspect.ORDER,25).add(Aspect.FIRE,25),new ItemStack[]{small_warhead_empty});
  ResearchItem researchPage=new ResearchItemICBM("String_Node_Str",ICBM.NAME,aspects,-3,4,3,taintBottleMicroMissile);
  researchPage.setPages(new ResearchPage[]{getResearchPage("String_Node_Str"),new ResearchPage(recipeJar),new ResearchPage(recipeJar1)}).setParents("String_Node_Str").registerResearchItem();
}

Fixed version (ground truth):
private void nodeWarheadRecipes(){
  ItemStack micro_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,(ItemStack)null).toStack();
  ItemStack small_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_SMALL,(ItemStack)null).toStack();
  ItemStack taintBottleMicroMissile=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,ExplosiveRegistry.get("String_Node_Str")).toStack();
  AspectList aspects=new AspectList();
  aspects.add(Aspect.TOOL,1).add(Aspect.MECHANISM,2).add(Aspect.TRAVEL,1);
}
Program: 169635
Project: 169635
Buggy source:
/** 
 * Builds a warhead using a size and explosive handler
 * @param size      - casing size
 * @param explosive - item to use as an explosive, does not check if valid
 * @return new Warhead instance of the size
 */
public Warhead buildWarhead(WarheadCasings size,ItemStack explosive){
  try {
    Warhead warhead=size.warhead_clazz.getConstructor(ItemStack.class).newInstance(new ItemStack(ICBM.blockWarhead,1,size.ordinal()));
    warhead.setExplosive(explosive);
    return warhead;
  }
 catch (  InstantiationException e) {
    e.printStackTrace();
  }
catch (  IllegalAccessException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Builds a warhead using a size given
 * @param size - casing size
 * @return new Warhead instance of the size
 */
public Warhead buildWarhead(WarheadCasings size){
  try {
    return size.warhead_clazz.getConstructor(ItemStack.class).newInstance(new ItemStack(ICBM.blockWarhead,1,size.ordinal()));
  }
 catch (  InstantiationException e) {
    e.printStackTrace();
  }
catch (  IllegalAccessException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 169636
Project: 169636
Buggy source:
@Override public double getExplosiveSize(){
  if (explosive != null && explosive.getItem() instanceof IExplosiveHolderItem) {
    return ((IExplosiveHolderItem)explosive.getItem()).getExplosiveSize(explosive);
  }
  return -1;
}

Fixed version (ground truth):
@Override public double getExplosiveSize(){
  return ExplosiveRegistry.getExplosiveSize(explosive);
}
Program: 169637
Project: 169637
Buggy source:
@Override public IExplosiveHandler getExplosive(){
  if (explosive != null && explosive.getItem() instanceof IExplosiveItem) {
    return ((IExplosiveItem)explosive.getItem()).getExplosive(explosive);
  }
  return null;
}

Fixed version (ground truth):
@Override public IExplosiveHandler getExplosive(){
  return ExplosiveRegistry.get(explosive);
}
Program: 169638
Project: 169638
Buggy source:
public static void getRecipes(IExplosiveHandler handler,List<IRecipe> recipes){
  final ItemStack micro_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,(ItemStack)null).toStack();
  final ItemStack small_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_SMALL,(ItemStack)null).toStack();
  final ItemStack medium_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_STANDARD,(ItemStack)null).toStack();
  List<ItemStackWrapper> items=ExplosiveRegistry.getItems(handler);
  if (items != null) {
    for (    ItemStackWrapper wrapper : items) {
      ItemStack stack=wrapper.itemStack.copy();
      stack.stackSize=1;
      double size=ExplosiveRegistry.getExplosiveSize(wrapper);
      WarheadRecipe microWarheadRecipe=new WarheadRecipe(WarheadCasings.EXPLOSIVE_MICRO,handler,size,stack,micro_warhead_empty);
      recipes.add(microWarheadRecipe);
      recipes.add(new MicroMissileRecipe(wrapper.itemStack,MissileModuleBuilder.INSTANCE.buildMissile(MissileCasings.MICRO,(ItemStack)null).toStack(),microWarheadRecipe.getRecipeOutput()));
      recipes.add(new WarheadRecipe(WarheadCasings.EXPLOSIVE_SMALL,handler,size,stack,small_warhead_empty));
      recipes.add(new WarheadRecipe(WarheadCasings.EXPLOSIVE_STANDARD,handler,size,stack,medium_warhead_empty));
    }
  }
}

Fixed version (ground truth):
/** 
 * Gets a list of warhead recipes for the given explosive. Will return an empty list if the explosive has no items registered.
 * @param handler - explosive, with valid items
 * @param recipes - list to add recipes to
 */
public static void getRecipes(IExplosiveHandler handler,List<IRecipe> recipes){
  List<ItemStackWrapper> items=ExplosiveRegistry.getItems(handler);
  if (items != null) {
    final ItemStack micro_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_MICRO,(ItemStack)null).toStack();
    final ItemStack small_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_SMALL,(ItemStack)null).toStack();
    final ItemStack medium_warhead_empty=MissileModuleBuilder.INSTANCE.buildWarhead(WarheadCasings.EXPLOSIVE_STANDARD,(ItemStack)null).toStack();
    for (    ItemStackWrapper wrapper : items) {
      if (wrapper != null && wrapper.itemStack != null) {
        ItemStack stack=wrapper.itemStack.copy();
        stack.stackSize=1;
        WarheadRecipe microWarheadRecipe=new WarheadRecipe(WarheadCasings.EXPLOSIVE_MICRO,stack,stack,micro_warhead_empty);
        recipes.add(microWarheadRecipe);
        recipes.add(new MicroMissileRecipe(wrapper.itemStack,MissileModuleBuilder.INSTANCE.buildMissile(MissileCasings.MICRO,(ItemStack)null).toStack(),microWarheadRecipe.getRecipeOutput()));
        recipes.add(new WarheadRecipe(WarheadCasings.EXPLOSIVE_SMALL,stack,stack,small_warhead_empty));
        recipes.add(new WarheadRecipe(WarheadCasings.EXPLOSIVE_STANDARD,stack,stack,medium_warhead_empty));
      }
 else {
        Engine.error("String_Node_Str" + handler + "String_Node_Str"+ wrapper);
      }
    }
  }
}
Program: 169639
Project: 169639
Buggy source:
@Test public void testWarheadCasings(){
  for (  WarheadCasings casing : WarheadCasings.values()) {
    Warhead warhead=MissileModuleBuilder.INSTANCE.buildWarhead(casing,(ItemStack)null);
    assertNotNull(warhead);
    assertNotNull(warhead.toStack());
    assertNotNull(warhead.toStack().getItem());
    assertNull(warhead.getExplosive());
    assertNull(warhead.explosive);
    assertTrue(warhead.getAdditionalExplosiveData() == null || warhead.getAdditionalExplosiveData().hasNoTags());
    for (    IExplosiveHandler ex : ExplosiveRegistry.getExplosives()) {
      warhead=MissileModuleBuilder.INSTANCE.buildWarhead(casing,ex);
      assertNotNull(warhead);
      assertNotNull(warhead.toStack());
      assertNotNull(warhead.toStack().getItem());
      assertEquals(warhead.getExplosive(),ex);
    }
    for (    ItemExplosive.ExplosiveItems exItem : ItemExplosive.ExplosiveItems.values()) {
      if (exItem.ex_name != null) {
        assertTrue(exItem.ex_name,exItem.getExplosive() != null);
        warhead=MissileModuleBuilder.INSTANCE.buildWarhead(casing,exItem.getExplosive());
        assertNotNull(warhead);
        assertNotNull(warhead.toStack());
        assertNotNull(warhead.toStack().getItem());
        assertEquals(warhead.getExplosive(),exItem.getExplosive());
      }
    }
  }
}

Fixed version (ground truth):
@Test public void testWarheadCasings(){
  for (  WarheadCasings casing : WarheadCasings.values()) {
    Warhead warhead=MissileModuleBuilder.INSTANCE.buildWarhead(casing,(ItemStack)null);
    assertNotNull(warhead);
    assertNotNull(warhead.toStack());
    assertNotNull(warhead.toStack().getItem());
    assertNull(warhead.getExplosive());
    assertNull(warhead.explosive);
    assertTrue(warhead.getAdditionalExplosiveData() == null || warhead.getAdditionalExplosiveData().hasNoTags());
    for (    ItemExplosive.ExplosiveItems exItem : ItemExplosive.ExplosiveItems.values()) {
      if (exItem.ex_name != null) {
        assertTrue(exItem.ex_name,exItem.getExplosive() != null);
        warhead=MissileModuleBuilder.INSTANCE.buildWarhead(casing,exItem.newItem());
        assertNotNull(warhead);
        assertNotNull(warhead.toStack());
        assertNotNull(warhead.toStack().getItem());
        assertEquals(warhead.getExplosive(),exItem.getExplosive());
      }
    }
  }
}
Program: 169640
Project: 169640
Buggy source:
public AbstractModule(ItemStack item,String name){
  this.item=item;
  this.name=name;
}

Fixed version (ground truth):
public AbstractModule(ItemStack item,String name){
  this.item=item.copy();
  this.name=name;
}
Program: 169642
Project: 169642
Buggy source:
public WarheadRecipe(Warhead warhead,Object... recipe){
  super(warhead.toStack(),recipe);
  craftingResult=warhead;
}

Fixed version (ground truth):
public WarheadRecipe(Warhead warhead,ItemStack inputTarget){
  this.craftingResult=warhead;
  this.inputTarget=inputTarget;
}
Program: 169643
Project: 169643
Buggy source:
@Override public void preInit(){
  super.preInit();
  ICBM.blockMissileWorkstation=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileSmallMissileWorkstationClient.class);
}

Fixed version (ground truth):
@Override public void preInit(){
  super.preInit();
  ICBM.blockMissileWorkstation=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileSmallMissileWorkstationClient.class);
  ICBM.blockStandardLauncher=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileStandardLauncherClient.class);
  ICBM.blockStandardLauncher.setCreativeTab(null);
  NEIProxy.hideItem(ICBM.blockStandardLauncher);
}
Program: 169645
Project: 169645
Buggy source:
@Override public void preInit(){
  super.preInit();
  ICBM.blockMissileWorkstation=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileSmallMissileWorkstation.class);
}

Fixed version (ground truth):
@Override public void preInit(){
  super.preInit();
  ICBM.blockMissileWorkstation=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileSmallMissileWorkstation.class);
  ICBM.blockStandardLauncher=ICBM.INSTANCE.getManager().newBlock("String_Node_Str",TileStandardLauncher.class);
}
Program: 169646
Project: 169646
Buggy source:
protected int addRods(int count){
  if (!frameCompleted) {
    int addition=Math.min(count,Math.max(MAX_ROD_COUNT - rodsContained,0));
    if (addition > 0) {
      rodsContained+=addition;
      frameLevel=rodsContained % ROD_PER_LEVEL_COUNT;
      if (frameLevel >= MAX_ROD_LEVEL_COUNT) {
        frameCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}

Fixed version (ground truth):
protected int addRods(int count){
  if (!frameCompleted) {
    int addition=Math.min(count,Math.max(MAX_ROD_COUNT - rodsContained,0));
    if (addition > 0) {
      rodsContained+=addition;
      frameLevel=rodsContained / ROD_PER_LEVEL_COUNT;
      if (frameLevel >= MAX_ROD_LEVEL_COUNT) {
        frameCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}
Program: 169647
Project: 169647
Buggy source:
protected int addPlates(int count){
  if (!skinCompleted) {
    int addition=Math.min(count,Math.max(MAX_PLATE_COUNT - platesContained,0));
    if (addition > 0) {
      platesContained+=addition;
      plateLevel=platesContained % PLATE_PER_LEVEL_COUNT;
      if (plateLevel >= MAX_PLATE_LEVEL_COUNT) {
        skinCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}

Fixed version (ground truth):
protected int addPlates(int count){
  if (!skinCompleted) {
    int addition=Math.min(count,Math.max(MAX_PLATE_COUNT - platesContained,0));
    if (addition > 0) {
      platesContained+=addition;
      plateLevel=platesContained / PLATE_PER_LEVEL_COUNT;
      if (plateLevel >= MAX_PLATE_LEVEL_COUNT) {
        skinCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}
Program: 169648
Project: 169648
Buggy source:
@Override public NBTTagCompound save(NBTTagCompound nbt){
  nbt.setInteger("String_Node_Str",rodsContained);
  nbt.setInteger("String_Node_Str",platesContained);
  if (rocketComputer != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    rocketComputer.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  if (rocketEngine != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    rocketEngine.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  if (warhead != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    warhead.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  return nbt;
}

Fixed version (ground truth):
@Override public NBTTagCompound save(NBTTagCompound nbt){
  nbt.setInteger("String_Node_Str",rodsContained);
  nbt.setInteger("String_Node_Str",platesContained);
  if (rocketComputer != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    rocketComputer.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  if (rocketEngine != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    rocketEngine.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  if (warhead != null) {
    NBTTagCompound cTag=new NBTTagCompound();
    warhead.writeToNBT(cTag);
    nbt.setTag("String_Node_Str",cTag);
  }
  if (rocketComputer != null && rocketEngine != null) {
    this.gutsCompleted=true;
  }
  return nbt;
}
Program: 169650
Project: 169650
Buggy source:
@Override public ByteBuf writeBytes(ByteBuf buf){
  return buf;
}

Fixed version (ground truth):
@Override public ByteBuf writeBytes(ByteBuf buf){
  buf.writeInt(frameLevel);
  buf.writeInt(plateLevel);
  ByteBufUtils.writeItemStack(buf,warhead != null ? warhead : new ItemStack(Blocks.stone));
  ByteBufUtils.writeItemStack(buf,rocketComputer != null ? rocketComputer : new ItemStack(Blocks.stone));
  ByteBufUtils.writeItemStack(buf,rocketEngine != null ? rocketEngine : new ItemStack(Blocks.stone));
  return buf;
}
Program: 169651
Project: 169651
Buggy source:
@Override public void load(NBTTagCompound nbt){
  int rods=nbt.getInteger("String_Node_Str");
  int plates=nbt.getInteger("String_Node_Str");
  if (rods > 0) {
    addRods(rods);
  }
  if (plates > 0) {
    addPlates(plates);
  }
  if (nbt.hasKey("String_Node_Str")) {
    rocketComputer=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (rocketComputer != null && !(rocketComputer.getItem() instanceof IGuidance)) {
      System.out.println("String_Node_Str");
    }
  }
  if (nbt.hasKey("String_Node_Str")) {
    rocketEngine=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (rocketEngine != null && !(rocketEngine.getItem() instanceof IRocketEngine)) {
      System.out.println("String_Node_Str");
    }
  }
  if (nbt.hasKey("String_Node_Str")) {
    warhead=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (warhead != null && !(warhead.getItem() instanceof IWarhead)) {
      System.out.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void load(NBTTagCompound nbt){
  int rods=nbt.getInteger("String_Node_Str");
  int plates=nbt.getInteger("String_Node_Str");
  if (rods > 0) {
    addRods(rods);
  }
  if (plates > 0) {
    addPlates(plates);
  }
  if (nbt.hasKey("String_Node_Str")) {
    rocketComputer=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (rocketComputer != null && !(rocketComputer.getItem() instanceof IModuleItem)) {
      System.out.println("String_Node_Str");
    }
  }
  if (nbt.hasKey("String_Node_Str")) {
    rocketEngine=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (rocketEngine != null && !(rocketEngine.getItem() instanceof IModuleItem)) {
      System.out.println("String_Node_Str");
    }
  }
  if (nbt.hasKey("String_Node_Str")) {
    warhead=ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("String_Node_Str"));
    if (warhead != null && !(warhead.getItem() instanceof IModuleItem)) {
      System.out.println("String_Node_Str");
    }
  }
}
Program: 169652
Project: 169652
Buggy source:
/** 
 * Checks if the item is part of the recipe, and is still required by the recipe.
 * @param stack - stack being added,can be null but will return false
 * @return true if the item can be added.
 */
public boolean canAddItem(final ItemStack stack){
  if (stack != null) {
    if (isRod(stack) && !frameCompleted) {
      return true;
    }
 else     if (isPlate(stack) && !skinCompleted) {
      return true;
    }
 else {
      Item item=stack.getItem();
      if (item instanceof IRocketEngine) {
        return ((IMissileModule)item).getMissileSize() == MissileCasings.STANDARD.ordinal();
      }
 else       if (item instanceof IWarhead) {
        return true;
      }
 else       if (item instanceof IGuidance) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the item is part of the recipe, and is still required by the recipe.
 * @param stack - stack being added,can be null but will return false
 * @return true if the item can be added.
 */
public boolean canAddItem(final ItemStack stack){
  if (stack != null) {
    if (isRod(stack) && !frameCompleted) {
      return rodsContained < MAX_ROD_COUNT;
    }
 else     if (frameCompleted) {
      if (isPlate(stack) && !skinCompleted) {
        return platesContained < MAX_PLATE_COUNT;
      }
 else {
        Item item=stack.getItem();
        if (item instanceof IModuleItem) {
          IModule module=((IModuleItem)item).getModule(stack);
          if (rocketEngine == null && module instanceof IRocketEngine) {
            return ((IMissileModule)item).getMissileSize() == MissileCasings.STANDARD.ordinal();
          }
 else           if (warhead == null && module instanceof IWarhead) {
            return true;
          }
 else           if (rocketComputer == null && module instanceof IGuidance) {
            return true;
          }
        }
      }
    }
  }
  return false;
}
Program: 169653
Project: 169653
Buggy source:
@Override public StandardMissileCrafting readBytes(ByteBuf buf){
  return this;
}

Fixed version (ground truth):
@Override public StandardMissileCrafting readBytes(ByteBuf buf){
  frameLevel=buf.readInt();
  plateLevel=buf.readInt();
  ItemStack stack=ByteBufUtils.readItemStack(buf);
  if (stack.getItem() instanceof IModuleItem) {
    warhead=stack;
  }
  stack=ByteBufUtils.readItemStack(buf);
  if (stack.getItem() instanceof IModuleItem) {
    rocketComputer=stack;
  }
  stack=ByteBufUtils.readItemStack(buf);
  if (stack.getItem() instanceof IModuleItem) {
    rocketEngine=stack;
  }
  return this;
}
Program: 169654
Project: 169654
Buggy source:
protected int addRods(int count){
  if (!frameCompleted) {
    int addition=Math.min(count,Math.max(MAX_ROD_COUNT - rodsContained,0));
    if (addition > 0) {
      rodsContained+=addition;
      frameLevel=rodsContained / ROD_PER_LEVEL_COUNT;
      if (frameLevel >= MAX_ROD_LEVEL_COUNT) {
        frameCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}

Fixed version (ground truth):
protected int addRods(int count){
  if (!frameCompleted) {
    int addition=Math.min(count,Math.max(MAX_ROD_COUNT - rodsContained,0));
    if (addition > 0) {
      rodsContained+=addition;
      frameLevel=rodsContained / ROD_PER_LEVEL_COUNT;
      if (rodsContained >= MAX_ROD_COUNT) {
        frameCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}
Program: 169655
Project: 169655
Buggy source:
protected int addPlates(int count){
  if (!skinCompleted) {
    int addition=Math.min(count,Math.max(MAX_PLATE_COUNT - platesContained,0));
    if (addition > 0) {
      platesContained+=addition;
      plateLevel=platesContained / PLATE_PER_LEVEL_COUNT;
      if (plateLevel >= MAX_PLATE_LEVEL_COUNT) {
        skinCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}

Fixed version (ground truth):
protected int addPlates(int count){
  if (!skinCompleted) {
    int addition=Math.min(count,Math.max(MAX_PLATE_COUNT - platesContained,0));
    if (addition > 0) {
      platesContained+=addition;
      plateLevel=platesContained / PLATE_PER_LEVEL_COUNT;
      if (platesContained >= MAX_PLATE_COUNT) {
        skinCompleted=true;
      }
    }
    return addition;
  }
  return 0;
}
Program: 169656
Project: 169656
Buggy source:
/** 
 * Checks if the item is part of the recipe, and is still required by the recipe.
 * @param stack - stack being added,can be null but will return false
 * @return true if the item can be added.
 */
public boolean canAddItem(final ItemStack stack){
  if (stack != null) {
    if (isRod(stack) && !frameCompleted) {
      return rodsContained < MAX_ROD_COUNT;
    }
 else     if (frameCompleted) {
      if (isPlate(stack) && !skinCompleted) {
        return platesContained < MAX_PLATE_COUNT;
      }
 else {
        Item item=stack.getItem();
        if (item instanceof IModuleItem) {
          IModule module=((IModuleItem)item).getModule(stack);
          if (module instanceof IRocketEngine) {
            return rocketEngine == null;
          }
 else           if (module instanceof IWarhead) {
            return warhead == null;
          }
 else           if (module instanceof IGuidance) {
            return rocketComputer == null;
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the item is part of the recipe, and is still required by the recipe.
 * @param stack - stack being added,can be null but will return false
 * @return true if the item can be added.
 */
public boolean canAddItem(final ItemStack stack){
  if (stack != null) {
    if (isRod(stack)) {
      return rodsContained < MAX_ROD_COUNT;
    }
 else     if (frameCompleted) {
      if (isPlate(stack)) {
        return platesContained < MAX_PLATE_COUNT;
      }
 else {
        Item item=stack.getItem();
        if (item instanceof IModuleItem) {
          IModule module=((IModuleItem)item).getModule(stack);
          if (module instanceof IRocketEngine) {
            return rocketEngine == null;
          }
 else           if (module instanceof IWarhead) {
            return warhead == null;
          }
 else           if (module instanceof IGuidance) {
            return rocketComputer == null;
          }
        }
      }
    }
  }
  return false;
}
Program: 169658
Project: 169658
Buggy source:
@Override public boolean shouldPath(Location location){
  if (location.getHardness() < 0) {
    return false;
  }
 else   if (location.getTileEntity() != null) {
    return false;
  }
 else   if (location.isAirBlock()) {
    return false;
  }
  Block block=location.getBlock();
  if (block == Blocks.portal) {
    return false;
  }
 else   if (block == Blocks.end_portal) {
    return false;
  }
 else   if (block == Blocks.end_portal_frame) {
    return false;
  }
  return super.shouldPath(location);
}

Fixed version (ground truth):
@Override public boolean shouldPath(Location location){
  if (super.shouldPath(location)) {
    if (location.getHardness() < 0) {
      return false;
    }
 else     if (location.getTileEntity() != null) {
      return false;
    }
 else     if (location.isAirBlock()) {
      return false;
    }
    Block block=location.getBlock();
    if (block == Blocks.portal) {
      return false;
    }
 else     if (block == Blocks.end_portal) {
      return false;
    }
 else     if (block == Blocks.end_portal_frame) {
      return false;
    }
    return true;
  }
  return false;
}
Program: 169659
Project: 169659
Buggy source:
@Override public void getEffectedBlocks(List<IWorldEdit> list){
  super.getEffectedBlocks(list);
  Iterator<IWorldEdit> it=list.iterator();
  List<IWorldEdit> newList=new ArrayList();
  while (it.hasNext()) {
    IWorldEdit edit=it.next();
    System.out.println(edit);
    Location location=getRandomLocationChecked();
    if (location != null) {
      System.out.println("String_Node_Str" + location);
      newList.add(new BlockEdit(location).set(edit.getBlock(),edit.getBlockMetadata(),false,true));
      newList.add(new BlockEdit(edit.world(),edit.x(),edit.y(),edit.z()).set(Blocks.air,0,false,true));
    }
    it.remove();
  }
  list.addAll(newList);
}

Fixed version (ground truth):
@Override public void getEffectedBlocks(List<IWorldEdit> list){
  super.getEffectedBlocks(list);
  Iterator<IWorldEdit> it=list.iterator();
  List<IWorldEdit> newList=new ArrayList();
  System.out.println(list.size());
  for (  IWorldEdit edit : list) {
    System.out.println(edit);
  }
  while (it.hasNext()) {
    IWorldEdit edit=it.next();
    if (!newList.contains(edit)) {
      Location location=getRandomLocationChecked();
      if (location != null) {
        newList.add(new BlockEdit(location).set(edit.getBlock(),edit.getBlockMetadata(),false,true));
      }
    }
  }
  list.addAll(newList);
  System.out.println("String_Node_Str" + list.size());
}
Program: 169660
Project: 169660
Buggy source:
@Override public void onPostInit(){
  if (Engine.itemSheetMetal != null) {
    RocketEngineCoalPowered engine=new RocketEngineCoalPowered(new ItemStack(ICBM.itemEngineModules,1,Engines.COAL_ENGINE.ordinal()));
    ItemStack engineStack=engine.toStack();
    GameRegistry.addRecipe(new ShapedOreRecipe(engineStack,"String_Node_Str","String_Node_Str",'R',Items.redstone,'F',Blocks.furnace,'L',Items.flint_and_steel,'C',ItemSheetMetal.SheetMetal.CONE_SMALL));
    engine.getInventory().setInventorySlotContents(0,new ItemStack(Items.coal,5));
    GameRegistry.addShapelessRecipe(engine.toStack(),engineStack,Items.coal,Items.coal,Items.coal,Items.coal,Items.coal);
    engine.getInventory().setInventorySlotContents(0,new ItemStack(Items.coal,5,1));
    GameRegistry.addShapelessRecipe(engine.toStack(),engineStack,new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1));
  }
}

Fixed version (ground truth):
@Override public void onPostInit(){
  if (Engine.itemSheetMetal != null) {
    RocketEngineCoalPowered engine=new RocketEngineCoalPowered(new ItemStack(ICBM.itemEngineModules,1,Engines.COAL_ENGINE.ordinal()));
    ItemStack engineStack=engine.toStack();
    GameRegistry.addRecipe(new ShapedOreRecipe(engineStack,"String_Node_Str","String_Node_Str",'R',Items.redstone,'F',Blocks.furnace,'L',Items.flint_and_steel,'C',ItemSheetMetal.SheetMetal.CONE_SMALL.stack()));
    engine.getInventory().setInventorySlotContents(0,new ItemStack(Items.coal,5));
    GameRegistry.addShapelessRecipe(engine.toStack(),engineStack,Items.coal,Items.coal,Items.coal,Items.coal,Items.coal);
    engine.getInventory().setInventorySlotContents(0,new ItemStack(Items.coal,5,1));
    GameRegistry.addShapelessRecipe(engine.toStack(),engineStack,new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1),new ItemStack(Items.coal,1,1));
  }
}
Program: 169661
Project: 169661
Buggy source:
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  super.drawGuiContainerForegroundLayer(mouseX,mouseY);
  if (ticks++ >= updateGuiTicks) {
    reloadData();
  }
  drawStringCentered(LanguageUtility.getLocalName(controller.getInventoryName()),85,10);
  if (!editMode && (controller.launcherData == null || controller.launcherData.size() == 0)) {
    drawStringCentered("String_Node_Str",85,40);
  }
}

Fixed version (ground truth):
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  super.drawGuiContainerForegroundLayer(mouseX,mouseY);
  if (ticks++ >= updateGuiTicks) {
    reloadData();
  }
  drawStringCentered(LanguageUtility.getLocalName(controller.getInventoryName()),85,10);
  if (!editMode && (controller.launcherData == null || controller.launcherData.size() == 0)) {
    drawStringCentered(LanguageUtility.getLocal("String_Node_Str"),85,40);
    drawStringCentered(LanguageUtility.getLocal("String_Node_Str"),85,50);
  }
}
Program: 169662
Project: 169662
Buggy source:
@Override protected void updateMotion(){
  super.updateMotion();
  if (target_pos != null) {
    if (this.posY >= 1000) {
      MissileTracker.addToTracker(this);
    }
  }
  if (this.ticksInAir > 0)   this.spawnMissileSmoke();
}

Fixed version (ground truth):
@Override protected void updateMotion(){
  super.updateMotion();
  if (target_pos != null) {
    if (this.posY >= MissileTracker.MAX_SPAWN_OUT_Y) {
      MissileTracker.addToTracker(this);
    }
  }
  if (this.ticksInAir > 0)   this.spawnMissileSmoke();
}
Program: 169663
Project: 169663
Buggy source:
public static void spawnMissileOverTarget(Missile missileModuleData,Location location){
  EntityMissile missile=new EntityMissile(location.world);
  missile.setMissile(missileModuleData);
  Random rand=location.world.rand;
  Pos pos=location.toPos();
  pos.sub(0,100 + (100 * rand.nextInt()),0);
  float accuracy=100f;
  if (missile.getMissile() != null && missile.getMissile().getGuidance() != null) {
    accuracy=missile.getMissile().getGuidance().getFallOffRange(missile.getMissile());
  }
  pos.add(accuracy * rand.nextFloat() - accuracy * rand.nextFloat(),0,0);
  pos.add(0,accuracy * rand.nextFloat() - accuracy * rand.nextFloat(),0);
  pos.add(0,0,accuracy * rand.nextFloat() - accuracy * rand.nextFloat());
  missile.setPosition(pos.x(),pos.y(),pos.z());
  missile.setVelocity(0,-1,0);
  location.world.spawnEntityInWorld(missile);
  missile.setIntoMotion();
  debug("String_Node_Str" + missile.getUniqueID() + "String_Node_Str"+ location+ "String_Node_Str"+ missileModuleData);
}

Fixed version (ground truth):
public static void spawnMissileOverTarget(Missile missileModuleData,Location location){
  EntityMissile missile=new EntityMissile(location.world);
  missile.setMissile(missileModuleData);
  Random rand=location.world.rand;
  Pos pos=location.toPos();
  pos.sub(0,10 + (100 * rand.nextFloat()),0);
  float accuracy=100f;
  if (missile.getMissile() != null && missile.getMissile().getGuidance() != null) {
    accuracy=missile.getMissile().getGuidance().getFallOffRange(missile.getMissile());
  }
  pos.add(accuracy * rand.nextFloat() - accuracy * rand.nextFloat(),0,0);
  pos.add(0,accuracy * rand.nextFloat() - accuracy * rand.nextFloat(),0);
  pos.add(0,0,accuracy * rand.nextFloat() - accuracy * rand.nextFloat());
  missile.setPosition(pos.x(),pos.y(),pos.z());
  missile.setVelocity(0,-1,0);
  location.world.spawnEntityInWorld(missile);
  missile.setIntoMotion();
  debug("String_Node_Str" + missile.getUniqueID() + "String_Node_Str"+ location+ "String_Node_Str"+ missileModuleData);
}
Program: 169664
Project: 169664
Buggy source:
public boolean update(World world){
  Iterator<MissileTrackingData> it=missiles.iterator();
  while (it.hasNext()) {
    MissileTrackingData data=it.next();
    if (data.isValid()) {
      data.ticks++;
      if (data.shouldRespawn()) {
        Location loc=new Location(world,data.target);
        if (loc.isChunkLoaded()) {
          Entity entity=EntityList.createEntityFromNBT(data.m_save,world);
          if (entity instanceof EntityMissile) {
            spawnMissileOverTarget(((EntityMissile)entity).getMissile(),new Location(loc.world,loc.x(),1000,loc.z()));
          }
 else {
            debug("String_Node_Str" + data);
          }
          it.remove();
        }
      }
    }
 else {
      debug("String_Node_Str" + data);
      it.remove();
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean update(World world){
  Iterator<MissileTrackingData> it=missiles.iterator();
  while (it.hasNext()) {
    MissileTrackingData data=it.next();
    if (data.isValid()) {
      data.ticks++;
      if (data.shouldRespawn()) {
        Location loc=new Location(world,data.target);
        if (loc.isChunkLoaded()) {
          Entity entity=EntityList.createEntityFromNBT(data.m_save,world);
          if (entity instanceof EntityMissile) {
            spawnMissileOverTarget(((EntityMissile)entity).getMissile(),new Location(loc.world,loc.x(),MAX_SPAWN_OUT_Y,loc.z()));
          }
 else {
            debug("String_Node_Str" + data);
          }
          it.remove();
        }
      }
    }
 else {
      debug("String_Node_Str" + data);
      it.remove();
    }
  }
  return true;
}
Program: 169667
Project: 169667
Buggy source:
@Override public boolean onItemUse(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hit_x,float hit_y,float hit_z){
  if (world.isRemote)   return true;
  Location location=new Location(world,x,y,z);
  TileEntity tile=location.getTileEntity();
  if (player.isSneaking()) {
    setLocation(stack,location);
    LanguageUtility.addChatToPlayer(player,"String_Node_Str");
    if (tile instanceof IPassCode) {
      setCode(stack,((IPassCode)tile).getCode());
    }
    stack.setItemDamage(1);
    return true;
  }
 else {
    Location storedLocation=getLocation(stack);
    if (storedLocation == null || !storedLocation.isAboveBedrock()) {
      LanguageUtility.addChatToPlayer(player,"String_Node_Str");
      return true;
    }
 else     if (tile instanceof ILinkable) {
      String result=((ILinkable)tile).link(getLocation(stack),getCode(stack));
      if (result != null && result != "String_Node_Str") {
        if (result.contains("String_Node_Str")) {
          String translation=LanguageUtility.getLocalName(result);
          if (translation == null || translation.isEmpty())           translation="String_Node_Str";
          player.addChatComponentMessage(new ChatComponentText(TextColor.RED.getColorString() + translation));
        }
 else {
          LanguageUtility.addChatToPlayer(player,result);
        }
      }
 else {
        LanguageUtility.addChatToPlayer(player,"String_Node_Str");
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onItemUse(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hit_x,float hit_y,float hit_z){
  if (world.isRemote)   return true;
  Location location=new Location(world,x,y,z);
  TileEntity tile=location.getTileEntity();
  if (player.isSneaking()) {
    setLocation(stack,location);
    LanguageUtility.addChatToPlayer(player,"String_Node_Str");
    if (tile instanceof IPassCode) {
      setCode(stack,((IPassCode)tile).getCode());
    }
    stack.setItemDamage(1);
    player.inventoryContainer.detectAndSendChanges();
    return true;
  }
 else {
    Location storedLocation=getLocation(stack);
    if (storedLocation == null || !storedLocation.isAboveBedrock()) {
      LanguageUtility.addChatToPlayer(player,"String_Node_Str");
      return true;
    }
 else     if (tile instanceof ILinkable) {
      String result=((ILinkable)tile).link(getLocation(stack),getCode(stack));
      if (result != null && result != "String_Node_Str") {
        if (result.contains("String_Node_Str")) {
          String translation=LanguageUtility.getLocalName(result);
          if (translation == null || translation.isEmpty())           translation="String_Node_Str";
          player.addChatComponentMessage(new ChatComponentText(TextColor.RED.getColorString() + translation));
        }
 else {
          LanguageUtility.addChatToPlayer(player,result);
        }
      }
 else {
        LanguageUtility.addChatToPlayer(player,"String_Node_Str");
      }
      return true;
    }
  }
  return false;
}
Program: 169668
Project: 169668
Buggy source:
@Override public boolean read(ByteBuf buf,int id,EntityPlayer player,PacketType type){
  if (isServer()) {
    if (id == 1) {
      this.target=new Pos(buf);
      return true;
    }
  }
 else {
    if (id == 0) {
      this.target=new Pos(buf);
      ItemStack stack=ByteBufUtils.readItemStack(buf);
      if (stack.getItem() instanceof IMissileItem)       this.setInventorySlotContents(0,stack);
 else       this.setInventorySlotContents(0,null);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean read(ByteBuf buf,int id,EntityPlayer player,PacketType type){
  if (id == 1) {
    this.target=new Pos(buf);
    return true;
  }
  return super.read(buf,id,player,type);
}
Program: 169669
Project: 169669
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  this.target=new Pos(nbt);
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  if (nbt.hasKey("String_Node_Str"))   this.target=new Pos(nbt.getCompoundTag("String_Node_Str"));
}
Program: 169670
Project: 169670
Buggy source:
@Override public boolean read(ByteBuf buf,int id,EntityPlayer player,PacketType type){
  if (isServer()) {
    if (id == 1) {
      this.target=new Pos(buf);
      return true;
    }
  }
 else {
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean read(ByteBuf buf,int id,EntityPlayer player,PacketType type){
  if (isServer()) {
    if (id == 1) {
      this.target=new Pos(buf);
      return true;
    }
  }
 else {
    if (id == 0) {
      this.target=new Pos(buf);
      ItemStack stack=ByteBufUtils.readItemStack(buf);
      if (stack.getItem() != Item.getItemFromBlock(Blocks.stone))       this.setInventorySlotContents(0,stack);
      return true;
    }
  }
  return false;
}
Program: 169671
Project: 169671
Buggy source:
@Override public void update(){
  super.update();
  if (ticks % 20 == 0) {
    if (world().isBlockIndirectlyGettingPowered(xi(),yi(),zi())) {
      fireMissile();
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (isServer()) {
    if (ticks % 20 == 0) {
      if (world().isBlockIndirectlyGettingPowered(xi(),yi(),zi())) {
        fireMissile();
      }
    }
  }
}
Program: 169672
Project: 169672
Buggy source:
public void setTarget(Pos target){
  this.target=target;
  if (isClient()) {
    sendPacket(new PacketTile(this,1,target));
  }
}

Fixed version (ground truth):
public void setTarget(Pos target){
  this.target=target;
  if (isClient() && world() != null) {
    sendPacket(new PacketTile(this,1,target));
  }
}
Program: 169673
Project: 169673
Buggy source:
@Override public void writeToNBT(NBTTagCompound nbt){
  super.writeToNBT(nbt);
  this.target.writeNBT(nbt);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound nbt){
  super.writeToNBT(nbt);
  if (target != null)   nbt.setTag("String_Node_Str",target.toNBT());
}
Program: 169674
Project: 169674
Buggy source:
@Override public PacketTile getDescPacket(){
  NBTTagCompound tag=new NBTTagCompound();
  writeToNBT(tag);
  return new PacketTile(this,0,tag);
}

Fixed version (ground truth):
@Override public PacketTile getDescPacket(){
  return new PacketTile(this,getSaveData());
}
Program: 169675
Project: 169675
Buggy source:
@Override public boolean onPlayerRightClick(EntityPlayer player,int side,Pos hit){
  if (isServer()) {
    ItemStack stack=player.getHeldItem();
    if (getMissile() != null) {
      if (stack == null) {
        player.addChatComponentMessage(new ChatComponentText("String_Node_Str"));
        player.inventory.mainInventory[player.inventory.currentItem]=getMissile().toStack();
        setMissile(null);
        player.inventoryContainer.detectAndSendChanges();
        updateClient();
        return true;
      }
    }
 else     if (stack.getItem() instanceof ItemMissile) {
      player.addChatComponentMessage(new ChatComponentText("String_Node_Str"));
      setMissile(MissileModuleBuilder.INSTANCE.buildMissile(stack));
      if (!player.capabilities.isCreativeMode) {
        stack.stackSize--;
        if (stack.stackSize <= 0) {
          player.inventory.mainInventory[player.inventory.currentItem]=null;
        }
        player.inventoryContainer.detectAndSendChanges();
        updateClient();
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onPlayerRightClick(EntityPlayer player,int side,Pos hit){
  if (isServer()) {
    ItemStack stack=player.getHeldItem();
    if (getMissile() != null) {
      if (stack == null) {
        player.addChatComponentMessage(new ChatComponentText("String_Node_Str"));
        player.inventory.mainInventory[player.inventory.currentItem]=getMissile().toStack();
        setMissile(null);
        player.inventoryContainer.detectAndSendChanges();
        sendDescPacket();
        return true;
      }
    }
 else     if (stack.getItem() instanceof ItemMissile) {
      player.addChatComponentMessage(new ChatComponentText("String_Node_Str"));
      setMissile(MissileModuleBuilder.INSTANCE.buildMissile(stack));
      if (!player.capabilities.isCreativeMode) {
        stack.stackSize--;
        if (stack.stackSize <= 0) {
          player.inventory.mainInventory[player.inventory.currentItem]=null;
        }
        player.inventoryContainer.detectAndSendChanges();
        sendDescPacket();
      }
      return true;
    }
  }
  return false;
}