nus-yam/ex-repair huggingface dataset:
Program: 166048
Project: 166048
Buggy source:
private static void initLiquidItems(Configuration cfg,Configuration mainCfg,Map<DimletKey,Integer> idsInConfig){
  Map<String,Fluid> fluidMap=FluidRegistry.getRegisteredFluids();
  for (  Map.Entry<String,Fluid> me : fluidMap.entrySet()) {
    if (me.getValue().canBePlacedInWorld()) {
      int id=registerDimlet(cfg,mainCfg,idsInConfig,new DimletKey(DimletType.DIMLET_LIQUID,me.getKey()));
      if (id != -1) {
        String displayName=new FluidStack(me.getValue(),1).getLocalizedName();
        DimletMapping.idToFluid.put(id,me.getValue().getBlock());
        idToDisplayName.put(id,DimletType.DIMLET_LIQUID.getName() + "String_Node_Str" + displayName+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private static void initLiquidItems(Configuration cfg,Configuration mainCfg,Map<DimletKey,Integer> idsInConfig){
  Map<String,Fluid> fluidMap=FluidRegistry.getRegisteredFluids();
  for (  Map.Entry<String,Fluid> me : fluidMap.entrySet()) {
    if (me.getValue().canBePlacedInWorld()) {
      int id=registerDimlet(cfg,mainCfg,idsInConfig,new DimletKey(DimletType.DIMLET_LIQUID,me.getKey()));
      if (id != -1) {
        String displayName=null;
        try {
          displayName=new FluidStack(me.getValue(),1).getLocalizedName();
        }
 catch (        Exception e) {
          RFTools.logError("String_Node_Str");
          RFTools.logError("String_Node_Str" + me.getKey());
          RFTools.logError("String_Node_Str" + me.getValue().getUnlocalizedName());
          displayName="String_Node_Str" + me.getKey() + "String_Node_Str";
          e.printStackTrace();
        }
        DimletMapping.idToFluid.put(id,me.getValue().getBlock());
        idToDisplayName.put(id,DimletType.DIMLET_LIQUID.getName() + "String_Node_Str" + displayName+ "String_Node_Str");
      }
    }
  }
}
Program: 166049
Project: 166049
Buggy source:
@SubscribeEvent public void loadEvent(WorldEvent.Load evt){
  System.out.println("String_Node_Str" + evt.world.isRemote);
  if (evt.world.provider.dimensionId != 0) {
    return;
  }
  if (evt.world.isRemote) {
    System.out.println("String_Node_Str");
    KnownDimletConfiguration.init();
    KnownDimletConfiguration.initCrafting();
  }
 else   if (MinecraftServer.getServer().isDedicatedServer()) {
    System.out.println("String_Node_Str");
    KnownDimletConfiguration.init();
    KnownDimletConfiguration.initCrafting();
  }
}

Fixed version (ground truth):
@SubscribeEvent public void loadEvent(WorldEvent.Load evt){
  System.out.println("String_Node_Str" + evt.world.isRemote + "String_Node_Str"+ evt.world.provider.dimensionId);
  if (evt.world.isRemote) {
    System.out.println("String_Node_Str");
    KnownDimletConfiguration.init();
    KnownDimletConfiguration.initCrafting();
  }
 else   if (MinecraftServer.getServer().isDedicatedServer()) {
    if (evt.world.provider.dimensionId == 0) {
      System.out.println("String_Node_Str");
      KnownDimletConfiguration.init();
      KnownDimletConfiguration.initCrafting();
    }
  }
}
Program: 166050
Project: 166050
Buggy source:
public void init(FMLInitializationEvent e){
  ModEntities.init();
  NetworkRegistry.INSTANCE.registerGuiHandler(RFTools.instance,new GuiProxy());
  MinecraftForge.EVENT_BUS.register(new WorldLoadEvent());
  FMLCommonHandler.instance().bus().register(new PlayerLoginEvent());
  FMLCommonHandler.instance().bus().register(new DimensionTickEvent());
}

Fixed version (ground truth):
public void init(FMLInitializationEvent e){
  ModEntities.init();
  NetworkRegistry.INSTANCE.registerGuiHandler(RFTools.instance,new GuiProxy());
  FMLCommonHandler.instance().bus().register(new ClientDisconnectEvent());
  MinecraftForge.EVENT_BUS.register(new WorldLoadEvent());
  FMLCommonHandler.instance().bus().register(new PlayerLoginEvent());
  FMLCommonHandler.instance().bus().register(new DimensionTickEvent());
}
Program: 166051
Project: 166051
Buggy source:
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  if (evt.world.isRemote) {
    return;
  }
  int d=evt.world.provider.dimensionId;
  if (d == 0) {
    RfToolsDimensionManager.unregisterDimensions();
  }
}

Fixed version (ground truth):
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  int d=evt.world.provider.dimensionId;
  System.out.println("String_Node_Str" + d);
  if (d == 0) {
    RfToolsDimensionManager.unregisterDimensions();
    KnownDimletConfiguration.clean();
  }
}
Program: 166052
Project: 166052
Buggy source:
private static void clean(){
  lastId=0;
  idToDimlet.clear();
  dimletToID.clear();
  idToDisplayName.clear();
  craftableDimlets.clear();
  dimletBlackList.clear();
  dimletRandomNotAllowed.clear();
  DimletMapping.clean();
  DimletRandomizer.clean();
}

Fixed version (ground truth):
public static void clean(){
  lastId=0;
  idToDimlet.clear();
  dimletToID.clear();
  idToDisplayName.clear();
  craftableDimlets.clear();
  dimletBlackList.clear();
  dimletRandomNotAllowed.clear();
  DimletMapping.clean();
  DimletRandomizer.clean();
}
Program: 166053
Project: 166053
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 (!EnergyTools.isEnergyTE(tileEntity)) {
    setInvalid();
    return;
  }
  EnergyTools.EnergyLevel energy=EnergyTools.getEnergyLevel(tileEntity);
  int maxEnergy=energy.getMaxEnergy();
  int ratio=0;
  boolean alarm=false;
  if (maxEnergy > 0) {
    int stored=energy.getEnergy();
    ratio=1 + (stored * 5) / maxEnergy;
    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 / maxEnergy) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxEnergy) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (getRflevel() != ratio || alarm != alarmValue) {
rflevel.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 (!EnergyTools.isEnergyTE(tileEntity)) {
    setInvalid();
    return;
  }
  EnergyTools.EnergyLevel energy=EnergyTools.getEnergyLevel(tileEntity);
  long maxEnergy=(long)energy.getMaxEnergy();
  int ratio=0;
  boolean alarm=false;
  if (maxEnergy > 0) {
    long stored=(long)energy.getEnergy();
    ratio=(int)(1 + (stored * 5) / maxEnergy);
    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 / maxEnergy) < alarmLevel);
break;
case MODE_MORE:
alarm=((stored * 100 / maxEnergy) > alarmLevel);
break;
}
}
Boolean v=inAlarm.getValue();
boolean alarmValue=v == null ? false : v;
if (getRflevel() != ratio || alarm != alarmValue) {
rflevel.setValue(ratio);
if (alarmValue != alarm) {
inAlarm.setValue(alarm);
}
notifyBlockUpdate();
}
}
Program: 166055
Project: 166055
Buggy source:
private void addMonitorPanel(Minecraft mc,Gui gui,final NBTTagCompound currentData,Panel panel){
  Panel monitorPanel=new Panel(mc,gui).setLayout(new HorizontalLayout()).setDesiredHeight(16);
  String monitoring;
  if (currentData.hasKey("String_Node_Str")) {
    int dim=currentData.getInteger("String_Node_Str");
    World world=RfToolsDimensionManager.getWorldForDimension(dim);
    int x=currentData.getInteger("String_Node_Str");
    int y=currentData.getInteger("String_Node_Str");
    int z=currentData.getInteger("String_Node_Str");
    monitoring=currentData.getString("String_Node_Str");
    Block block=world.getBlock(x,y,z);
    monitorPanel.addChild(new BlockRender(mc,gui).setRenderItem(block)).setDesiredWidth(20);
  }
 else {
    monitoring="String_Node_Str";
  }
  panel.addChild(monitorPanel);
  panel.addChild(new Label(mc,gui).setText(monitoring));
}

Fixed version (ground truth):
private void addMonitorPanel(Minecraft mc,Gui gui,final NBTTagCompound currentData,Panel panel){
  Panel monitorPanel=new Panel(mc,gui).setLayout(new HorizontalLayout()).setDesiredHeight(16);
  String monitoring;
  if (currentData.hasKey("String_Node_Str")) {
    int dim=currentData.getInteger("String_Node_Str");
    World world=mc.thePlayer.worldObj;
    int x=currentData.getInteger("String_Node_Str");
    int y=currentData.getInteger("String_Node_Str");
    int z=currentData.getInteger("String_Node_Str");
    monitoring=currentData.getString("String_Node_Str");
    Block block=world.getBlock(x,y,z);
    monitorPanel.addChild(new BlockRender(mc,gui).setRenderItem(block)).setDesiredWidth(20);
  }
 else {
    monitoring="String_Node_Str";
  }
  panel.addChild(monitorPanel);
  panel.addChild(new Label(mc,gui).setText(monitoring));
}
Program: 166056
Project: 166056
Buggy source:
private void renderModules(FontRenderer fontrenderer,ClientScreenModule.TransformMode mode,List<ClientScreenModule> modules,Map<Integer,String> screenData){
  float f3;
  int currenty=7;
  int moduleIndex=0;
  for (  ClientScreenModule module : modules) {
    if (module != null) {
      if (module.getTransformMode() != mode) {
        if (mode != ClientScreenModule.TransformMode.NONE) {
          GL11.glPopMatrix();
        }
        GL11.glPushMatrix();
        mode=module.getTransformMode();
switch (mode) {
case TEXT:
          GL11.glTranslatef(-0.5F,0.5F,0.07F);
        f3=0.0075F;
      GL11.glScalef(f3,-f3,f3);
    GL11.glNormal3f(0.0F,0.0F,-1.0F);
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
break;
case ITEM:
f3=0.0075F;
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty,screenData.get(moduleIndex));
currenty+=module.getHeight();
}
moduleIndex++;
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
}

Fixed version (ground truth):
private void renderModules(FontRenderer fontrenderer,ClientScreenModule.TransformMode mode,List<ClientScreenModule> modules,Map<Integer,String> screenData){
  float f3;
  int currenty=7;
  int moduleIndex=0;
  for (  ClientScreenModule module : modules) {
    if (module != null) {
      int height=module.getHeight();
      if (currenty + height <= 124) {
        if (module.getTransformMode() != mode) {
          if (mode != ClientScreenModule.TransformMode.NONE) {
            GL11.glPopMatrix();
          }
          GL11.glPushMatrix();
          mode=module.getTransformMode();
switch (mode) {
case TEXT:
            GL11.glTranslatef(-0.5F,0.5F,0.07F);
          f3=0.0075F;
        GL11.glScalef(f3,-f3,f3);
      GL11.glNormal3f(0.0F,0.0F,-1.0F);
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  break;
case ITEM:
f3=0.0075F;
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty,screenData.get(moduleIndex));
currenty+=height;
}
}
moduleIndex++;
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
}
Program: 166057
Project: 166057
Buggy source:
@Override public ItemStack decrStackSize(int index,int amount){
  clientScreenModules=null;
  return inventoryHelper.decrStackSize(index,amount);
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int index,int amount){
  clientScreenModules=null;
  screenModules=null;
  return inventoryHelper.decrStackSize(index,amount);
}
Program: 166058
Project: 166058
Buggy source:
private void readBufferFromNBT(NBTTagCompound tagCompound){
  NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  for (int i=0; i < bufferTagList.tagCount(); i++) {
    NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
    inventoryHelper.getStacks()[i + ScreenContainer.SLOT_MODULES]=ItemStack.loadItemStackFromNBT(nbtTagCompound);
  }
  clientScreenModules=null;
}

Fixed version (ground truth):
private void readBufferFromNBT(NBTTagCompound tagCompound){
  NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
  for (int i=0; i < bufferTagList.tagCount(); i++) {
    NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
    inventoryHelper.getStacks()[i + ScreenContainer.SLOT_MODULES]=ItemStack.loadItemStackFromNBT(nbtTagCompound);
  }
  clientScreenModules=null;
  screenModules=null;
}
Program: 166059
Project: 166059
Buggy source:
public void updateModuleData(int slot,NBTTagCompound tagCompound){
  ItemStack stack=inventoryHelper.getStacks()[slot];
  stack.setTagCompound(tagCompound);
  markDirty();
}

Fixed version (ground truth):
public void updateModuleData(int slot,NBTTagCompound tagCompound){
  ItemStack stack=inventoryHelper.getStacks()[slot];
  stack.setTagCompound(tagCompound);
  screenModules=null;
  clientScreenModules=null;
  markDirty();
}
Program: 166060
Project: 166060
Buggy source:
@Override public void setInventorySlotContents(int index,ItemStack stack){
  inventoryHelper.setInventorySlotContents(getInventoryStackLimit(),index,stack);
  clientScreenModules=null;
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int index,ItemStack stack){
  inventoryHelper.setInventorySlotContents(getInventoryStackLimit(),index,stack);
  clientScreenModules=null;
  screenModules=null;
}
Program: 166061
Project: 166061
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  renderScreenBoard();
  FontRenderer fontrenderer=this.func_147498_b();
  ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
  GL11.glDepthMask(false);
  GL11.glDisable(GL11.GL_LIGHTING);
  int currenty=7;
  for (  ClientScreenModule module : modules) {
    if (module.getTransformMode() != mode) {
      if (mode != ClientScreenModule.TransformMode.NONE) {
        GL11.glPopMatrix();
      }
      GL11.glPushMatrix();
      mode=module.getTransformMode();
switch (mode) {
case TEXT:
        GL11.glTranslatef(-0.5F,0.5F,0.07F);
      f3=0.0075F;
    GL11.glScalef(f3,-f3,f3);
  GL11.glNormal3f(0.0F,0.0F,-1.0F);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
break;
case ITEM:
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty);
currenty+=module.getHeight();
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
GL11.glDepthMask(true);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
GL11.glPopMatrix();
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  renderScreenBoard();
  FontRenderer fontrenderer=this.func_147498_b();
  ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
  GL11.glDepthMask(false);
  GL11.glDisable(GL11.GL_LIGHTING);
  int currenty=7;
  for (  ClientScreenModule module : modules) {
    if (module.getTransformMode() != mode) {
      if (mode != ClientScreenModule.TransformMode.NONE) {
        GL11.glPopMatrix();
      }
      GL11.glPushMatrix();
      mode=module.getTransformMode();
switch (mode) {
case TEXT:
        GL11.glTranslatef(-0.5F,0.5F,0.07F);
      f3=0.0075F;
    GL11.glScalef(f3,-f3,f3);
  GL11.glNormal3f(0.0F,0.0F,-1.0F);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
break;
case ITEM:
f3=0.0075F;
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty);
currenty+=module.getHeight();
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
GL11.glDepthMask(true);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
GL11.glPopMatrix();
}
Program: 166062
Project: 166062
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  renderScreenBoard();
  FontRenderer fontrenderer=this.func_147498_b();
  ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
  GL11.glDepthMask(false);
  int currenty=7;
  for (  ClientScreenModule module : modules) {
    if (module.getTransformMode() != mode) {
      if (mode != ClientScreenModule.TransformMode.NONE) {
        GL11.glPopMatrix();
      }
      GL11.glPushMatrix();
      mode=module.getTransformMode();
switch (mode) {
case TEXT:
        GL11.glTranslatef(-0.5F,0.5F,0.07F);
      f3=0.0075F;
    GL11.glScalef(f3,-f3,f3);
  GL11.glNormal3f(0.0F,0.0F,-1.0F);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
break;
case ITEM:
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty);
currenty+=module.getHeight();
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
GL11.glDepthMask(true);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
GL11.glPopMatrix();
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  renderScreenBoard();
  FontRenderer fontrenderer=this.func_147498_b();
  ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
  GL11.glDepthMask(false);
  GL11.glDisable(GL11.GL_LIGHTING);
  int currenty=7;
  for (  ClientScreenModule module : modules) {
    if (module.getTransformMode() != mode) {
      if (mode != ClientScreenModule.TransformMode.NONE) {
        GL11.glPopMatrix();
      }
      GL11.glPushMatrix();
      mode=module.getTransformMode();
switch (mode) {
case TEXT:
        GL11.glTranslatef(-0.5F,0.5F,0.07F);
      f3=0.0075F;
    GL11.glScalef(f3,-f3,f3);
  GL11.glNormal3f(0.0F,0.0F,-1.0F);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
break;
case ITEM:
GL11.glTranslatef(-0.5F,0.5F,0.07F);
GL11.glScalef(f3,-f3,-0.0001f);
break;
default :
break;
}
}
module.render(fontrenderer,currenty);
currenty+=module.getHeight();
}
if (mode != ClientScreenModule.TransformMode.NONE) {
GL11.glPopMatrix();
}
GL11.glDepthMask(true);
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
GL11.glPopMatrix();
}
Program: 166063
Project: 166063
Buggy source:
@Override public void registerWorldChunkManager(){
  int dim=worldObj.provider.dimensionId;
  long seed=calculateSeed(worldObj.getSeed(),dim);
  getDimensionInformation();
  storage=DimensionStorage.getDimensionStorage(worldObj);
  if (dimensionInformation != null && !dimensionInformation.getBiomes().isEmpty()) {
    worldChunkMgr=new SingleBiomeWorldChunkManager(worldObj,seed,terrainType);
  }
 else {
    worldChunkMgr=new WorldChunkManager(seed,worldObj.getWorldInfo().getTerrainType());
  }
  hasNoSky=!dimensionInformation.getTerrainType().hasSky();
  if (worldObj.isRemote) {
    SkyType skyType=dimensionInformation.getSkyDescriptor().getSkyType();
    if (hasNoSky) {
      SkyRenderer.registerNoSky(this);
    }
 else     if (skyType == SkyType.SKY_ENDER) {
      SkyRenderer.registerEnderSky(this);
    }
 else     if (skyType == SkyType.SKY_INFERNO) {
      SkyRenderer.registerPlasmaSky(this);
    }
 else {
      SkyRenderer.registerSky(this,dimensionInformation);
    }
  }
}

Fixed version (ground truth):
@Override public void registerWorldChunkManager(){
  int dim=worldObj.provider.dimensionId;
  seed=calculateSeed(worldObj.getSeed(),dim);
  getDimensionInformation();
  storage=DimensionStorage.getDimensionStorage(worldObj);
  setupProviderInfo();
}
Program: 166064
Project: 166064
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");
    }
  }
  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 {
      setupProviderInfo();
    }
  }
  return dimensionInformation;
}
Program: 166065
Project: 166065
Buggy source:
@Override public double getHorizon(){
  getDimensionInformation();
  if (dimensionInformation.getTerrainType().hasNoHorizon()) {
    return 0;
  }
 else {
    return super.getHorizon();
  }
}

Fixed version (ground truth):
@Override public double getHorizon(){
  getDimensionInformation();
  if (dimensionInformation != null && dimensionInformation.getTerrainType().hasNoHorizon()) {
    return 0;
  }
 else {
    return super.getHorizon();
  }
}
Program: 166066
Project: 166066
Buggy source:
@Override public boolean isSurfaceWorld(){
  getDimensionInformation();
  return dimensionInformation.getTerrainType().hasSky();
}

Fixed version (ground truth):
@Override public boolean isSurfaceWorld(){
  getDimensionInformation();
  if (dimensionInformation == null) {
    return super.isSurfaceWorld();
  }
  return dimensionInformation.getTerrainType().hasSky();
}
Program: 166067
Project: 166067
Buggy source:
@Override public void replaceBlocksForBiome(int chunkX,int chunkZ,Block[] aBlock,byte[] abyte,BiomeGenBase[] biomeGenBases){
  ChunkProviderEvent.ReplaceBiomeBlocks event=new ChunkProviderEvent.ReplaceBiomeBlocks(provider,chunkX,chunkZ,aBlock,abyte,biomeGenBases,world);
  MinecraftForge.EVENT_BUS.post(event);
  if (event.getResult() == Event.Result.DENY) {
    for (int cx=0; cx < 16; ++cx) {
      for (int cz=0; cz < 16; ++cz) {
        int bottomIndex=((cz * 16) + cx) * (aBlock.length / 256);
        while (aBlock[bottomIndex] == Blocks.bedrock) {
          aBlock[bottomIndex++]=null;
        }
      }
    }
    return;
  }
  double d0=0.03125D;
  this.stoneNoise=this.noiseGen4.generateNoiseOctaves(this.stoneNoise,(chunkX * 16),(chunkZ * 16),16,16,d0 * 2.0D,d0 * 2.0D,1.0D);
  for (int k=0; k < 16; ++k) {
    for (int l=0; l < 16; ++l) {
      BiomeGenBase biomegenbase=biomeGenBases[l + k * 16];
      genBiomeTerrain(biomegenbase,aBlock,abyte,chunkX * 16 + k,chunkZ * 16 + l,this.stoneNoise[l + k * 16]);
    }
  }
}

Fixed version (ground truth):
@Override public void replaceBlocksForBiome(int chunkX,int chunkZ,Block[] aBlock,byte[] abyte,BiomeGenBase[] biomeGenBases){
  double d0=0.03125D;
  this.stoneNoise=this.noiseGen4.generateNoiseOctaves(this.stoneNoise,(chunkX * 16),(chunkZ * 16),16,16,d0 * 2.0D,d0 * 2.0D,1.0D);
  for (int k=0; k < 16; ++k) {
    for (int l=0; l < 16; ++l) {
      BiomeGenBase biomegenbase=biomeGenBases[l + k * 16];
      genBiomeTerrain(biomegenbase,aBlock,abyte,chunkX * 16 + k,chunkZ * 16 + l,this.stoneNoise[l + k * 16]);
    }
  }
}
Program: 166069
Project: 166069
Buggy source:
private boolean placeResult(boolean internal,ItemStack result){
  int start;
  int stop;
  if (internal) {
    start=CrafterContainer.SLOT_BUFFER;
    stop=CrafterContainer.SLOT_BUFFER + CrafterContainer.BUFFER_SIZE;
  }
 else {
    start=CrafterContainer.SLOT_BUFFEROUT;
    stop=CrafterContainer.SLOT_BUFFEROUT + CrafterContainer.BUFFEROUT_SIZE;
  }
  return InventoryHelper.mergeItemStack(this,result,start,stop);
}

Fixed version (ground truth):
private boolean placeResult(boolean internal,ItemStack result){
  int start;
  int stop;
  if (internal) {
    start=CrafterContainer.SLOT_BUFFER;
    stop=CrafterContainer.SLOT_BUFFER + CrafterContainer.BUFFER_SIZE;
  }
 else {
    start=CrafterContainer.SLOT_BUFFEROUT;
    stop=CrafterContainer.SLOT_BUFFEROUT + CrafterContainer.BUFFEROUT_SIZE;
  }
  if (!InventoryHelper.checkIfStackCanBeMerged(this,result,start,stop)) {
    return false;
  }
  return InventoryHelper.mergeItemStack(this,result,start,stop);
}
Program: 166070
Project: 166070
Buggy source:
@Override public void replaceBlocksForBiome(int chunkX,int chunkZ,Block[] aBlock,byte[] abyte,BiomeGenBase[] biomeGenBases){
  ChunkProviderEvent.ReplaceBiomeBlocks event=new ChunkProviderEvent.ReplaceBiomeBlocks(provider,chunkX,chunkZ,aBlock,abyte,biomeGenBases,world);
  MinecraftForge.EVENT_BUS.post(event);
  if (event.getResult() == Event.Result.DENY) {
    return;
  }
  double d0=0.03125D;
  this.stoneNoise=this.noiseGen4.generateNoiseOctaves(this.stoneNoise,(chunkX * 16),(chunkZ * 16),16,16,d0 * 2.0D,d0 * 2.0D,1.0D);
  for (int k=0; k < 16; ++k) {
    for (int l=0; l < 16; ++l) {
      BiomeGenBase biomegenbase=biomeGenBases[l + k * 16];
      genBiomeTerrain(biomegenbase,aBlock,abyte,chunkX * 16 + k,chunkZ * 16 + l,this.stoneNoise[l + k * 16]);
    }
  }
}

Fixed version (ground truth):
@Override public void replaceBlocksForBiome(int chunkX,int chunkZ,Block[] aBlock,byte[] abyte,BiomeGenBase[] biomeGenBases){
  ChunkProviderEvent.ReplaceBiomeBlocks event=new ChunkProviderEvent.ReplaceBiomeBlocks(provider,chunkX,chunkZ,aBlock,abyte,biomeGenBases,world);
  MinecraftForge.EVENT_BUS.post(event);
  if (event.getResult() == Event.Result.DENY) {
    for (int cx=0; cx < 16; ++cx) {
      for (int cz=0; cz < 16; ++cz) {
        int bottomIndex=((cz * 16) + cx) * (aBlock.length / 256);
        while (aBlock[bottomIndex] == Blocks.bedrock) {
          aBlock[bottomIndex++]=null;
        }
      }
    }
    return;
  }
  double d0=0.03125D;
  this.stoneNoise=this.noiseGen4.generateNoiseOctaves(this.stoneNoise,(chunkX * 16),(chunkZ * 16),16,16,d0 * 2.0D,d0 * 2.0D,1.0D);
  for (int k=0; k < 16; ++k) {
    for (int l=0; l < 16; ++l) {
      BiomeGenBase biomegenbase=biomeGenBases[l + k * 16];
      genBiomeTerrain(biomegenbase,aBlock,abyte,chunkX * 16 + k,chunkZ * 16 + l,this.stoneNoise[l + k * 16]);
    }
  }
}
Program: 166072
Project: 166072
Buggy source:
private void calculateMobs(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_MOBS,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomExtraMobsChance) {
      int id=DimletRandomizer.getRandomMob(random);
      actualRfCost+=calculateCostFactor(id);
      extraMobs.add(DimletMapping.idtoMob.get(id));
    }
  }
 else   if (dimlets.size() == 1 && DimletMapping.idtoMob.get(dimlets.get(0).getLeft().getId()) == null) {
  }
 else {
    for (    Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifiers : dimlets) {
      extraMobs.add(DimletMapping.idtoMob.get(dimletWithModifiers.getLeft().getId()));
    }
  }
}

Fixed version (ground truth):
private void calculateMobs(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_MOBS,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomExtraMobsChance) {
      int id=DimletRandomizer.getRandomMob(random);
      actualRfCost+=calculateCostFactor(id);
      extraMobs.add(DimletMapping.idtoMob.get(id));
    }
  }
 else {
    if (dimlets.size() == 1 && DimletMapping.idtoMob.get(dimlets.get(0).getLeft().getId()).getEntityClass() == null) {
    }
 else {
      for (      Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifiers : dimlets) {
        MobDescriptor descriptor=DimletMapping.idtoMob.get(dimletWithModifiers.getLeft().getId());
        if (descriptor.getEntityClass() != null) {
          extraMobs.add(descriptor);
        }
      }
    }
  }
}
Program: 166073
Project: 166073
Buggy source:
public GenericBlock(Material material,Class<? extends TileEntity> tileEntityClass){
  super(material);
  this.tileEntityClass=tileEntityClass;
}

Fixed version (ground truth):
public GenericBlock(Material material,Class<? extends TileEntity> tileEntityClass){
  super(material);
  this.tileEntityClass=tileEntityClass;
  setHardness(2.0f);
  setStepSound(soundTypeMetal);
  setHarvestLevel("String_Node_Str",0);
}
Program: 166074
Project: 166074
Buggy source:
public static int findSuitableEmptySpot(World world,int x,int z){
  int y=world.getTopSolidOrLiquidBlock(x,z);
  if (y == -1) {
    return -1;
  }
  y--;
  Block block=world.getBlock(x,y + 1,z);
  while (block.getMaterial().isLiquid()) {
    y++;
    if (y > world.getHeight() - 10) {
      return -1;
    }
    block=world.getBlock(x,y + 1,z);
  }
  return y;
}

Fixed version (ground truth):
public static int findSuitableEmptySpot(World world,int x,int z){
  int y=world.getTopSolidOrLiquidBlock(x,z);
  if (y == -1) {
    return -1;
  }
  y--;
  if (y > world.getHeight() - 5) {
    y=world.getHeight() / 2;
  }
  Block block=world.getBlock(x,y + 1,z);
  while (block.getMaterial().isLiquid()) {
    y++;
    if (y > world.getHeight() - 10) {
      return -1;
    }
    block=world.getBlock(x,y + 1,z);
  }
  return y;
}
Program: 166076
Project: 166076
Buggy source:
private void calculateEffects(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_EFFECT,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomStructureChance) {
      effectTypes.add(DimletRandomizer.getRandomEffect(random,false));
    }
  }
 else {
    for (    Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifier : dimlets) {
      EffectType effectType=DimletMapping.idToEffectType.get(dimletWithModifier.getLeft().getId());
      if (effectType != EffectType.EFFECT_NONE) {
        effectTypes.add(effectType);
      }
    }
  }
}

Fixed version (ground truth):
private void calculateEffects(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_EFFECT,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomEffectChance) {
      int id=DimletRandomizer.getRandomEffect(random,false);
      EffectType effectType=DimletMapping.idToEffectType.get(id);
      if (!effectTypes.contains(effectType)) {
        actualRfCost+=calculateCostFactor(id);
        effectTypes.add(effectType);
      }
    }
  }
 else {
    for (    Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifier : dimlets) {
      EffectType effectType=DimletMapping.idToEffectType.get(dimletWithModifier.getLeft().getId());
      if (effectType != EffectType.EFFECT_NONE) {
        effectTypes.add(effectType);
      }
    }
  }
}
Program: 166077
Project: 166077
Buggy source:
private float calculateCostFactor(int id){
  DimletEntry dimletEntry=KnownDimletConfiguration.idToDimlet.get(id);
  if (dimletEntry == null) {
    RFTools.logError("String_Node_Str" + id);
    return 0.0f;
  }
  return dimletEntry.getRfMaintainCost() * DimletConfiguration.afterCreationCostFactor;
}

Fixed version (ground truth):
private int calculateCostFactor(int id){
  DimletEntry dimletEntry=KnownDimletConfiguration.idToDimlet.get(id);
  if (dimletEntry == null) {
    RFTools.logError("String_Node_Str" + id);
    return 0;
  }
  return (int)(dimletEntry.getRfMaintainCost() * DimletConfiguration.afterCreationCostFactor);
}
Program: 166078
Project: 166078
Buggy source:
private void calculateMobs(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_MOBS,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomExtraMobsChance) {
      extraMobs.add(DimletRandomizer.getRandomMob(random));
    }
  }
 else   if (dimlets.size() == 1 && DimletMapping.idtoMob.get(dimlets.get(0).getLeft().getId()) == null) {
  }
 else {
    for (    Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifiers : dimlets) {
      extraMobs.add(DimletMapping.idtoMob.get(dimletWithModifiers.getLeft().getId()));
    }
  }
}

Fixed version (ground truth):
private void calculateMobs(List<Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>>> dimlets,Random random){
  dimlets=extractType(DimletType.DIMLET_MOBS,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomExtraMobsChance) {
      int id=DimletRandomizer.getRandomMob(random);
      actualRfCost+=calculateCostFactor(id);
      extraMobs.add(DimletMapping.idtoMob.get(id));
    }
  }
 else   if (dimlets.size() == 1 && DimletMapping.idtoMob.get(dimlets.get(0).getLeft().getId()) == null) {
  }
 else {
    for (    Pair<DimensionDescriptor.DimletDescriptor,List<DimensionDescriptor.DimletDescriptor>> dimletWithModifiers : dimlets) {
      extraMobs.add(DimletMapping.idtoMob.get(dimletWithModifiers.getLeft().getId()));
    }
  }
}
Program: 166079
Project: 166079
Buggy source:
public GenericChunkProvider(World world,long seed){
  this.worldObj=world;
  dimensionInformation=RfToolsDimensionManager.getDimensionManager(world).getDimensionInformation(world.provider.dimensionId);
  this.worldType=world.getWorldInfo().getTerrainType();
  if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_AMPLIFIED) {
    worldType=WorldType.AMPLIFIED;
  }
 else   if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_FLAT) {
    worldType=WorldType.FLAT;
  }
  this.rand=new Random((seed + 516) * 314);
  terrainGeneratorMap.get(dimensionInformation.getTerrainType()).setup(world,this);
  extraSpawns=new ArrayList<BiomeGenBase.SpawnListEntry>();
  extraSpawnsMax=new ArrayList<Integer>();
  for (  MobDescriptor mob : dimensionInformation.getExtraMobs()) {
    Class<? extends EntityLiving> entityClass=mob.getEntityClass();
    extraSpawns.add(new BiomeGenBase.SpawnListEntry(entityClass,mob.getSpawnChance(),mob.getMinGroup(),mob.getMaxGroup()));
    extraSpawnsMax.add(mob.getMaxLoaded());
    System.out.println("String_Node_Str" + entityClass);
  }
}

Fixed version (ground truth):
public GenericChunkProvider(World world,long seed){
  this.worldObj=world;
  dimensionInformation=RfToolsDimensionManager.getDimensionManager(world).getDimensionInformation(world.provider.dimensionId);
  this.worldType=world.getWorldInfo().getTerrainType();
  if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_AMPLIFIED) {
    worldType=WorldType.AMPLIFIED;
  }
 else   if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_FLAT) {
    worldType=WorldType.FLAT;
  }
  this.seed=seed;
  this.rand=new Random((seed + 516) * 314);
  terrainGeneratorMap.get(dimensionInformation.getTerrainType()).setup(world,this);
  extraSpawns=new ArrayList<BiomeGenBase.SpawnListEntry>();
  extraSpawnsMax=new ArrayList<Integer>();
  for (  MobDescriptor mob : dimensionInformation.getExtraMobs()) {
    Class<? extends EntityLiving> entityClass=mob.getEntityClass();
    extraSpawns.add(new BiomeGenBase.SpawnListEntry(entityClass,mob.getSpawnChance(),mob.getMinGroup(),mob.getMaxGroup()));
    extraSpawnsMax.add(mob.getMaxLoaded());
    System.out.println("String_Node_Str" + entityClass);
  }
}
Program: 166080
Project: 166080
Buggy source:
@Override public void generate(int chunkX,int chunkZ,Block[] aBlock){
  Block baseBlock=provider.dimensionInformation.getBaseBlockForTerrain();
  byte waterLevel=63;
  for (int x4=0; x4 < 4; ++x4) {
    for (int z4=0; z4 < 4; ++z4) {
      for (int height=0; height < 256; ++height) {
        for (int x=0; x < 4; ++x) {
          int index=((x + (x4 * 4)) << 12) | ((0 + (z4 * 4)) << 8) | height;
          short maxheight=256;
          index-=maxheight;
          for (int z=0; z < 4; ++z) {
            if (height < waterLevel) {
              aBlock[index+=maxheight]=baseBlock;
            }
 else {
              aBlock[index+=maxheight]=null;
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void generate(int chunkX,int chunkZ,Block[] aBlock){
  Block baseBlock=provider.dimensionInformation.getBaseBlockForTerrain();
  byte waterLevel=63;
  boolean elevated=false;
  if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
    long s2=((chunkX + provider.seed + 13) * 314) + chunkZ * 17L;
    Random rand=new Random(s2);
    rand.nextFloat();
    elevated=(chunkX & 1) == 0;
    if (rand.nextFloat() < .2f) {
      elevated=!elevated;
    }
    if (elevated) {
      waterLevel=120;
    }
 else {
      waterLevel=40;
    }
  }
  for (int x4=0; x4 < 4; ++x4) {
    for (int z4=0; z4 < 4; ++z4) {
      for (int height=0; height < 256; ++height) {
        for (int x=0; x < 4; ++x) {
          int index=((x + (x4 * 4)) << 12) | ((0 + (z4 * 4)) << 8) | height;
          short maxheight=256;
          index-=maxheight;
          for (int z=0; z < 4; ++z) {
            if (height < waterLevel) {
              aBlock[index+=maxheight]=baseBlock;
            }
 else {
              aBlock[index+=maxheight]=null;
            }
          }
        }
      }
    }
  }
}
Program: 166083
Project: 166083
Buggy source:
public static MobDescriptor getRandomMob(Random random){
  return DimletMapping.idtoMob.get(randomMobDimlets.select(random));
}

Fixed version (ground truth):
public static int getRandomMob(Random random){
  return randomMobDimlets.select(random);
}
Program: 166084
Project: 166084
Buggy source:
public static EffectType getRandomEffect(Random random,boolean allowRandom){
  Integer id=randomEffectDimlets.select(random);
  while ((!allowRandom) && KnownDimletConfiguration.idToDimlet.get(id).isRandomNotAllowed()) {
    id=randomEffectDimlets.select(random);
  }
  return DimletMapping.idToEffectType.get(id);
}

Fixed version (ground truth):
public static int getRandomEffect(Random random,boolean allowRandom){
  Integer id=randomEffectDimlets.select(random);
  while ((!allowRandom) && KnownDimletConfiguration.idToDimlet.get(id).isRandomNotAllowed()) {
    id=randomEffectDimlets.select(random);
  }
  return id;
}
Program: 166086
Project: 166086
Buggy source:
@Override public boolean execute(String command,Map<String,Argument> args){
  boolean rc=super.execute(command,args);
  if (rc) {
    return true;
  }
  if (CMD_SETMODE.equals(command)) {
    Integer index=args.get("String_Node_Str").getInteger();
    Integer input=args.get("String_Node_Str").getInteger();
    inputMode[index]=(byte)(int)input;
    markDirty();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean execute(String command,Map<String,Argument> args){
  boolean rc=super.execute(command,args);
  if (rc) {
    return true;
  }
  if (CMD_SETMODE.equals(command)) {
    Integer index=args.get("String_Node_Str").getInteger();
    Integer input=args.get("String_Node_Str").getInteger();
    inputMode[index]=(byte)(int)input;
    markDirty();
    worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
    return true;
  }
  return false;
}
Program: 166087
Project: 166087
Buggy source:
private void injectMobDimlet(int id){
  addToCost(id);
  extraMobs.add(DimletMapping.idtoMob.get(id));
}

Fixed version (ground truth):
private void injectMobDimlet(int id){
  addToCost(id);
  MobDescriptor mobDescriptor=DimletMapping.idtoMob.get(id);
  if (mobDescriptor != null && mobDescriptor.getEntityClass() != null) {
    extraMobs.add(mobDescriptor);
  }
}
Program: 166092
Project: 166092
Buggy source:
@Override protected void checkStateServer(){
  ticker--;
  if (ticker > 0) {
    return;
  }
  ticker=5;
  ItemStack itemStack=inventoryHelper.getStacks()[0];
  if (itemStack == null || itemStack.stackSize == 0) {
    setState(-1,0);
    return;
  }
  NBTTagCompound tagCompound=itemStack.getTagCompound();
  int editTicksLeft=tagCompound.getInteger("String_Node_Str");
  if (editTicksLeft > 0) {
    setState(-1,0);
    return;
  }
  int ticksLeft=tagCompound.getInteger("String_Node_Str");
  int tickCost=tagCompound.getInteger("String_Node_Str");
  if (ticksLeft > 0) {
    ticksLeft=createDimensionTick(tagCompound,ticksLeft);
  }
 else {
    maintainDimensionTick(tagCompound);
  }
  setState(ticksLeft,tickCost);
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  ItemStack itemStack=inventoryHelper.getStacks()[0];
  if (itemStack == null || itemStack.stackSize == 0) {
    setState(-1,0);
    return;
  }
  NBTTagCompound tagCompound=itemStack.getTagCompound();
  int ticksLeft=tagCompound.getInteger("String_Node_Str");
  int tickCost=tagCompound.getInteger("String_Node_Str");
  if (ticksLeft > 0) {
    ticksLeft=createDimensionTick(tagCompound,ticksLeft);
  }
 else {
    maintainDimensionTick(tagCompound);
  }
  setState(ticksLeft,tickCost);
}
Program: 166093
Project: 166093
Buggy source:
public void save(World world){
  world.mapStorage.setData(DIMMANAGER_NAME,this);
  markDirty();
  if (!world.isRemote) {
    PacketHandler.INSTANCE.sendToAll(new PacketSyncDimensionInfo(dimensions,dimensionToID,dimensionInformation));
  }
}

Fixed version (ground truth):
public void save(World world){
  world.mapStorage.setData(DIMMANAGER_NAME,this);
  markDirty();
  syncDimInfoToClients(world);
}
Program: 166094
Project: 166094
Buggy source:
public void syncFromServer(Map<Integer,DimensionDescriptor> dimensions,Map<DimensionDescriptor,Integer> dimensionToID,Map<Integer,DimensionInformation> dimensionInformation){
  this.dimensions.clear();
  this.dimensions.putAll(dimensions);
  this.dimensionToID.clear();
  this.dimensionToID.putAll(dimensionToID);
  this.dimensionInformation.clear();
  this.dimensionInformation.putAll(dimensionInformation);
}

Fixed version (ground truth):
public void syncFromServer(Map<Integer,DimensionDescriptor> dimensions,Map<DimensionDescriptor,Integer> dimensionToID,Map<Integer,DimensionInformation> dimensionInformation){
  System.out.println("String_Node_Str");
  this.dimensions.clear();
  this.dimensions.putAll(dimensions);
  this.dimensionToID.clear();
  this.dimensionToID.putAll(dimensionToID);
  this.dimensionInformation.clear();
  this.dimensionInformation.putAll(dimensionInformation);
}
Program: 166095
Project: 166095
Buggy source:
@Override @SideOnly(Side.CLIENT) public Vec3 getSkyColor(Entity cameraEntity,float partialTicks){
  int dim=worldObj.provider.dimensionId;
  if (System.currentTimeMillis() - lastTime > 1000) {
    lastTime=System.currentTimeMillis();
    PacketHandler.INSTANCE.sendToServer(new PacketGetDimensionEnergy(dim));
  }
  float factor=calculatePowerBlackout(dim);
  float r=dimensionInformation.getSkyDescriptor().getSkyColorFactorR() * factor;
  float g=dimensionInformation.getSkyDescriptor().getSkyColorFactorG() * factor;
  float b=dimensionInformation.getSkyDescriptor().getSkyColorFactorB() * factor;
  Vec3 skyColor=super.getSkyColor(cameraEntity,partialTicks);
  return Vec3.createVectorHelper(skyColor.xCoord * r,skyColor.yCoord * g,skyColor.zCoord * b);
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public Vec3 getSkyColor(Entity cameraEntity,float partialTicks){
  int dim=worldObj.provider.dimensionId;
  if (System.currentTimeMillis() - lastTime > 1000) {
    lastTime=System.currentTimeMillis();
    PacketHandler.INSTANCE.sendToServer(new PacketGetDimensionEnergy(dim));
  }
  float factor=calculatePowerBlackout(dim);
  getDimensionInformation();
  float r;
  float g;
  float b;
  if (dimensionInformation == null) {
    r=g=b=1.0f;
  }
 else {
    r=dimensionInformation.getSkyDescriptor().getSkyColorFactorR() * factor;
    g=dimensionInformation.getSkyDescriptor().getSkyColorFactorG() * factor;
    b=dimensionInformation.getSkyDescriptor().getSkyColorFactorB() * factor;
  }
  Vec3 skyColor=super.getSkyColor(cameraEntity,partialTicks);
  return Vec3.createVectorHelper(skyColor.xCoord * r,skyColor.yCoord * g,skyColor.zCoord * b);
}
Program: 166096
Project: 166096
Buggy source:
@Override @SideOnly(Side.CLIENT) public float getSunBrightness(float par1){
  int dim=worldObj.provider.dimensionId;
  float factor=calculatePowerBlackout(dim);
  return super.getSunBrightness(par1) * dimensionInformation.getSkyDescriptor().getSunBrightnessFactor() * factor;
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public float getSunBrightness(float par1){
  getDimensionInformation();
  if (dimensionInformation == null) {
    return super.getSunBrightness(par1);
  }
  int dim=worldObj.provider.dimensionId;
  float factor=calculatePowerBlackout(dim);
  return super.getSunBrightness(par1) * dimensionInformation.getSkyDescriptor().getSunBrightnessFactor() * factor;
}
Program: 166097
Project: 166097
Buggy source:
@Override @SideOnly(Side.CLIENT) public float getStarBrightness(float par1){
  return super.getStarBrightness(par1) * dimensionInformation.getSkyDescriptor().getStarBrightnessFactor();
}

Fixed version (ground truth):
@Override @SideOnly(Side.CLIENT) public float getStarBrightness(float par1){
  getDimensionInformation();
  if (dimensionInformation == null) {
    return super.getStarBrightness(par1);
  }
  return super.getStarBrightness(par1) * dimensionInformation.getSkyDescriptor().getStarBrightnessFactor();
}
Program: 166098
Project: 166098
Buggy source:
@Override public void registerWorldChunkManager(){
  int dim=worldObj.provider.dimensionId;
  long seed=calculateSeed(worldObj.getSeed(),dim);
  dimensionInformation=RfToolsDimensionManager.getDimensionManager(worldObj).getDimensionInformation(dim);
  storage=DimensionStorage.getDimensionStorage(worldObj);
  if (dimensionInformation != null && !dimensionInformation.getBiomes().isEmpty()) {
    worldChunkMgr=new SingleBiomeWorldChunkManager(worldObj,seed,terrainType);
  }
 else {
    worldChunkMgr=new WorldChunkManager(seed,worldObj.getWorldInfo().getTerrainType());
  }
  hasNoSky=false;
}

Fixed version (ground truth):
@Override public void registerWorldChunkManager(){
  int dim=worldObj.provider.dimensionId;
  long seed=calculateSeed(worldObj.getSeed(),dim);
  getDimensionInformation();
  storage=DimensionStorage.getDimensionStorage(worldObj);
  if (dimensionInformation != null && !dimensionInformation.getBiomes().isEmpty()) {
    worldChunkMgr=new SingleBiomeWorldChunkManager(worldObj,seed,terrainType);
  }
 else {
    worldChunkMgr=new WorldChunkManager(seed,worldObj.getWorldInfo().getTerrainType());
  }
  hasNoSky=false;
}