nus-yam/ex-repair huggingface dataset:
Program: 1054
Project: 1054
Buggy source:
public boolean isUnderWater(){
  Vector3f cameraPos=new Vector3f(CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition());
  if (config.getRendering().isAnimateWater()) {
    cameraPos.y+=0.5f;
  }
  Block block=CoreRegistry.get(WorldProvider.class).getBlock(new Vector3f(cameraPos));
  return block.isLiquid();
}

Fixed version (ground truth):
public boolean isUnderWater(){
  Vector3f cameraPos=new Vector3f(CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition());
  if (config.getRendering().isAnimateWater()) {
    cameraPos.y+=0.5f;
  }
  if (worldProvider.isBlockRelevant(new Vector3f(cameraPos))) {
    Block block=worldProvider.getBlock(new Vector3f(cameraPos));
    return block.isLiquid();
  }
  return false;
}
Program: 1055
Project: 1055
Buggy source:
protected OpenALException(String message,int errorCode){
  super("String_Node_Str" + errorCode + "String_Node_Str"+ message+ "String_Node_Str"+ AL10.alGetString(errorCode));
}

Fixed version (ground truth):
private OpenALException(String message,int errorCode){
  super("String_Node_Str" + errorCode + "String_Node_Str"+ message+ "String_Node_Str"+ AL10.alGetString(errorCode));
}
Program: 1056
Project: 1056
Buggy source:
public void loadSystems(String packageName,Reflections reflections,NetworkMode netMode){
  Set<Class<?>> systems=reflections.getTypesAnnotatedWith(RegisterSystem.class);
  for (  Class<?> system : systems) {
    if (!ComponentSystem.class.isAssignableFrom(system)) {
      logger.error("String_Node_Str",system.getSimpleName());
      continue;
    }
    RegisterSystem registerInfo=system.getAnnotation(RegisterSystem.class);
    if (registerInfo.value().isValidFor(netMode,false)) {
      String id=packageName + "String_Node_Str" + system.getSimpleName();
      logger.debug("String_Node_Str",id);
      try {
        ComponentSystem newSystem=(ComponentSystem)system.newInstance();
        Share share=system.getAnnotation(Share.class);
        if (share != null && share.value() != null) {
          for (          Class<?> interfaceType : share.value()) {
            sharedSystems.add(interfaceType);
            CoreRegistry.put((Class<Object>)interfaceType,newSystem);
          }
        }
        register(newSystem,id);
        logger.debug("String_Node_Str",id);
      }
 catch (      InstantiationException e) {
        logger.error("String_Node_Str",id,e);
      }
catch (      IllegalAccessException e) {
        logger.error("String_Node_Str",id,e);
      }
    }
  }
}

Fixed version (ground truth):
public void loadSystems(String packageName,Reflections reflections,NetworkMode netMode){
  Set<Class<?>> systems=reflections.getTypesAnnotatedWith(RegisterSystem.class);
  for (  Class<?> system : systems) {
    if (!ComponentSystem.class.isAssignableFrom(system)) {
      logger.error("String_Node_Str",system.getSimpleName());
      continue;
    }
    RegisterSystem registerInfo=system.getAnnotation(RegisterSystem.class);
    if (registerInfo.value().isValidFor(netMode,false)) {
      String id=packageName + "String_Node_Str" + system.getSimpleName();
      logger.debug("String_Node_Str",id);
      try {
        ComponentSystem newSystem=(ComponentSystem)system.newInstance();
        Share share=system.getAnnotation(Share.class);
        if (share != null && share.value() != null) {
          for (          Class<?> interfaceType : share.value()) {
            sharedSystems.add(interfaceType);
            CoreRegistry.put((Class<Object>)interfaceType,newSystem);
          }
        }
        register(newSystem,id);
        logger.debug("String_Node_Str",id);
      }
 catch (      InstantiationException|IllegalAccessException e) {
        logger.error("String_Node_Str",id,e);
      }
    }
  }
}
Program: 1057
Project: 1057
Buggy source:
public EngineEntityManager build(ModuleManager moduleManager,NetworkSystem networkSystem){
  PojoEntityManager entityManager=new PojoEntityManager();
  TypeHandlerLibrary typeHandlerLibrary=buildTypeLibrary(entityManager);
  EntitySystemLibrary library=new EntitySystemLibraryImpl(typeHandlerLibrary);
  CoreRegistry.put(EntitySystemLibrary.class,library);
  CoreRegistry.put(ComponentLibrary.class,library.getComponentLibrary());
  CoreRegistry.put(EventLibrary.class,library.getEventLibrary());
  entityManager.setEntitySystemLibrary(library);
  PrefabManager prefabManager=new PojoPrefabManager(library.getComponentLibrary());
  entityManager.setPrefabManager(prefabManager);
  CoreRegistry.put(PrefabManager.class,prefabManager);
  entityManager.setEventSystem(new EventSystemImpl(library.getEventLibrary(),networkSystem));
  CoreRegistry.put(EntityManager.class,entityManager);
  CoreRegistry.put(EventSystem.class,entityManager.getEventSystem());
  registerComponents(library.getComponentLibrary(),moduleManager);
  registerEvents(entityManager.getEventSystem(),moduleManager);
  return entityManager;
}

Fixed version (ground truth):
public EngineEntityManager build(ModuleManager moduleManager,NetworkSystem networkSystem){
  PojoEntityManager entityManager=new PojoEntityManager();
  TypeHandlerLibrary typeHandlerLibrary=buildTypeLibrary(entityManager);
  EntitySystemLibrary library=new EntitySystemLibraryImpl(typeHandlerLibrary);
  CoreRegistry.put(EntitySystemLibrary.class,library);
  CoreRegistry.put(ComponentLibrary.class,library.getComponentLibrary());
  CoreRegistry.put(EventLibrary.class,library.getEventLibrary());
  entityManager.setEntitySystemLibrary(library);
  PrefabManager prefabManager=new PojoPrefabManager();
  entityManager.setPrefabManager(prefabManager);
  CoreRegistry.put(PrefabManager.class,prefabManager);
  entityManager.setEventSystem(new EventSystemImpl(library.getEventLibrary(),networkSystem));
  CoreRegistry.put(EntityManager.class,entityManager);
  CoreRegistry.put(EventSystem.class,entityManager.getEventSystem());
  registerComponents(library.getComponentLibrary(),moduleManager);
  registerEvents(entityManager.getEventSystem(),moduleManager);
  return entityManager;
}
Program: 1059
Project: 1059
Buggy source:
@ReceiveEvent(components={BlockComponent.class,SignalTimeDelayComponent.class}) public void configureTimeDelay(SetSignalDelayEvent event,EntityRef entity){
  SignalTimeDelayComponent timeDelayComponent=entity.getComponent(SignalTimeDelayComponent.class);
  timeDelayComponent.delaySetting=event.getTime();
  entity.saveComponent(timeDelayComponent);
  if (timeDelayComponent.delaySetting == 1000) {
    entity.removeComponent(SignalTimeDelayModifiedComponent.class);
  }
 else {
    entity.saveComponent(new SignalTimeDelayModifiedComponent());
  }
}

Fixed version (ground truth):
@ReceiveEvent(components={BlockComponent.class,SignalTimeDelayComponent.class}) public void configureTimeDelay(SetSignalDelayEvent event,EntityRef entity){
  SignalTimeDelayComponent timeDelayComponent=entity.getComponent(SignalTimeDelayComponent.class);
  timeDelayComponent.delaySetting=event.getTime();
  entity.saveComponent(timeDelayComponent);
  if (timeDelayComponent.delaySetting == 1000) {
    entity.removeComponent(SignalTimeDelayModifiedComponent.class);
  }
 else {
    entity.addComponent(new SignalTimeDelayModifiedComponent());
  }
}
Program: 1060
Project: 1060
Buggy source:
private void delayGateSignalChangeIfNeeded(EntityRef entity){
  if (!entity.hasComponent(SignalDelayedActionComponent.class)) {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    long whenToLookAt;
    final ImmutableBlockLocation location=new ImmutableBlockLocation(entity.getComponent(BlockComponent.class).getPosition());
    if (gateLastSignalChangeTime.containsKey(location)) {
      whenToLookAt=gateLastSignalChangeTime.get(location) + GATE_MINIMUM_SIGNAL_CHANGE_INTERVAL;
    }
 else {
      whenToLookAt=worldProvider.getTime();
    }
    delayedAction.executeTime=whenToLookAt;
    entity.saveComponent(delayedAction);
  }
}

Fixed version (ground truth):
private void delayGateSignalChangeIfNeeded(EntityRef entity){
  if (!entity.hasComponent(SignalDelayedActionComponent.class)) {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    long whenToLookAt;
    final ImmutableBlockLocation location=new ImmutableBlockLocation(entity.getComponent(BlockComponent.class).getPosition());
    if (gateLastSignalChangeTime.containsKey(location)) {
      whenToLookAt=gateLastSignalChangeTime.get(location) + GATE_MINIMUM_SIGNAL_CHANGE_INTERVAL;
    }
 else {
      whenToLookAt=worldProvider.getTime();
    }
    delayedAction.executeTime=whenToLookAt;
    entity.addComponent(delayedAction);
  }
}
Program: 1061
Project: 1061
Buggy source:
private boolean startProducingSignal(EntityRef entity,int signalStrength){
  final SignalProducerComponent producer=entity.getComponent(SignalProducerComponent.class);
  if (producer.signalStrength != signalStrength) {
    producer.signalStrength=signalStrength;
    entity.saveComponent(producer);
    entity.saveComponent(new SignalProducerModifiedComponent());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean startProducingSignal(EntityRef entity,int signalStrength){
  final SignalProducerComponent producer=entity.getComponent(SignalProducerComponent.class);
  if (producer.signalStrength != signalStrength) {
    producer.signalStrength=signalStrength;
    entity.saveComponent(producer);
    entity.addComponent(new SignalProducerModifiedComponent());
    return true;
  }
  return false;
}
Program: 1062
Project: 1062
Buggy source:
private void signalChangedForDelayOffGate(EntityRef entity,SignalConsumerStatusComponent consumerStatusComponent){
  SignalTimeDelayComponent delay=entity.getComponent(SignalTimeDelayComponent.class);
  if (consumerStatusComponent.hasSignal) {
    entity.removeComponent(SignalDelayedActionComponent.class);
    startProducingSignal(entity,-1);
  }
 else {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    delayedAction.executeTime=worldProvider.getTime() + delay.delaySetting;
    entity.saveComponent(delayedAction);
  }
}

Fixed version (ground truth):
private void signalChangedForDelayOffGate(EntityRef entity,SignalConsumerStatusComponent consumerStatusComponent){
  SignalTimeDelayComponent delay=entity.getComponent(SignalTimeDelayComponent.class);
  if (consumerStatusComponent.hasSignal) {
    entity.removeComponent(SignalDelayedActionComponent.class);
    startProducingSignal(entity,-1);
  }
 else {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    delayedAction.executeTime=worldProvider.getTime() + delay.delaySetting;
    entity.addComponent(delayedAction);
  }
}
Program: 1063
Project: 1063
Buggy source:
private void signalChangedForDelayOnGate(EntityRef entity,SignalConsumerStatusComponent consumerStatusComponent){
  SignalTimeDelayComponent delay=entity.getComponent(SignalTimeDelayComponent.class);
  if (consumerStatusComponent.hasSignal) {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    delayedAction.executeTime=worldProvider.getTime() + delay.delaySetting;
    entity.saveComponent(delayedAction);
  }
 else {
    entity.removeComponent(SignalDelayedActionComponent.class);
    stopProducingSignal(entity);
  }
}

Fixed version (ground truth):
private void signalChangedForDelayOnGate(EntityRef entity,SignalConsumerStatusComponent consumerStatusComponent){
  SignalTimeDelayComponent delay=entity.getComponent(SignalTimeDelayComponent.class);
  if (consumerStatusComponent.hasSignal) {
    SignalDelayedActionComponent delayedAction=new SignalDelayedActionComponent();
    delayedAction.executeTime=worldProvider.getTime() + delay.delaySetting;
    entity.addComponent(delayedAction);
  }
 else {
    entity.removeComponent(SignalDelayedActionComponent.class);
    stopProducingSignal(entity);
  }
}
Program: 1064
Project: 1064
Buggy source:
@Override public void update(float delta){
  PerformanceMonitor.startActivity("String_Node_Str");
  processOffThreadChanges();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  for (  EntityRef entity : temporaryBlockEntities) {
    cleanUpTemporaryEntity(entity);
  }
  temporaryBlockEntities.clear();
  PerformanceMonitor.endActivity();
}

Fixed version (ground truth):
@Override public void update(float delta){
  PerformanceMonitor.startActivity("String_Node_Str");
  processOffThreadChanges();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  List<EntityRef> toRemove=Lists.newArrayList(temporaryBlockEntities);
  temporaryBlockEntities.clear();
  for (  EntityRef entity : toRemove) {
    cleanUpTemporaryEntity(entity);
  }
  PerformanceMonitor.endActivity();
}
Program: 1065
Project: 1065
Buggy source:
Diamond3iIterator(Vector3i origin,int maxDistance,int startDistance){
  this(origin,maxDistance);
  this.level=startDistance;
  x=-level;
}

Fixed version (ground truth):
Diamond3iIterator(Vector3i origin,int maxDistance,int startDistance){
  this(origin,maxDistance);
  this.level=startDistance + 1;
  x=-level;
}
Program: 1066
Project: 1066
Buggy source:
private Region3i clearLight(int x,int y,int z,int oldLightLevel,Block type){
  int checkExtent=(oldLightLevel > 0) ? oldLightLevel - 1 : 0;
  List<Vector3i> lightSources=Lists.newArrayList();
  Region3i region=Region3i.createFromCenterExtents(new Vector3i(x,y,z),checkExtent);
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lum=chunkView.getBlock(pos).getLuminance();
    chunkView.setLight(pos,lum);
    if (lum > 1) {
      lightSources.add(pos);
    }
  }
  for (  Vector3i pos : lightSources) {
    byte lightLevel=chunkView.getLight(pos);
    if (lightLevel > 1) {
      region=Region3i.createEncompassing(region,pushLight(pos.x,pos.y,pos.z,lightLevel));
    }
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lightLevel=chunkView.getLight(pos);
    lightLevel=pullLight(pos.x,pos.y,pos.z,lightLevel,type);
    if (lightLevel > 1) {
      pushLight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
  return region;
}

Fixed version (ground truth):
private Region3i clearLight(int x,int y,int z,int oldLightLevel,Block type){
  int checkExtent=(oldLightLevel > 0) ? oldLightLevel - 1 : 0;
  List<Vector3i> lightSources=Lists.newArrayList();
  Region3i region=Region3i.createFromCenterExtents(new Vector3i(x,y,z),checkExtent);
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),checkExtent)) {
    byte lum=chunkView.getBlock(pos).getLuminance();
    chunkView.setLight(pos,lum);
    if (lum > 1) {
      lightSources.add(pos);
    }
  }
  for (  Vector3i pos : lightSources) {
    byte lightLevel=chunkView.getLight(pos);
    if (lightLevel > 1) {
      region=Region3i.createEncompassing(region,pushLight(pos.x,pos.y,pos.z,lightLevel));
    }
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lightLevel=chunkView.getLight(pos);
    lightLevel=pullLight(pos.x,pos.y,pos.z,lightLevel,type);
    if (lightLevel > 1) {
      pushLight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
  return region;
}
Program: 1067
Project: 1067
Buggy source:
private void localRecalculateSunlightAround(int x,int y,int z,int oldLightLevel){
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),oldLightLevel)) {
    chunkView.setSunlight(pos,(byte)0);
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),oldLightLevel + 1)) {
    byte lightLevel=chunkView.getSunlight(pos);
    if (lightLevel > 1) {
      pushSunlight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
}

Fixed version (ground truth):
private void localRecalculateSunlightAround(int x,int y,int z,int oldLightLevel){
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),oldLightLevel - 1)) {
    chunkView.setSunlight(pos,(byte)0);
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),oldLightLevel)) {
    byte lightLevel=chunkView.getSunlight(pos);
    if (lightLevel > 1) {
      pushSunlight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
}
Program: 1068
Project: 1068
Buggy source:
@Test public void twoDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),2);
  Set<Vector3i> expected=Sets.newHashSet(Vector3i.zero(),new Vector3i(1,0,0),new Vector3i(-1,0,0),new Vector3i(0,1,0),new Vector3i(0,-1,0),new Vector3i(0,0,1),new Vector3i(0,0,-1));
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertTrue("String_Node_Str" + next,expected.remove(next));
  }
  assertTrue("String_Node_Str" + expected,expected.isEmpty());
}

Fixed version (ground truth):
@Test public void twoDistanceIteration(){
  Set<Vector3i> iter=Sets.newHashSet(Diamond3iIterator.iterate(Vector3i.zero(),2));
  assertEquals(25,iter.size());
  for (  Vector3i pos : iter) {
    assertTrue(pos.gridDistance(new Vector3i()) <= 2);
  }
}
Program: 1069
Project: 1069
Buggy source:
@Test public void threeDistanceOnlyIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),4,3);
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertEquals(3,Vector3i.zero().gridDistance(next));
  }
}

Fixed version (ground truth):
@Test public void threeDistanceOnlyIteration(){
  Set<Vector3i> iter=Sets.newHashSet(Diamond3iIterator.iterate(Vector3i.zero(),3));
  assertEquals(63,iter.size());
  for (  Vector3i pos : iter) {
    assertTrue(pos.gridDistance(new Vector3i()) <= 3);
  }
}
Program: 1070
Project: 1070
Buggy source:
@Test public void oneDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),1);
  assertEquals(Lists.newArrayList(Vector3i.zero()),Lists.newArrayList(iter));
}

Fixed version (ground truth):
@Test public void oneDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),1);
  Set<Vector3i> expected=Sets.newHashSet(Vector3i.zero(),new Vector3i(1,0,0),new Vector3i(-1,0,0),new Vector3i(0,1,0),new Vector3i(0,-1,0),new Vector3i(0,0,1),new Vector3i(0,0,-1));
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertTrue("String_Node_Str" + next,expected.remove(next));
  }
  assertTrue("String_Node_Str" + expected,expected.isEmpty());
}
Program: 1071
Project: 1071
Buggy source:
@Test public void zeroDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),0);
  assertFalse(iter.hasNext());
}

Fixed version (ground truth):
@Test public void zeroDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),0);
  assertEquals(Lists.newArrayList(Vector3i.zero()),Lists.newArrayList(iter));
}
Program: 1072
Project: 1072
Buggy source:
@Override public void update(float delta){
  PerformanceMonitor.startActivity("String_Node_Str");
  processOffThreadChanges();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  for (  EntityRef entity : temporaryBlockEntities) {
    cleanUpTemporaryEntity(entity);
  }
  temporaryBlockEntities.clear();
  PerformanceMonitor.endActivity();
}

Fixed version (ground truth):
@Override public void update(float delta){
  PerformanceMonitor.startActivity("String_Node_Str");
  processOffThreadChanges();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  List<EntityRef> toRemove=Lists.newArrayList(temporaryBlockEntities);
  temporaryBlockEntities.clear();
  for (  EntityRef entity : toRemove) {
    cleanUpTemporaryEntity(entity);
  }
  PerformanceMonitor.endActivity();
}
Program: 1073
Project: 1073
Buggy source:
Diamond3iIterator(Vector3i origin,int maxDistance,int startDistance){
  this(origin,maxDistance);
  this.level=startDistance;
  x=-level;
}

Fixed version (ground truth):
Diamond3iIterator(Vector3i origin,int maxDistance,int startDistance){
  this(origin,maxDistance);
  this.level=startDistance + 1;
  x=-level;
}
Program: 1074
Project: 1074
Buggy source:
private Region3i clearLight(int x,int y,int z,int oldLightLevel,Block type){
  int checkExtent=(oldLightLevel > 0) ? oldLightLevel - 1 : 0;
  List<Vector3i> lightSources=Lists.newArrayList();
  Region3i region=Region3i.createFromCenterExtents(new Vector3i(x,y,z),checkExtent);
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lum=chunkView.getBlock(pos).getLuminance();
    chunkView.setLight(pos,lum);
    if (lum > 1) {
      lightSources.add(pos);
    }
  }
  for (  Vector3i pos : lightSources) {
    byte lightLevel=chunkView.getLight(pos);
    if (lightLevel > 1) {
      region=Region3i.createEncompassing(region,pushLight(pos.x,pos.y,pos.z,lightLevel));
    }
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lightLevel=chunkView.getLight(pos);
    lightLevel=pullLight(pos.x,pos.y,pos.z,lightLevel,type);
    if (lightLevel > 1) {
      pushLight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
  return region;
}

Fixed version (ground truth):
private Region3i clearLight(int x,int y,int z,int oldLightLevel,Block type){
  int checkExtent=(oldLightLevel > 0) ? oldLightLevel - 1 : 0;
  List<Vector3i> lightSources=Lists.newArrayList();
  Region3i region=Region3i.createFromCenterExtents(new Vector3i(x,y,z),checkExtent);
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),checkExtent)) {
    byte lum=chunkView.getBlock(pos).getLuminance();
    chunkView.setLight(pos,lum);
    if (lum > 1) {
      lightSources.add(pos);
    }
  }
  for (  Vector3i pos : lightSources) {
    byte lightLevel=chunkView.getLight(pos);
    if (lightLevel > 1) {
      region=Region3i.createEncompassing(region,pushLight(pos.x,pos.y,pos.z,lightLevel));
    }
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),checkExtent + 1)) {
    byte lightLevel=chunkView.getLight(pos);
    lightLevel=pullLight(pos.x,pos.y,pos.z,lightLevel,type);
    if (lightLevel > 1) {
      pushLight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
  return region;
}
Program: 1075
Project: 1075
Buggy source:
private void localRecalculateSunlightAround(int x,int y,int z,int oldLightLevel){
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),oldLightLevel)) {
    chunkView.setSunlight(pos,(byte)0);
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),oldLightLevel + 1)) {
    byte lightLevel=chunkView.getSunlight(pos);
    if (lightLevel > 1) {
      pushSunlight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
}

Fixed version (ground truth):
private void localRecalculateSunlightAround(int x,int y,int z,int oldLightLevel){
  for (  Vector3i pos : Diamond3iIterator.iterate(new Vector3i(x,y,z),oldLightLevel - 1)) {
    chunkView.setSunlight(pos,(byte)0);
  }
  for (  Vector3i pos : Diamond3iIterator.iterateAtDistance(new Vector3i(x,y,z),oldLightLevel)) {
    byte lightLevel=chunkView.getSunlight(pos);
    if (lightLevel > 1) {
      pushSunlight(pos.x,pos.y,pos.z,lightLevel);
    }
  }
}
Program: 1076
Project: 1076
Buggy source:
@Test public void twoDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),2);
  Set<Vector3i> expected=Sets.newHashSet(Vector3i.zero(),new Vector3i(1,0,0),new Vector3i(-1,0,0),new Vector3i(0,1,0),new Vector3i(0,-1,0),new Vector3i(0,0,1),new Vector3i(0,0,-1));
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertTrue("String_Node_Str" + next,expected.remove(next));
  }
  assertTrue("String_Node_Str" + expected,expected.isEmpty());
}

Fixed version (ground truth):
@Test public void twoDistanceIteration(){
  Set<Vector3i> iter=Sets.newHashSet(Diamond3iIterator.iterate(Vector3i.zero(),2));
  assertEquals(25,iter.size());
  for (  Vector3i pos : iter) {
    assertTrue(pos.gridDistance(new Vector3i()) <= 2);
  }
}
Program: 1077
Project: 1077
Buggy source:
@Test public void threeDistanceOnlyIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),4,3);
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertEquals(3,Vector3i.zero().gridDistance(next));
  }
}

Fixed version (ground truth):
@Test public void threeDistanceOnlyIteration(){
  Set<Vector3i> iter=Sets.newHashSet(Diamond3iIterator.iterate(Vector3i.zero(),3));
  assertEquals(63,iter.size());
  for (  Vector3i pos : iter) {
    assertTrue(pos.gridDistance(new Vector3i()) <= 3);
  }
}
Program: 1078
Project: 1078
Buggy source:
@Test public void oneDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),1);
  assertEquals(Lists.newArrayList(Vector3i.zero()),Lists.newArrayList(iter));
}

Fixed version (ground truth):
@Test public void oneDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),1);
  Set<Vector3i> expected=Sets.newHashSet(Vector3i.zero(),new Vector3i(1,0,0),new Vector3i(-1,0,0),new Vector3i(0,1,0),new Vector3i(0,-1,0),new Vector3i(0,0,1),new Vector3i(0,0,-1));
  while (iter.hasNext()) {
    Vector3i next=iter.next();
    assertTrue("String_Node_Str" + next,expected.remove(next));
  }
  assertTrue("String_Node_Str" + expected,expected.isEmpty());
}
Program: 1079
Project: 1079
Buggy source:
@Test public void zeroDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),0);
  assertFalse(iter.hasNext());
}

Fixed version (ground truth):
@Test public void zeroDistanceIteration(){
  Iterator<Vector3i> iter=new Diamond3iIterator(Vector3i.zero(),0);
  assertEquals(Lists.newArrayList(Vector3i.zero()),Lists.newArrayList(iter));
}
Program: 1080
Project: 1080
Buggy source:
private void initHost(){
  loadProcesses.add(new RegisterMods(worldInfo));
  loadProcesses.add(new CacheTextures());
  loadProcesses.add(new RegisterBlocks(worldInfo));
  loadProcesses.add(new CacheBlocks());
  loadProcesses.add(new InitialiseEntitySystem());
  loadProcesses.add(new LoadPrefabs());
  loadProcesses.add(new RegisterInputSystem());
  loadProcesses.add(new RegisterSystems(netMode));
  loadProcesses.add(new InitialiseCommandSystem());
  loadProcesses.add(new InitialiseWorld(worldInfo));
  loadProcesses.add(new InitialiseSystems());
  loadProcesses.add(new LoadEntities(worldInfo));
  loadProcesses.add(new InitialiseBlockTypeEntities());
  loadProcesses.add(new CreateWorldEntity());
  if (netMode == NetworkMode.SERVER) {
    loadProcesses.add(new StartServer());
  }
  loadProcesses.add(new SetupLocalPlayer());
  loadProcesses.add(new AwaitCharacterSpawn());
  loadProcesses.add(new PrepareWorld());
}

Fixed version (ground truth):
private void initHost(){
  loadProcesses.add(new RegisterMods(worldInfo));
  loadProcesses.add(new CacheTextures());
  loadProcesses.add(new RegisterBlocks(worldInfo));
  loadProcesses.add(new CacheBlocks());
  loadProcesses.add(new InitialiseEntitySystem());
  loadProcesses.add(new LoadPrefabs());
  loadProcesses.add(new ProcessBlockPrefabs());
  loadProcesses.add(new RegisterInputSystem());
  loadProcesses.add(new RegisterSystems(netMode));
  loadProcesses.add(new InitialiseCommandSystem());
  loadProcesses.add(new InitialiseWorld(worldInfo));
  loadProcesses.add(new InitialiseSystems());
  loadProcesses.add(new LoadEntities(worldInfo));
  loadProcesses.add(new InitialiseBlockTypeEntities());
  loadProcesses.add(new CreateWorldEntity());
  if (netMode == NetworkMode.SERVER) {
    loadProcesses.add(new StartServer());
  }
  loadProcesses.add(new SetupLocalPlayer());
  loadProcesses.add(new AwaitCharacterSpawn());
  loadProcesses.add(new PrepareWorld());
}
Program: 1081
Project: 1081
Buggy source:
private void initClient(){
  loadProcesses.add(new JoinServer(worldInfo));
  loadProcesses.add(new RegisterMods(worldInfo));
  loadProcesses.add(new CacheTextures());
  loadProcesses.add(new RegisterBlocks(worldInfo));
  loadProcesses.add(new CacheBlocks());
  loadProcesses.add(new InitialiseEntitySystem());
  loadProcesses.add(new LoadPrefabs());
  loadProcesses.add(new RegisterInputSystem());
  loadProcesses.add(new RegisterSystems(netMode));
  loadProcesses.add(new InitialiseCommandSystem());
  loadProcesses.add(new InitialiseRemoteWorld(worldInfo));
  loadProcesses.add(new InitialiseSystems());
  loadProcesses.add(new SetupRemotePlayer());
  loadProcesses.add(new AwaitCharacterSpawn());
  loadProcesses.add(new PrepareWorld());
}

Fixed version (ground truth):
private void initClient(){
  loadProcesses.add(new JoinServer(worldInfo));
  loadProcesses.add(new RegisterMods(worldInfo));
  loadProcesses.add(new CacheTextures());
  loadProcesses.add(new RegisterBlocks(worldInfo));
  loadProcesses.add(new CacheBlocks());
  loadProcesses.add(new InitialiseEntitySystem());
  loadProcesses.add(new LoadPrefabs());
  loadProcesses.add(new ProcessBlockPrefabs());
  loadProcesses.add(new RegisterInputSystem());
  loadProcesses.add(new RegisterSystems(netMode));
  loadProcesses.add(new InitialiseCommandSystem());
  loadProcesses.add(new InitialiseRemoteWorld(worldInfo));
  loadProcesses.add(new InitialiseSystems());
  loadProcesses.add(new SetupRemotePlayer());
  loadProcesses.add(new AwaitCharacterSpawn());
  loadProcesses.add(new PrepareWorld());
}
Program: 1082
Project: 1082
Buggy source:
@Override public boolean step(){
  RemoteChunkProvider chunkProvider=new RemoteChunkProvider();
  WorldRenderer worldRenderer=new WorldRenderer(worldInfo,chunkProvider,CoreRegistry.get(LocalPlayerSystem.class));
  CoreRegistry.put(WorldRenderer.class,worldRenderer);
  CoreRegistry.put(WorldProvider.class,worldRenderer.getWorldProvider());
  CoreRegistry.put(LocalPlayer.class,new LocalPlayer());
  CoreRegistry.put(Camera.class,worldRenderer.getActiveCamera());
  CoreRegistry.put(BulletPhysics.class,worldRenderer.getBulletRenderer());
  CoreRegistry.get(WorldProvider.class).setTime(worldInfo.getTime());
  CoreRegistry.get(NetworkSystem.class).setRemoteWorldProvider(chunkProvider);
  return true;
}

Fixed version (ground truth):
@Override public boolean step(){
  RemoteChunkProvider chunkProvider=new RemoteChunkProvider();
  BlockManager blockManager=CoreRegistry.get(BlockManager.class);
  EntityAwareWorldProvider entityWorldProvider=new EntityAwareWorldProvider(new WorldProviderCoreImpl(worldInfo,chunkProvider,blockManager));
  WorldProvider worldProvider=new WorldProviderWrapper(entityWorldProvider);
  CoreRegistry.put(WorldProvider.class,worldProvider);
  CoreRegistry.put(BlockEntityRegistry.class,entityWorldProvider);
  CoreRegistry.get(ComponentSystemManager.class).register(entityWorldProvider,"String_Node_Str");
  WorldRenderer worldRenderer=new WorldRenderer(worldProvider,chunkProvider,CoreRegistry.get(LocalPlayerSystem.class));
  CoreRegistry.put(WorldRenderer.class,worldRenderer);
  CoreRegistry.put(LocalPlayer.class,new LocalPlayer());
  CoreRegistry.put(Camera.class,worldRenderer.getActiveCamera());
  CoreRegistry.put(BulletPhysics.class,worldRenderer.getBulletRenderer());
  CoreRegistry.get(WorldProvider.class).setTime(worldInfo.getTime());
  CoreRegistry.get(NetworkSystem.class).setRemoteWorldProvider(chunkProvider);
  return true;
}
Program: 1084
Project: 1084
Buggy source:
public boolean isForceBlockActive(){
  return forceBlockActive;
}

Fixed version (ground truth):
/** 
 * @return Whether this component forces a block active
 */
public boolean isForceBlockActive(){
  return forceBlockActive;
}
Program: 1085
Project: 1085
Buggy source:
public boolean isReplicatedFromOwner(){
  return replicatedFromOwner;
}

Fixed version (ground truth):
/** 
 * @return Whether this component replicates any fields from owner to server
 */
public boolean isReplicatedFromOwner(){
  return replicatedFromOwner;
}
Program: 1086
Project: 1086
Buggy source:
public boolean isReplicated(){
  return replicated;
}

Fixed version (ground truth):
/** 
 * @return Whether this component needs to be replicated
 */
public boolean isReplicated(){
  return replicated;
}
Program: 1087
Project: 1087
Buggy source:
public T clone(Component component){
  if (getType().isInstance(component)) {
    return super.clone(getType().cast(component));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param component
 * @return A clone of the given instance of this component, or null if the component does not belong to this metadata
 */
public T clone(Component component){
  if (getType().isInstance(component)) {
    return super.clone(getType().cast(component));
  }
  return null;
}
Program: 1088
Project: 1088
Buggy source:
public boolean isRetainUnalteredOnBlockChange(){
  return retainUnalteredOnBlockChange;
}

Fixed version (ground truth):
/** 
 * @return Whether this component should be retained unaltered on block change
 */
public boolean isRetainUnalteredOnBlockChange(){
  return retainUnalteredOnBlockChange;
}
Program: 1089
Project: 1089
Buggy source:
public ComponentMetadata(Class<T> simpleClass,String... names) throws NoSuchMethodException {
  super(simpleClass,names);
  replicated=simpleClass.getAnnotation(Replicate.class) != null;
  ForceBlockActive forceBlockActiveAnnotation=simpleClass.getAnnotation(ForceBlockActive.class);
  if (forceBlockActiveAnnotation != null) {
    forceBlockActive=true;
    retainUnalteredOnBlockChange=forceBlockActiveAnnotation.retainUnalteredOnBlockChange();
  }
}

Fixed version (ground truth):
public ComponentMetadata(Class<T> simpleClass,String... names) throws NoSuchMethodException {
  super(simpleClass,names);
  replicated=simpleClass.getAnnotation(Replicate.class) != null;
  blockLifecycleEventsRequired=simpleClass.getAnnotation(RequiresBlockLifecycleEvents.class) != null;
  ForceBlockActive forceBlockActiveAnnotation=simpleClass.getAnnotation(ForceBlockActive.class);
  if (forceBlockActiveAnnotation != null) {
    forceBlockActive=true;
    retainUnalteredOnBlockChange=forceBlockActiveAnnotation.retainUnalteredOnBlockChange();
  }
}
Program: 1090
Project: 1090
Buggy source:
public boolean isReferenceOwner(){
  return referenceOwner;
}

Fixed version (ground truth):
/** 
 * @return Whether this component owns any references
 */
public boolean isReferenceOwner(){
  return referenceOwner;
}
Program: 1091
Project: 1091
Buggy source:
/** 
 * Initializes a new (local) world for the single player mode.
 * @param worldInfo Information describing the world
 */
public WorldRenderer(WorldInfo worldInfo,ChunkProvider chunkProvider,LocalPlayerSystem localPlayerSystem){
  this.chunkProvider=chunkProvider;
  BlockManager blockManager=CoreRegistry.get(BlockManager.class);
  EntityAwareWorldProvider entityWorldProvider=new EntityAwareWorldProvider(new WorldProviderCoreImpl(worldInfo,this.chunkProvider,blockManager));
  CoreRegistry.put(BlockEntityRegistry.class,entityWorldProvider);
  CoreRegistry.get(ComponentSystemManager.class).register(entityWorldProvider,"String_Node_Str");
  worldProvider=new WorldProviderWrapper(entityWorldProvider);
  bulletPhysics=new BulletPhysics(worldProvider);
  chunkTesselator=new ChunkTessellator(worldProvider.getBiomeProvider());
  skysphere=new Skysphere(this);
  chunkUpdateManager=new ChunkUpdateManager(chunkTesselator,worldProvider);
  worldTimeEventManager=new WorldTimeEventManager(worldProvider);
  blockGrid=new BlockGrid();
  localPlayerSystem.setPlayerCamera(defaultCamera);
  systemManager=CoreRegistry.get(ComponentSystemManager.class);
  audioManager=CoreRegistry.get(AudioManager.class);
  initTimeEvents();
}

Fixed version (ground truth):
/** 
 * Initializes a new (local) world for the single player mode.
 */
public WorldRenderer(WorldProvider worldProvider,ChunkProvider chunkProvider,LocalPlayerSystem localPlayerSystem){
  this.chunkProvider=chunkProvider;
  this.worldProvider=worldProvider;
  bulletPhysics=new BulletPhysics(worldProvider);
  chunkTesselator=new ChunkTessellator(worldProvider.getBiomeProvider());
  skysphere=new Skysphere(this);
  chunkUpdateManager=new ChunkUpdateManager(chunkTesselator,worldProvider);
  worldTimeEventManager=new WorldTimeEventManager(worldProvider);
  blockGrid=new BlockGrid();
  localPlayerSystem.setPlayerCamera(defaultCamera);
  systemManager=CoreRegistry.get(ComponentSystemManager.class);
  audioManager=CoreRegistry.get(AudioManager.class);
  initTimeEvents();
}
Program: 1092
Project: 1092
Buggy source:
@Override public boolean setBlock(int x,int y,int z,Block type,Block oldType){
  if (Thread.currentThread().equals(mainThread)) {
    Vector3i pos=new Vector3i(x,y,z);
    EntityRef blockEntity=getBlockEntityAt(pos);
    if (super.setBlock(x,y,z,type,oldType)) {
      EntityRef regionEntity=blockRegionLookup.get(pos);
      if (regionEntity != null) {
        regionEntity.send(new OnChangedBlock(pos,type,oldType));
      }
      updateBlockEntity(blockEntity,oldType,type);
      blockEntity.send(new OnChangedBlock(new Vector3i(x,y,z),type,oldType));
      return true;
    }
  }
 else {
    if (super.setBlock(x,y,z,type,oldType)) {
      eventQueue.add(new OnChangedBlock(new Vector3i(x,y,z),type,oldType));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean setBlock(int x,int y,int z,Block type,Block oldType){
  if (Thread.currentThread().equals(mainThread)) {
    Vector3i pos=new Vector3i(x,y,z);
    EntityRef blockEntity=getBlockEntityAt(pos);
    if (super.setBlock(x,y,z,type,oldType)) {
      if (type.isKeepActive()) {
        temporaryBlockEntities.remove(blockEntity);
      }
 else       if (oldType.isKeepActive() && isTemporaryBlock(blockEntity,type)) {
        temporaryBlockEntities.add(blockEntity);
      }
      EntityRef regionEntity=blockRegionLookup.get(pos);
      if (regionEntity != null) {
        regionEntity.send(new OnChangedBlock(pos,type,oldType));
      }
      updateBlockEntity(blockEntity,oldType,type);
      blockEntity.send(new OnChangedBlock(new Vector3i(x,y,z),type,oldType));
      return true;
    }
  }
 else {
    if (super.setBlock(x,y,z,type,oldType)) {
      eventQueue.add(new OnChangedBlock(new Vector3i(x,y,z),type,oldType));
      return true;
    }
  }
  return false;
}
Program: 1093
Project: 1093
Buggy source:
public void setKeepActive(boolean keepActive){
  this.keepActive=true;
}

Fixed version (ground truth):
public void setKeepActive(boolean keepActive){
  this.keepActive=keepActive;
}
Program: 1094
Project: 1094
Buggy source:
@Override public boolean step(){
  NetworkSystem networkSystem=CoreRegistry.get(NetworkSystem.class);
  BlockManager blockManager;
  if (networkSystem.getMode().isAuthority()) {
    blockManager=new BlockManagerAuthority(worldInfo.getBlockIdMap());
    blockManager.subscribe(CoreRegistry.get(NetworkSystem.class));
  }
 else {
    blockManager=new BlockManagerClient(worldInfo.getBlockIdMap());
  }
  blockManager.buildAtlas();
  CoreRegistry.put(BlockManager.class,blockManager);
  return true;
}

Fixed version (ground truth):
@Override public boolean step(){
  NetworkSystem networkSystem=CoreRegistry.get(NetworkSystem.class);
  BlockManager blockManager;
  if (networkSystem.getMode().isAuthority()) {
    blockManager=new BlockManagerAuthority(worldInfo.getBlockIdMap());
    blockManager.subscribe(CoreRegistry.get(NetworkSystem.class));
  }
 else {
    blockManager=new BlockManagerClient(networkSystem.getServer().getInfo().getRegisterBlockFamilyList(),worldInfo.getBlockIdMap());
  }
  blockManager.buildAtlas();
  CoreRegistry.put(BlockManager.class,blockManager);
  return true;
}
Program: 1095
Project: 1095
Buggy source:
public void registerNetworkEntity(EntityRef entity){
  if (mode == NetworkMode.NONE) {
    return;
  }
  NetworkComponent netComponent=entity.getComponent(NetworkComponent.class);
  if (mode == NetworkMode.SERVER) {
    netComponent.setNetworkId(nextNetId++);
    entity.saveComponent(netComponent);
  }
  logger.debug("String_Node_Str",entity);
  netIdToEntityId.put(netComponent.getNetworkId(),entity.getId());
  if (mode == NetworkMode.SERVER) {
switch (netComponent.replicateMode) {
case OWNER:
      NetClient clientPlayer=getNetOwner(entity);
    if (clientPlayer != null) {
      clientPlayer.setNetInitial(netComponent.getNetworkId());
    }
  break;
default :
for (NetClient client : netClientList) {
  client.setNetInitial(netComponent.getNetworkId());
}
break;
}
if (netComponent.owner.exists()) {
ownerLookup.put(entity,netComponent.owner);
ownedLookup.put(netComponent.owner,entity);
}
}
}

Fixed version (ground truth):
public void registerNetworkEntity(EntityRef entity){
  if (mode == NetworkMode.NONE) {
    return;
  }
  NetworkComponent netComponent=entity.getComponent(NetworkComponent.class);
  if (mode == NetworkMode.SERVER) {
    netComponent.setNetworkId(nextNetId++);
    entity.saveComponent(netComponent);
  }
  logger.debug("String_Node_Str",entity);
  if (NULL_NET_ID != netIdToEntityId.put(netComponent.getNetworkId(),entity.getId())) {
    logger.error("String_Node_Str");
  }
  if (mode == NetworkMode.SERVER) {
switch (netComponent.replicateMode) {
case OWNER:
      NetClient clientPlayer=getNetOwner(entity);
    if (clientPlayer != null) {
      clientPlayer.setNetInitial(netComponent.getNetworkId());
    }
  break;
default :
for (NetClient client : netClientList) {
  client.setNetInitial(netComponent.getNetworkId());
}
break;
}
if (netComponent.owner.exists()) {
ownerLookup.put(entity,netComponent.owner);
ownedLookup.put(netComponent.owner,entity);
}
}
}
Program: 1096
Project: 1096
Buggy source:
private void processNewClient(NetClient client){
  logger.info("String_Node_Str",client.getName());
  client.connected(entityManager,entitySerializer,eventSerializer,entitySystemLibrary);
  clientList.add(client);
  netClientList.add(client);
  clientPlayerLookup.put(client.getEntity(),client);
  sendServerInfo(client);
  connectClient(client);
  logger.info("String_Node_Str",client.getEntity());
  for (  EntityRef netEntity : entityManager.listEntitiesWith(NetworkComponent.class)) {
    NetworkComponent netComp=netEntity.getComponent(NetworkComponent.class);
switch (netComp.replicateMode) {
case OWNER:
      if (client.equals(getOwner(netEntity))) {
        client.setNetInitial(netComp.getNetworkId());
      }
    break;
default :
  client.setNetInitial(netComp.getNetworkId());
break;
}
}
}

Fixed version (ground truth):
private void processNewClient(NetClient client){
  logger.info("String_Node_Str",client.getName());
  client.connected(entityManager,entitySerializer,eventSerializer,entitySystemLibrary);
  clientList.add(client);
  netClientList.add(client);
  clientPlayerLookup.put(client.getEntity(),client);
  sendServerInfo(client);
  connectClient(client);
  logger.info("String_Node_Str",client.getEntity());
  for (  EntityRef netEntity : entityManager.listEntitiesWith(NetworkComponent.class)) {
    NetworkComponent netComp=netEntity.getComponent(NetworkComponent.class);
    if (netComp.getNetworkId() != NULL_NET_ID) {
switch (netComp.replicateMode) {
case OWNER:
        if (client.equals(getOwner(netEntity))) {
          client.setNetInitial(netComp.getNetworkId());
        }
      break;
default :
    client.setNetInitial(netComp.getNetworkId());
  break;
}
}
}
}
Program: 1097
Project: 1097
Buggy source:
private void sendServerInfo(NetClient client){
  NetData.ServerInfoMessage.Builder serverInfoMessageBuilder=NetData.ServerInfoMessage.newBuilder();
  WorldProvider world=CoreRegistry.get(WorldProvider.class);
  if (world != null) {
    serverInfoMessageBuilder.setTime(world.getTime());
    serverInfoMessageBuilder.setWorldName(world.getTitle());
  }
  for (  Mod mod : CoreRegistry.get(ModManager.class).getActiveMods()) {
    if (!mod.getModInfo().isServersideOnly()) {
      serverInfoMessageBuilder.addModule(NetData.ModuleInfo.newBuilder().setModuleId(mod.getModInfo().getId()).build());
    }
  }
  for (  Map.Entry<String,Byte> blockMapping : blockManager.getBlockIdMap().entrySet()) {
    serverInfoMessageBuilder.addBlockId(blockMapping.getValue());
    serverInfoMessageBuilder.addBlockName(blockMapping.getKey());
  }
  serializeComponentInfo(serverInfoMessageBuilder);
  serializeEventInfo(serverInfoMessageBuilder);
  serverInfoMessageBuilder.setClientId(client.getEntity().getComponent(NetworkComponent.class).getNetworkId());
  client.send(NetData.NetMessage.newBuilder().setTime(timer.getTimeInMs()).setServerInfo(serverInfoMessageBuilder).build());
}

Fixed version (ground truth):
private void sendServerInfo(NetClient client){
  NetData.ServerInfoMessage.Builder serverInfoMessageBuilder=NetData.ServerInfoMessage.newBuilder();
  WorldProvider world=CoreRegistry.get(WorldProvider.class);
  if (world != null) {
    serverInfoMessageBuilder.setTime(world.getTime());
    serverInfoMessageBuilder.setWorldName(world.getTitle());
  }
  for (  Mod mod : CoreRegistry.get(ModManager.class).getActiveMods()) {
    if (!mod.getModInfo().isServersideOnly()) {
      serverInfoMessageBuilder.addModule(NetData.ModuleInfo.newBuilder().setModuleId(mod.getModInfo().getId()).build());
    }
  }
  for (  Map.Entry<String,Byte> blockMapping : blockManager.getBlockIdMap().entrySet()) {
    serverInfoMessageBuilder.addBlockId(blockMapping.getValue());
    serverInfoMessageBuilder.addBlockName(blockMapping.getKey());
  }
  for (  BlockFamily registeredBlockFamily : blockManager.listRegisteredBlockFamilies()) {
    serverInfoMessageBuilder.addRegisterBlockFamily(registeredBlockFamily.getURI().toString());
  }
  serializeComponentInfo(serverInfoMessageBuilder);
  serializeEventInfo(serverInfoMessageBuilder);
  serverInfoMessageBuilder.setClientId(client.getEntity().getComponent(NetworkComponent.class).getNetworkId());
  client.send(NetData.NetMessage.newBuilder().setTime(timer.getTimeInMs()).setServerInfo(serverInfoMessageBuilder).build());
}
Program: 1098
Project: 1098
Buggy source:
@Override public void host(int port) throws HostingFailedException {
  if (mode == NetworkMode.NONE) {
    try {
      for (      EntityRef entity : entityManager.listEntitiesWith(NetworkComponent.class)) {
        registerNetworkEntity(entity);
      }
      generateSerializationTables();
      factory=new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
      ServerBootstrap bootstrap=new ServerBootstrap(factory);
      bootstrap.setPipelineFactory(new TerasologyServerPipelineFactory(this));
      bootstrap.setOption("String_Node_Str",true);
      bootstrap.setOption("String_Node_Str",true);
      Channel listenChannel=bootstrap.bind(new InetSocketAddress(port));
      allChannels.add(listenChannel);
      logger.info("String_Node_Str");
      nextNetworkTick=timer.getRawTimeInMs();
      mode=NetworkMode.SERVER;
    }
 catch (    ChannelException e) {
      if (e.getCause() instanceof BindException) {
        throw new HostingFailedException("String_Node_Str");
      }
 else {
        throw new HostingFailedException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void host(int port) throws HostingFailedException {
  if (mode == NetworkMode.NONE) {
    try {
      mode=NetworkMode.SERVER;
      for (      EntityRef entity : entityManager.listEntitiesWith(NetworkComponent.class)) {
        registerNetworkEntity(entity);
      }
      generateSerializationTables();
      factory=new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
      ServerBootstrap bootstrap=new ServerBootstrap(factory);
      bootstrap.setPipelineFactory(new TerasologyServerPipelineFactory(this));
      bootstrap.setOption("String_Node_Str",true);
      bootstrap.setOption("String_Node_Str",true);
      Channel listenChannel=bootstrap.bind(new InetSocketAddress(port));
      allChannels.add(listenChannel);
      logger.info("String_Node_Str");
      nextNetworkTick=timer.getRawTimeInMs();
    }
 catch (    ChannelException e) {
      if (e.getCause() instanceof BindException) {
        throw new HostingFailedException("String_Node_Str");
      }
 else {
        throw new HostingFailedException("String_Node_Str");
      }
    }
  }
}