nus-yam/ex-repair huggingface dataset:
Program: 165982
Project: 165982
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
    }
 else {
      SpaceChamberControllerTileEntity chamberControllerTileEntity=(SpaceChamberControllerTileEntity)world.getTileEntity(x,y,z);
      chamberControllerTileEntity.createChamber(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
    }
 else {
      SpaceChamberControllerTileEntity chamberControllerTileEntity=(SpaceChamberControllerTileEntity)world.getTileEntity(x,y,z);
      chamberControllerTileEntity.createChamber(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}
Program: 165983
Project: 165983
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      MatterBeamerTileEntity matterBeamerTileEntity=(MatterBeamerTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      matterBeamerTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      MatterBeamerTileEntity matterBeamerTileEntity=(MatterBeamerTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      matterBeamerTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}
Program: 165984
Project: 165984
Buggy source:
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      SpawnerTileEntity spawnerTileEntity=(SpawnerTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      spawnerTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float sx,float sy,float sz){
  WrenchUsage wrenchUsed=testWrenchUsage(x,y,z,player);
  if (wrenchUsed == WrenchUsage.NORMAL) {
    if (world.isRemote) {
      SpawnerTileEntity spawnerTileEntity=(SpawnerTileEntity)world.getTileEntity(x,y,z);
      world.playSound(x,y,z,"String_Node_Str",1.0f,1.0f,false);
      spawnerTileEntity.useWrench(player);
    }
    return true;
  }
 else   if (wrenchUsed == WrenchUsage.SNEAKING) {
    breakAndRemember(world,player,x,y,z);
    return true;
  }
 else {
    return openGui(world,x,y,z,player);
  }
}
Program: 165985
Project: 165985
Buggy source:
public PlayerName(ByteBuf buf){
  byte[] dst=new byte[buf.readInt()];
  buf.readBytes(dst);
  name=new String(dst);
}

Fixed version (ground truth):
public PlayerName(ByteBuf buf){
  name=NetworkTools.readString(buf);
}
Program: 165986
Project: 165986
Buggy source:
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(getName().length());
  buf.writeBytes(getName().getBytes());
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  NetworkTools.writeString(buf,getName());
}
Program: 165987
Project: 165987
Buggy source:
@Override public void toBytes(ByteBuf buf){
  if (coordinate == null) {
    buf.writeInt(-1);
    buf.writeInt(-1);
    buf.writeInt(-1);
  }
 else {
    buf.writeInt(coordinate.getX());
    buf.writeInt(coordinate.getY());
    buf.writeInt(coordinate.getZ());
  }
  buf.writeInt(dimension);
  buf.writeInt(getName().length());
  buf.writeBytes(getName().getBytes());
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  if (coordinate == null) {
    buf.writeInt(-1);
    buf.writeInt(-1);
    buf.writeInt(-1);
  }
 else {
    buf.writeInt(coordinate.getX());
    buf.writeInt(coordinate.getY());
    buf.writeInt(coordinate.getZ());
  }
  buf.writeInt(dimension);
  NetworkTools.writeString(buf,getName());
}
Program: 165988
Project: 165988
Buggy source:
@Override public void toBytes(ByteBuf buf){
  super.toBytes(buf);
  buf.writeInt(getDimensionName().length());
  buf.writeBytes(getDimensionName().getBytes());
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  super.toBytes(buf);
  NetworkTools.writeString(buf,getDimensionName());
}
Program: 165989
Project: 165989
Buggy source:
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(coordinate.getX());
  buf.writeInt(coordinate.getY());
  buf.writeInt(coordinate.getZ());
  buf.writeInt(getName().length());
  buf.writeBytes(getName().getBytes());
  teleportDestination.toBytes(buf);
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(coordinate.getX());
  buf.writeInt(coordinate.getY());
  buf.writeInt(coordinate.getZ());
  NetworkTools.writeString(buf,getName());
  teleportDestination.toBytes(buf);
}
Program: 165992
Project: 165992
Buggy source:
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(dimlets.size());
  for (  Map.Entry<Integer,DimletKey> me : dimlets.entrySet()) {
    buf.writeInt(me.getKey());
    DimletKey key=me.getValue();
    String name=key.getName();
    if (name == null) {
      buf.writeInt(-1);
    }
 else     if (name.isEmpty()) {
      buf.writeInt(0);
    }
 else {
      buf.writeInt(name.length());
      buf.writeBytes(name.getBytes());
    }
    buf.writeInt(key.getType().ordinal());
  }
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(dimlets.size());
  for (  Map.Entry<Integer,DimletKey> me : dimlets.entrySet()) {
    DimletKey key=me.getValue();
    buf.writeInt(me.getKey());
    NetworkTools.writeString(buf,key.getName());
    buf.writeInt(key.getType().ordinal());
  }
}
Program: 165993
Project: 165993
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  dimlets=new HashMap<Integer,DimletKey>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    int s=buf.readInt();
    String name;
    if (s == -1) {
      name=null;
    }
 else     if (s == 0) {
      name="String_Node_Str";
    }
 else {
      byte[] dst=new byte[s];
      buf.readBytes(dst);
      name=new String(dst);
    }
    int typeOrdinal=buf.readInt();
    try {
      dimlets.put(id,new DimletKey(DimletType.values()[typeOrdinal],name));
    }
 catch (    Exception e) {
      RFTools.logError("String_Node_Str" + name + "String_Node_Str"+ i+ "String_Node_Str"+ size+ "String_Node_Str");
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  dimlets=new HashMap<Integer,DimletKey>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    String name=NetworkTools.readString(buf);
    int typeOrdinal=buf.readInt();
    try {
      dimlets.put(id,new DimletKey(DimletType.values()[typeOrdinal],name));
    }
 catch (    Exception e) {
      RFTools.logError("String_Node_Str" + name + "String_Node_Str"+ i+ "String_Node_Str"+ size+ "String_Node_Str");
      throw new RuntimeException(e);
    }
  }
}
Program: 165994
Project: 165994
Buggy source:
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(dimensions.size());
  for (  Map.Entry<Integer,DimensionDescriptor> me : dimensions.entrySet()) {
    buf.writeInt(me.getKey());
    NBTTagCompound tagCompound=new NBTTagCompound();
    me.getValue().writeToNBT(tagCompound);
    PacketBuffer buffer=new PacketBuffer(buf);
    try {
      buffer.writeNBTTagCompoundToBuffer(tagCompound);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  buf.writeInt(dimensionInformation.size());
  for (  Map.Entry<Integer,DimensionInformation> me : dimensionInformation.entrySet()) {
    buf.writeInt(me.getKey());
    DimensionInformation dimInfo=me.getValue();
    buf.writeInt(dimInfo.getName().length());
    buf.writeBytes(dimInfo.getName().getBytes());
    dimInfo.toBytes(buf);
  }
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  buf.writeInt(dimensions.size());
  for (  Map.Entry<Integer,DimensionDescriptor> me : dimensions.entrySet()) {
    buf.writeInt(me.getKey());
    NBTTagCompound tagCompound=new NBTTagCompound();
    me.getValue().writeToNBT(tagCompound);
    PacketBuffer buffer=new PacketBuffer(buf);
    try {
      buffer.writeNBTTagCompoundToBuffer(tagCompound);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  buf.writeInt(dimensionInformation.size());
  for (  Map.Entry<Integer,DimensionInformation> me : dimensionInformation.entrySet()) {
    buf.writeInt(me.getKey());
    DimensionInformation dimInfo=me.getValue();
    NetworkTools.writeString(buf,dimInfo.getName());
    dimInfo.toBytes(buf);
  }
}
Program: 165995
Project: 165995
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  dimensions=new HashMap<Integer,DimensionDescriptor>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    PacketBuffer buffer=new PacketBuffer(buf);
    NBTTagCompound tagCompound;
    try {
      tagCompound=buffer.readNBTTagCompoundFromBuffer();
    }
 catch (    IOException e) {
      e.printStackTrace();
      return;
    }
    DimensionDescriptor descriptor=new DimensionDescriptor(tagCompound);
    dimensions.put(id,descriptor);
  }
  size=buf.readInt();
  dimensionInformation=new HashMap<Integer,DimensionInformation>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    byte[] dst=new byte[buf.readInt()];
    buf.readBytes(dst);
    String name=new String(dst);
    DimensionInformation dimInfo=new DimensionInformation(name,dimensions.get(id),buf);
    dimensionInformation.put(id,dimInfo);
  }
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  int size=buf.readInt();
  dimensions=new HashMap<Integer,DimensionDescriptor>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    PacketBuffer buffer=new PacketBuffer(buf);
    NBTTagCompound tagCompound;
    try {
      tagCompound=buffer.readNBTTagCompoundFromBuffer();
    }
 catch (    IOException e) {
      e.printStackTrace();
      return;
    }
    DimensionDescriptor descriptor=new DimensionDescriptor(tagCompound);
    dimensions.put(id,descriptor);
  }
  size=buf.readInt();
  dimensionInformation=new HashMap<Integer,DimensionInformation>();
  for (int i=0; i < size; i++) {
    int id=buf.readInt();
    String name=NetworkTools.readString(buf);
    DimensionInformation dimInfo=new DimensionInformation(name,dimensions.get(id),buf);
    dimensionInformation.put(id,dimInfo);
  }
}
Program: 165996
Project: 165996
Buggy source:
/** 
 * Set the dimlet key on a known dimlet item.
 */
public static void setDimletKey(DimletKey key,ItemStack itemStack){
  NBTTagCompound tagCompound=new NBTTagCompound();
  tagCompound.setString("String_Node_Str",key.getType().dimletType.getOpcode());
  tagCompound.setString("String_Node_Str",key.getName());
  itemStack.setTagCompound(tagCompound);
  DimletMapping mapping=DimletMapping.getInstance();
  if (mapping != null) {
    itemStack.setItemDamage(mapping.getId(key));
  }
}

Fixed version (ground truth):
/** 
 * Set the dimlet key on a known dimlet item.
 */
public static void setDimletKey(DimletKey key,ItemStack itemStack){
  NBTTagCompound tagCompound=new NBTTagCompound();
  tagCompound.setString("String_Node_Str",key.getType().dimletType.getOpcode());
  tagCompound.setString("String_Node_Str",key.getName());
  itemStack.setTagCompound(tagCompound);
  DimletMapping mapping=DimletMapping.getInstance();
  if (mapping != null) {
    Integer id=mapping.getId(key);
    if (id != null) {
      itemStack.setItemDamage(id);
    }
  }
}
Program: 165997
Project: 165997
Buggy source:
/** 
 * Set the dimlet key on a known dimlet item.
 */
public static void setDimletKey(DimletKey key,ItemStack itemStack){
  NBTTagCompound tagCompound=new NBTTagCompound();
  tagCompound.setString("String_Node_Str",key.getType().dimletType.getOpcode());
  tagCompound.setString("String_Node_Str",key.getName());
  itemStack.setTagCompound(tagCompound);
  DimletMapping mapping=DimletMapping.getInstance();
  itemStack.setItemDamage(mapping.getId(key));
}

Fixed version (ground truth):
/** 
 * Set the dimlet key on a known dimlet item.
 */
public static void setDimletKey(DimletKey key,ItemStack itemStack){
  NBTTagCompound tagCompound=new NBTTagCompound();
  tagCompound.setString("String_Node_Str",key.getType().dimletType.getOpcode());
  tagCompound.setString("String_Node_Str",key.getName());
  itemStack.setTagCompound(tagCompound);
  DimletMapping mapping=DimletMapping.getInstance();
  if (mapping != null) {
    itemStack.setItemDamage(mapping.getId(key));
  }
}
Program: 165998
Project: 165998
Buggy source:
@Override protected void checkStateServer(){
  if (!isValid()) {
    counter=1;
    return;
  }
  counter--;
  if (counter > 0) {
    return;
  }
  counter=20;
  TileEntity tileEntity=worldObj.getTileEntity(monitorX,monitorY,monitorZ);
  if (!(tileEntity instanceof IFluidHandler)) {
    setInvalid();
    return;
  }
  IFluidHandler handler=(IFluidHandler)tileEntity;
  FluidTankInfo[] tankInfo=handler.getTankInfo(ForgeDirection.DOWN);
  long stored=0;
  long maxContents=0;
  if (tankInfo.length > 0) {
    if (tankInfo[0].fluid != null) {
      stored=tankInfo[0].fluid.amount;
    }
    maxContents=tankInfo[0].capacity;
  }
  int ratio=0;
  boolean alarm=false;
  if (maxContents > 0) {
    ratio=(int)(1 + (stored * 5) / maxContents);
    if (ratio < 1) {
      ratio=1;
    }
 else     if (ratio > 5) {
      ratio=5;
    }
switch (alarmMode) {
case MODE_OFF:
      alarm=false;
    break;
case MODE_LESS:
  alarm=((stored * 100 / maxContents) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxContents) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (getFluidLevel() != ratio || alarm != alarmValue) {
fluidlevel.setValue(ratio);
if (alarmValue != alarm) {
inAlarm.setValue(alarm);
}
notifyBlockUpdate();
}
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  if (!isValid()) {
    counter=1;
    return;
  }
  counter--;
  if (counter > 0) {
    return;
  }
  counter=20;
  TileEntity tileEntity=worldObj.getTileEntity(monitorX,monitorY,monitorZ);
  if (!(tileEntity instanceof IFluidHandler)) {
    setInvalid();
    return;
  }
  IFluidHandler handler=(IFluidHandler)tileEntity;
  FluidTankInfo[] tankInfo=handler.getTankInfo(ForgeDirection.DOWN);
  long stored=0;
  long maxContents=0;
  if (tankInfo != null && tankInfo.length > 0) {
    if (tankInfo[0].fluid != null) {
      stored=tankInfo[0].fluid.amount;
    }
    maxContents=tankInfo[0].capacity;
  }
  int ratio=0;
  boolean alarm=false;
  if (maxContents > 0) {
    ratio=(int)(1 + (stored * 5) / maxContents);
    if (ratio < 1) {
      ratio=1;
    }
 else     if (ratio > 5) {
      ratio=5;
    }
switch (alarmMode) {
case MODE_OFF:
      alarm=false;
    break;
case MODE_LESS:
  alarm=((stored * 100 / maxContents) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxContents) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (getFluidLevel() != ratio || alarm != alarmValue) {
fluidlevel.setValue(ratio);
if (alarmValue != alarm) {
inAlarm.setValue(alarm);
}
notifyBlockUpdate();
}
}
Program: 165999
Project: 165999
Buggy source:
@Override public Object[] getData(long millis){
  World world=DimensionManager.getWorld(dim);
  if (world == null) {
    return null;
  }
  if (!world.getChunkProvider().chunkExists(coordinate.getX() >> 4,coordinate.getZ() >> 4)) {
    return null;
  }
  TileEntity te=world.getTileEntity(coordinate.getX(),coordinate.getY(),coordinate.getZ());
  if (!(te instanceof IFluidHandler)) {
    return null;
  }
  IFluidHandler tank=(IFluidHandler)te;
  FluidTankInfo[] tankInfo=tank.getTankInfo(ForgeDirection.DOWN);
  int contents=0;
  int maxContents=0;
  if (tankInfo.length > 0) {
    if (tankInfo[0].fluid != null) {
      contents=tankInfo[0].fluid.amount;
    }
    maxContents=tankInfo[0].capacity;
  }
  return helper.getContentsValue(millis,contents,maxContents);
}

Fixed version (ground truth):
@Override public Object[] getData(long millis){
  World world=DimensionManager.getWorld(dim);
  if (world == null) {
    return null;
  }
  if (!world.getChunkProvider().chunkExists(coordinate.getX() >> 4,coordinate.getZ() >> 4)) {
    return null;
  }
  TileEntity te=world.getTileEntity(coordinate.getX(),coordinate.getY(),coordinate.getZ());
  if (!(te instanceof IFluidHandler)) {
    return null;
  }
  IFluidHandler tank=(IFluidHandler)te;
  FluidTankInfo[] tankInfo=tank.getTankInfo(ForgeDirection.DOWN);
  int contents=0;
  int maxContents=0;
  if (tankInfo != null && tankInfo.length > 0) {
    if (tankInfo[0].fluid != null) {
      contents=tankInfo[0].fluid.amount;
    }
    maxContents=tankInfo[0].capacity;
  }
  return helper.getContentsValue(millis,contents,maxContents);
}
Program: 166001
Project: 166001
Buggy source:
public void setRadius(int radius){
  this.radius=radius;
  volume=-1;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}

Fixed version (ground truth):
public void setRadius(int radius){
  this.radius=radius;
  volume=-1;
  environmentModules=null;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 166002
Project: 166002
Buggy source:
public void setMaxy(int maxy){
  this.maxy=maxy;
  volume=-1;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}

Fixed version (ground truth):
public void setMaxy(int maxy){
  this.maxy=maxy;
  volume=-1;
  environmentModules=null;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 166003
Project: 166003
Buggy source:
public void setMiny(int miny){
  this.miny=miny;
  volume=-1;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}

Fixed version (ground truth):
public void setMiny(int miny){
  this.miny=miny;
  volume=-1;
  environmentModules=null;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}
Program: 166005
Project: 166005
Buggy source:
@Override public int[] getInts(int x,int z,int width,int length){
  int[] ints=parent.getInts(x,z,width,length);
  Map<Integer,Integer> filterMap=getFilterFromType();
  if (filterMap != null) {
    int[] aint=IntCache.getIntCache(width * length);
    for (int i=0; i < width * length; ++i) {
      aint[i]=filterMap.get(ints[i]);
    }
    return aint;
  }
 else {
    return ints;
  }
}

Fixed version (ground truth):
@Override public int[] getInts(int x,int z,int width,int length){
  int[] ints=parent.getInts(x,z,width,length);
  Map<Integer,Integer> filterMap=getFilterFromType();
  if (filterMap != null) {
    int[] aint=IntCache.getIntCache(width * length);
    for (int i=0; i < width * length; ++i) {
      Integer biome=filterMap.get(ints[i]);
      if (biome != null) {
        aint[i]=biome;
      }
 else {
        aint[i]=ints[i];
      }
    }
    return aint;
  }
 else {
    return ints;
  }
}
Program: 166008
Project: 166008
Buggy source:
public List<Pair<DimletDescriptor,List<DimletDescriptor>>> getDimletsWithModifiers(){
  List<Pair<DimletDescriptor,List<DimletDescriptor>>> result=new ArrayList<Pair<DimletDescriptor,List<DimletDescriptor>>>();
  if (!descriptionString.isEmpty()) {
    List<DimletDescriptor> modifiers=new ArrayList<DimletDescriptor>();
    String[] opcodes=descriptionString.split("String_Node_Str");
    for (    String oc : opcodes) {
      DimletKey key;
      if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
        modifiers.add(new DimletDescriptor(key.getType(),key));
      }
 else       if (oc.startsWith("String_Node_Str")) {
      }
 else {
        key=DimletKey.parseKey(oc);
        result.add(Pair.of(new DimletDescriptor(key.getType(),key),modifiers));
        modifiers=new ArrayList<DimletDescriptor>();
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public List<Pair<DimletDescriptor,List<DimletDescriptor>>> getDimletsWithModifiers(){
  List<Pair<DimletDescriptor,List<DimletDescriptor>>> result=new ArrayList<Pair<DimletDescriptor,List<DimletDescriptor>>>();
  String ds=descriptionString;
  if (ds.startsWith("String_Node_Str")) {
    ds=ds.substring(1);
  }
  if (!ds.isEmpty()) {
    List<DimletDescriptor> modifiers=new ArrayList<DimletDescriptor>();
    String[] opcodes=ds.split("String_Node_Str");
    for (    String oc : opcodes) {
      DimletKey key;
      if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
        modifiers.add(new DimletDescriptor(key.getType(),key));
      }
 else       if (oc.startsWith("String_Node_Str")) {
      }
 else {
        key=DimletKey.parseKey(oc);
        result.add(Pair.of(new DimletDescriptor(key.getType(),key),modifiers));
        modifiers=new ArrayList<DimletDescriptor>();
      }
    }
  }
  return result;
}
Program: 166009
Project: 166009
Buggy source:
public void preInit(FMLPreInitializationEvent e){
  modConfigDir=e.getModConfigurationDirectory();
  mainConfig=new Configuration(new File(modConfigDir.getPath() + File.separator + "String_Node_Str","String_Node_Str"));
  dimletConfig=new Configuration(new File(modConfigDir.getPath() + File.separator + "String_Node_Str","String_Node_Str"));
  dimletConfig.addCustomCategoryComment(KnownDimletConfiguration.CATEGORY_KNOWNDIMLETS,"String_Node_Str");
  readMainConfig();
  PacketHandler.registerMessages();
  ModItems.init();
  ModBlocks.init();
  ModCrafting.init();
  ModDimensions.init();
}

Fixed version (ground truth):
public void preInit(FMLPreInitializationEvent e){
  modConfigDir=e.getModConfigurationDirectory();
  mainConfig=new Configuration(new File(modConfigDir.getPath() + File.separator + "String_Node_Str","String_Node_Str"));
  readMainConfig();
  PacketHandler.registerMessages();
  ModItems.init();
  ModBlocks.init();
  ModCrafting.init();
  ModDimensions.init();
}
Program: 166010
Project: 166010
Buggy source:
public void postInit(FMLPostInitializationEvent e){
  mainConfig=null;
  dimletConfig=null;
  WrenchChecker.init();
}

Fixed version (ground truth):
public void postInit(FMLPostInitializationEvent e){
  mainConfig=null;
  WrenchChecker.init();
}
Program: 166012
Project: 166012
Buggy source:
@SubscribeEvent public void loadEvent(WorldEvent.Load evt){
  if (evt.world.isRemote) {
    return;
  }
  if (MinecraftServer.getServer().isDedicatedServer()) {
    if (evt.world.provider.dimensionId == 0 && !KnownDimletConfiguration.isInitialized()) {
      RFTools.log("String_Node_Str");
      KnownDimletConfiguration.initServer(evt.world);
      KnownDimletConfiguration.initCrafting(evt.world);
    }
  }
 else {
    if (!KnownDimletConfiguration.isInitialized()) {
      RFTools.log("String_Node_Str");
      KnownDimletConfiguration.initClient(evt.world);
      KnownDimletConfiguration.initCrafting(evt.world);
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void loadEvent(WorldEvent.Load evt){
  if (evt.world.isRemote) {
    return;
  }
  if (MinecraftServer.getServer().isDedicatedServer()) {
    if (evt.world.provider.dimensionId == 0 && !KnownDimletConfiguration.isInitialized()) {
      RFTools.log("String_Node_Str");
      KnownDimletConfiguration.init(evt.world);
      KnownDimletConfiguration.initCrafting(evt.world);
    }
  }
 else {
    if (!KnownDimletConfiguration.isInitialized()) {
      RFTools.log("String_Node_Str");
      KnownDimletConfiguration.init(evt.world);
      KnownDimletConfiguration.initCrafting(evt.world);
    }
  }
}
Program: 166014
Project: 166014
Buggy source:
/** 
 * Here the information from the server arrives. This code is executed on the client.
 */
public void checkDimletConfigFromServer(Map<Integer,DimletKey> dimlets,World world){
  RFTools.log("String_Node_Str");
  DimletMapping mapping=DimletMapping.getDimletMapping(world);
  mapping.overrideServerMapping(dimlets);
  KnownDimletConfiguration.init(world,null);
  KnownDimletConfiguration.initCrafting(world);
}

Fixed version (ground truth):
/** 
 * Here the information from the server arrives. This code is executed on the client.
 */
public void checkDimletConfigFromServer(Map<Integer,DimletKey> dimlets,World world){
  RFTools.log("String_Node_Str");
  DimletMapping mapping=DimletMapping.getDimletMapping(world);
  mapping.overrideServerMapping(dimlets);
  KnownDimletConfiguration.init(world);
  KnownDimletConfiguration.initCrafting(world);
}
Program: 166016
Project: 166016
Buggy source:
private static List<DimletDescriptor> parseNewDescriptionString(String descriptionString){
  List<DimletDescriptor> result=new ArrayList<DimletDescriptor>();
  if (!descriptionString.isEmpty()) {
    String[] opcodes=descriptionString.substring(1).split("String_Node_Str");
    for (    String oc : opcodes) {
      DimletKey key;
      if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
      }
 else       if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
      }
 else {
        key=DimletKey.parseKey(oc);
      }
      result.add(new DimletDescriptor(key.getType(),key));
    }
  }
  return result;
}

Fixed version (ground truth):
private static List<DimletDescriptor> parseNewDescriptionString(String descriptionString){
  List<DimletDescriptor> result=new ArrayList<DimletDescriptor>();
  String ds=descriptionString.substring(1);
  if (!ds.isEmpty()) {
    String[] opcodes=ds.split("String_Node_Str");
    for (    String oc : opcodes) {
      DimletKey key;
      if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
      }
 else       if (oc.startsWith("String_Node_Str")) {
        key=DimletKey.parseKey(oc.substring(1));
      }
 else {
        key=DimletKey.parseKey(oc);
      }
      result.add(new DimletDescriptor(key.getType(),key));
    }
  }
  return result;
}
Program: 166017
Project: 166017
Buggy source:
@SubscribeEvent public void onDisconnectedFromServerEvent(FMLNetworkEvent.ClientDisconnectionFromServerEvent event){
  System.out.println("String_Node_Str");
  RfToolsDimensionManager.unregisterDimensions();
  KnownDimletConfiguration.clean();
}

Fixed version (ground truth):
@SubscribeEvent public void onDisconnectedFromServerEvent(FMLNetworkEvent.ClientDisconnectionFromServerEvent event){
  RFTools.log("String_Node_Str");
  RfToolsDimensionManager.unregisterDimensions();
  KnownDimletConfiguration.clean();
}
Program: 166018
Project: 166018
Buggy source:
@EventHandler public void serverStopped(FMLServerStoppedEvent event){
  System.out.println("String_Node_Str");
  RfToolsDimensionManager.unregisterDimensions();
  TeleportDestinations.clearInstance();
  RfToolsDimensionManager.clearInstance();
  DimensionStorage.clearInstance();
  DimletMapping.clearInstance();
  RedstoneChannels.clearInstance();
}

Fixed version (ground truth):
@EventHandler public void serverStopped(FMLServerStoppedEvent event){
  System.out.println("String_Node_Str");
  RfToolsDimensionManager.cleanupDimensionInformation();
  TeleportDestinations.clearInstance();
  RfToolsDimensionManager.clearInstance();
  DimensionStorage.clearInstance();
  DimletMapping.clearInstance();
  RedstoneChannels.clearInstance();
}
Program: 166019
Project: 166019
Buggy source:
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  int d=evt.world.provider.dimensionId;
  if (d != 0) {
    return;
  }
  if (!evt.world.isRemote) {
    if (MinecraftServer.getServer().isDedicatedServer()) {
      RfToolsDimensionManager.unregisterDimensions();
      KnownDimletConfiguration.clean();
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  int d=evt.world.provider.dimensionId;
  if (d != 0) {
    return;
  }
  if (!evt.world.isRemote) {
    if (MinecraftServer.getServer().isDedicatedServer()) {
      RfToolsDimensionManager.cleanupDimensionInformation();
      KnownDimletConfiguration.clean();
    }
  }
}
Program: 166020
Project: 166020
Buggy source:
public static void unregisterDimensions(){
  if (instance != null) {
    RFTools.log("String_Node_Str");
    for (    Map.Entry<Integer,DimensionDescriptor> me : instance.getDimensions().entrySet()) {
      int id=me.getKey();
      RFTools.log("String_Node_Str" + id);
      if (DimensionManager.isDimensionRegistered(id)) {
        try {
          DimensionManager.unregisterDimension(id);
        }
 catch (        Exception e) {
          RFTools.log("String_Node_Str" + id);
        }
        try {
          DimensionManager.unregisterProviderType(id);
        }
 catch (        Exception e) {
          RFTools.log("String_Node_Str" + id);
        }
      }
    }
    instance.getDimensions().clear();
    instance.dimensionToID.clear();
    instance.dimensionInformation.clear();
    instance.reclaimedIds.clear();
  }
}

Fixed version (ground truth):
public static void unregisterDimensions(){
  for (  Map.Entry<Integer,DimensionDescriptor> me : instance.getDimensions().entrySet()) {
    int id=me.getKey();
    if (DimensionManager.isDimensionRegistered(id)) {
      RFTools.log("String_Node_Str" + id);
      try {
        DimensionManager.unregisterDimension(id);
      }
 catch (      Exception e) {
        RFTools.log("String_Node_Str" + id);
      }
      try {
        DimensionManager.unregisterProviderType(id);
      }
 catch (      Exception e) {
        RFTools.log("String_Node_Str" + id);
      }
    }
 else {
      RFTools.log("String_Node_Str" + id);
    }
  }
}
Program: 166021
Project: 166021
Buggy source:
public void syncFromServer(Map<Integer,DimensionDescriptor> dims,Map<Integer,DimensionInformation> dimInfo){
  System.out.println("String_Node_Str");
  if (dims.isEmpty() || dimInfo.isEmpty()) {
    RFTools.log("String_Node_Str");
  }
  for (  Map.Entry<Integer,DimensionDescriptor> entry : dims.entrySet()) {
    int id=entry.getKey();
    DimensionDescriptor descriptor=entry.getValue();
    if (dimensions.containsKey(id)) {
      dimensionToID.remove(dimensions.get(id));
    }
    dimensions.put(id,descriptor);
    dimensionToID.put(descriptor,id);
  }
  for (  Map.Entry<Integer,DimensionInformation> entry : dimInfo.entrySet()) {
    int id=entry.getKey();
    DimensionInformation info=entry.getValue();
    dimensionInformation.put(id,info);
  }
}

Fixed version (ground truth):
public void syncFromServer(Map<Integer,DimensionDescriptor> dims,Map<Integer,DimensionInformation> dimInfo){
  RFTools.log("String_Node_Str");
  if (dims.isEmpty() || dimInfo.isEmpty()) {
    RFTools.log("String_Node_Str");
  }
  for (  Map.Entry<Integer,DimensionDescriptor> entry : dims.entrySet()) {
    int id=entry.getKey();
    DimensionDescriptor descriptor=entry.getValue();
    if (dimensions.containsKey(id)) {
      dimensionToID.remove(dimensions.get(id));
    }
    dimensions.put(id,descriptor);
    dimensionToID.put(descriptor,id);
  }
  for (  Map.Entry<Integer,DimensionInformation> entry : dimInfo.entrySet()) {
    int id=entry.getKey();
    DimensionInformation info=entry.getValue();
    dimensionInformation.put(id,info);
  }
}
Program: 166027
Project: 166027
Buggy source:
@Override public IChunkProvider createChunkGenerator(){
  int dim=worldObj.provider.dimensionId;
  long seed=DimletConfiguration.randomizeSeed ? calculateSeed((long)(Math.random() * 10000 + 1),dim) : calculateSeed(worldObj.getSeed(),dim);
  return new GenericChunkProvider(worldObj,seed);
}

Fixed version (ground truth):
@Override public IChunkProvider createChunkGenerator(){
  int dim=worldObj.provider.dimensionId;
  setSeed(dim);
  return new GenericChunkProvider(worldObj,seed);
}
Program: 166028
Project: 166028
Buggy source:
@Override public void registerWorldChunkManager(){
  int dim=worldObj.provider.dimensionId;
  seed=DimletConfiguration.randomizeSeed ? calculateSeed((long)(Math.random() * 10000 + 1),dim) : calculateSeed(worldObj.getSeed(),dim);
  getDimensionInformation();
  storage=DimensionStorage.getDimensionStorage(worldObj);
  setupProviderInfo();
}

Fixed version (ground truth):
@Override public void registerWorldChunkManager(){
  getDimensionInformation();
  storage=DimensionStorage.getDimensionStorage(worldObj);
  setupProviderInfo();
}
Program: 166029
Project: 166029
Buggy source:
private DimensionInformation getDimensionInformation(){
  if (dimensionInformation == null) {
    int dim=worldObj.provider.dimensionId;
    dimensionInformation=RfToolsDimensionManager.getDimensionManager(worldObj).getDimensionInformation(dim);
    if (dimensionInformation == null) {
      RFTools.log("String_Node_Str" + dim + "String_Node_Str");
    }
 else {
      long forcedSeed=dimensionInformation.getForcedDimensionSeed();
      if (forcedSeed != 0) {
        RFTools.log("String_Node_Str" + dim + "String_Node_Str"+ forcedSeed);
        seed=forcedSeed;
      }
      setupProviderInfo();
    }
  }
  return dimensionInformation;
}

Fixed version (ground truth):
private DimensionInformation getDimensionInformation(){
  if (dimensionInformation == null) {
    int dim=worldObj.provider.dimensionId;
    dimensionInformation=RfToolsDimensionManager.getDimensionManager(worldObj).getDimensionInformation(dim);
    if (dimensionInformation == null) {
      RFTools.log("String_Node_Str" + dim + "String_Node_Str");
    }
 else {
      setSeed(dim);
      setupProviderInfo();
    }
  }
  return dimensionInformation;
}
Program: 166030
Project: 166030
Buggy source:
@Override public int compareTo(Object o){
  return 0;
}

Fixed version (ground truth):
@Override public int compareTo(Object o){
  return getCommandName().compareTo(((ICommand)o).getCommandName());
}
Program: 166034
Project: 166034
Buggy source:
@Override protected void checkStateServer(){
  if (cachedX != xCoord || cachedY != yCoord || cachedZ != zCoord) {
    RFTools.log("String_Node_Str");
    TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
    destinations.removeDestination(new Coordinate(cachedX,cachedY,cachedZ),worldObj.provider.dimensionId);
    cachedX=xCoord;
    cachedY=yCoord;
    cachedZ=zCoord;
    GlobalCoordinate gc=new GlobalCoordinate(new Coordinate(xCoord,yCoord,zCoord),worldObj.provider.dimensionId);
    if (id == -1) {
      id=destinations.getNewId(gc);
    }
 else {
      destinations.assignId(gc,id);
    }
    destinations.addDestination(gc);
    destinations.save(worldObj);
    markDirty();
  }
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  if (cachedX != xCoord || cachedY != yCoord || cachedZ != zCoord) {
    TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
    destinations.removeDestination(new Coordinate(cachedX,cachedY,cachedZ),worldObj.provider.dimensionId);
    cachedX=xCoord;
    cachedY=yCoord;
    cachedZ=zCoord;
    GlobalCoordinate gc=new GlobalCoordinate(new Coordinate(xCoord,yCoord,zCoord),worldObj.provider.dimensionId);
    if (id == -1) {
      id=destinations.getNewId(gc);
    }
 else {
      destinations.assignId(gc,id);
    }
    destinations.addDestination(gc);
    destinations.save(worldObj);
    markDirty();
  }
}
Program: 166038
Project: 166038
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  ForgeDirection k=BlockTools.getOrientationHoriz(meta);
  TileEntity te=world.getTileEntity(x + k.offsetX,y + k.offsetY,z + k.offsetZ);
  if (te instanceof EndergenicTileEntity) {
    EndergenicTileEntity endergenicTileEntity=(EndergenicTileEntity)te;
    endergenicTileEntity.removeMonitor(new Coordinate(x,y,z));
  }
  super.breakBlock(world,x,y,z,block,meta);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block block,int meta){
  unregisterFromEndergenic(world,x,y,z);
  super.breakBlock(world,x,y,z,block,meta);
}
Program: 166039
Project: 166039
Buggy source:
@Override public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting){
  ItemStack stack=super.getCraftingResult(inventoryCrafting);
  if (stack != null) {
    NBTTagCompound tagCompound=inventoryCrafting.getStackInSlot(takeNBTFromSlot).getTagCompound();
    if (extraNBT != null) {
      if (tagCompound == null) {
        tagCompound=new NBTTagCompound();
      }
 else {
        tagCompound=(NBTTagCompound)tagCompound.copy();
      }
      for (      Map.Entry<String,Object> entry : extraNBT.entrySet()) {
        Object value=entry.getValue();
        if (value instanceof Integer) {
          tagCompound.setInteger(entry.getKey(),(Integer)value);
        }
 else         if (value instanceof Boolean) {
          tagCompound.setBoolean(entry.getKey(),(Boolean)value);
        }
 else         if (value instanceof String) {
          tagCompound.setString(entry.getKey(),(String)value);
        }
 else         if (value instanceof Double) {
          tagCompound.setDouble(entry.getKey(),(Double)value);
        }
 else         if (value instanceof Float) {
          tagCompound.setFloat(entry.getKey(),(Float)value);
        }
 else {
          throw new RuntimeException("String_Node_Str");
        }
      }
    }
    if (tagCompound != null) {
      stack.setTagCompound(tagCompound);
    }
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting){
  ItemStack stack=super.getCraftingResult(inventoryCrafting);
  if (stack != null) {
    NBTTagCompound tagCompound=getNBTFromObject(inventoryCrafting);
    if (extraNBT != null) {
      if (tagCompound == null) {
        tagCompound=new NBTTagCompound();
      }
 else {
        tagCompound=(NBTTagCompound)tagCompound.copy();
      }
      for (      Map.Entry<String,Object> entry : extraNBT.entrySet()) {
        Object value=entry.getValue();
        if (value instanceof Integer) {
          tagCompound.setInteger(entry.getKey(),(Integer)value);
        }
 else         if (value instanceof Boolean) {
          tagCompound.setBoolean(entry.getKey(),(Boolean)value);
        }
 else         if (value instanceof String) {
          tagCompound.setString(entry.getKey(),(String)value);
        }
 else         if (value instanceof Double) {
          tagCompound.setDouble(entry.getKey(),(Double)value);
        }
 else         if (value instanceof Float) {
          tagCompound.setFloat(entry.getKey(),(Float)value);
        }
 else {
          throw new RuntimeException("String_Node_Str");
        }
      }
    }
    if (tagCompound != null) {
      stack.setTagCompound(tagCompound);
    }
  }
  return stack;
}
Program: 166040
Project: 166040
Buggy source:
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  int d=evt.world.provider.dimensionId;
  if (d == 0) {
    RfToolsDimensionManager.unregisterDimensions();
    KnownDimletConfiguration.clean();
  }
}

Fixed version (ground truth):
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  int d=evt.world.provider.dimensionId;
  if (d != 0) {
    return;
  }
  if (evt.world.isRemote) {
    if (MinecraftServer.getServer().isDedicatedServer()) {
      RfToolsDimensionManager.unregisterDimensions();
      KnownDimletConfiguration.clean();
    }
  }
}
Program: 166042
Project: 166042
Buggy source:
private boolean isValidBiomeEssence(ItemStack stackEssence,NBTTagCompound essenceCompound){
  Block essenceBlock=((ItemBlock)stackEssence.getItem()).field_150939_a;
  if (essenceBlock != ModBlocks.biomeAbsorberBlock) {
    return false;
  }
  if (essenceCompound == null) {
    return false;
  }
  int absorbing=essenceCompound.getInteger("String_Node_Str");
  int biome=essenceCompound.getInteger("String_Node_Str");
  if (absorbing > 0 || biome == -1) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean isValidBiomeEssence(ItemStack stackEssence,NBTTagCompound essenceCompound){
  Block essenceBlock=getBlock(stackEssence);
  if (essenceBlock != ModBlocks.biomeAbsorberBlock) {
    return false;
  }
  if (essenceCompound == null) {
    return false;
  }
  int absorbing=essenceCompound.getInteger("String_Node_Str");
  int biome=essenceCompound.getInteger("String_Node_Str");
  if (absorbing > 0 || biome == -1) {
    return false;
  }
  return true;
}
Program: 166043
Project: 166043
Buggy source:
private boolean isValidMobEssence(ItemStack stackEssence,NBTTagCompound essenceCompound){
  if (stackEssence.getItem() != ModItems.syringeItem) {
    return false;
  }
  if (essenceCompound == null) {
    return false;
  }
  int level=essenceCompound.getInteger("String_Node_Str");
  int mobId=essenceCompound.getInteger("String_Node_Str");
  if (level < DimletConstructionConfiguration.maxMobInjections || mobId <= 0) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean isValidMobEssence(ItemStack stackEssence,NBTTagCompound essenceCompound){
  if (stackEssence.getItem() != ModItems.syringeItem) {
    return false;
  }
  if (essenceCompound == null) {
    return false;
  }
  int level=essenceCompound.getInteger("String_Node_Str");
  String mob=essenceCompound.getString("String_Node_Str");
  if (level < DimletConstructionConfiguration.maxMobInjections || mob == null) {
    return false;
  }
  return true;
}
Program: 166045
Project: 166045
Buggy source:
@Override public boolean onLeftClickEntity(ItemStack stack,EntityPlayer player,Entity entity){
  int id=findSelectedMobId(entity);
  if (id != -1) {
    int prevId=-1;
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      prevId=tagCompound.getInteger("String_Node_Str");
    }
 else {
      tagCompound=new NBTTagCompound();
      stack.setTagCompound(tagCompound);
    }
    if (prevId != id) {
      tagCompound.setInteger("String_Node_Str",id);
      tagCompound.setInteger("String_Node_Str",1);
    }
 else {
      int level=tagCompound.getInteger("String_Node_Str");
      level++;
      if (level > DimletConstructionConfiguration.maxMobInjections) {
        level=DimletConstructionConfiguration.maxMobInjections;
      }
      tagCompound.setInteger("String_Node_Str",level);
    }
  }
  return super.onLeftClickEntity(stack,player,entity);
}

Fixed version (ground truth):
@Override public boolean onLeftClickEntity(ItemStack stack,EntityPlayer player,Entity entity){
  String mob=findSelectedMobName(entity);
  if (mob != null) {
    String prevMob=null;
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      prevMob=tagCompound.getString("String_Node_Str");
    }
 else {
      tagCompound=new NBTTagCompound();
      stack.setTagCompound(tagCompound);
    }
    if (prevMob == null || !prevMob.equals(mob)) {
      tagCompound.setString("String_Node_Str",mob);
      tagCompound.setInteger("String_Node_Str",1);
    }
 else {
      int level=tagCompound.getInteger("String_Node_Str");
      level++;
      if (level > DimletConstructionConfiguration.maxMobInjections) {
        level=DimletConstructionConfiguration.maxMobInjections;
      }
      tagCompound.setInteger("String_Node_Str",level);
    }
  }
  return super.onLeftClickEntity(stack,player,entity);
}
Program: 166046
Project: 166046
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      int mobId=tagCompound.getInteger("String_Node_Str");
      if (mobId > 0) {
        DimletEntry entry=KnownDimletConfiguration.idToDimlet.get(mobId);
        if (entry != null) {
          RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + entry.getKey().getName());
        }
      }
      int level=tagCompound.getInteger("String_Node_Str");
      level=level * 100 / DimletConstructionConfiguration.maxMobInjections;
      RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + level+ "String_Node_Str");
    }
    return stack;
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      String mob=tagCompound.getString("String_Node_Str");
      if (mob != null) {
        RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + mob);
      }
      int level=tagCompound.getInteger("String_Node_Str");
      level=level * 100 / DimletConstructionConfiguration.maxMobInjections;
      RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + level+ "String_Node_Str");
    }
    return stack;
  }
  return stack;
}
Program: 166047
Project: 166047
Buggy source:
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack itemStack,EntityPlayer player,List list,boolean whatIsThis){
  super.addInformation(itemStack,player,list,whatIsThis);
  NBTTagCompound tagCompound=itemStack.getTagCompound();
  if (tagCompound != null) {
    int mobId=tagCompound.getInteger("String_Node_Str");
    if (mobId > 0) {
      DimletEntry entry=KnownDimletConfiguration.idToDimlet.get(mobId);
      if (entry != null) {
        list.add(EnumChatFormatting.BLUE + "String_Node_Str" + entry.getKey().getName());
      }
    }
    int level=tagCompound.getInteger("String_Node_Str");
    level=level * 100 / DimletConstructionConfiguration.maxMobInjections;
    list.add(EnumChatFormatting.BLUE + "String_Node_Str" + level+ "String_Node_Str");
  }
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
  }
 else {
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
  }
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack itemStack,EntityPlayer player,List list,boolean whatIsThis){
  super.addInformation(itemStack,player,list,whatIsThis);
  NBTTagCompound tagCompound=itemStack.getTagCompound();
  if (tagCompound != null) {
    String mob=tagCompound.getString("String_Node_Str");
    if (mob != null) {
      list.add(EnumChatFormatting.BLUE + "String_Node_Str" + mob);
    }
    int level=tagCompound.getInteger("String_Node_Str");
    level=level * 100 / DimletConstructionConfiguration.maxMobInjections;
    list.add(EnumChatFormatting.BLUE + "String_Node_Str" + level+ "String_Node_Str");
  }
  if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
  }
 else {
    list.add(EnumChatFormatting.WHITE + "String_Node_Str");
  }
}