nus-yam/ex-repair huggingface dataset:
Program: 1146
Project: 1146
Buggy source:
/** 
 * Place the item in the transfer slot directly on the target cell.
 * @param targetCell The target cell to move the item to.
 * @param amount The amount to place. 0 for whole stack.
 */
private static boolean moveItemPlace(UIItemCell targetCell,byte amount){
  EntityRef item=getFromTransferSlot();
  ItemComponent sourceItem=item.getComponent(ItemComponent.class);
  InventoryComponent targetInventory=targetCell.getOwnerEntity().getComponent(InventoryComponent.class);
  if (!targetInventory.itemSlots.get(targetCell.slot).exists()) {
    if (amount == 0) {
      amount=sourceItem.stackCount;
    }
    EntityManager entityManager=CoreRegistry.get(EntityManager.class);
    EntityRef copy=entityManager.copy(item);
    ItemComponent copyItem=copy.getComponent(ItemComponent.class);
    amount=(byte)Math.min(amount,sourceItem.stackCount);
    if (sourceItem.stackCount > amount) {
      sourceItem.stackCount-=amount;
      copyItem.stackCount=amount;
      copyItem.container=targetCell.ownerEntity;
      targetInventory.itemSlots.set(targetCell.slot,copy);
      return true;
    }
 else {
      targetInventory.itemSlots.set(targetCell.slot,item);
      sendToTransferSlot(null,(byte)0);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Place the item in the transfer slot directly on the target cell.
 * @param targetCell The target cell to move the item to.
 * @param amount The amount to place. 0 for whole stack.
 */
private static boolean moveItemPlace(UIItemCell targetCell,byte amount){
  EntityRef item=getFromTransferSlot();
  ItemComponent sourceItem=item.getComponent(ItemComponent.class);
  InventoryComponent targetInventory=targetCell.getOwnerEntity().getComponent(InventoryComponent.class);
  if (!targetInventory.itemSlots.get(targetCell.slot).exists()) {
    if (amount == 0) {
      amount=sourceItem.stackCount;
    }
    EntityManager entityManager=CoreRegistry.get(EntityManager.class);
    EntityRef copy=entityManager.copy(item);
    ItemComponent copyItem=copy.getComponent(ItemComponent.class);
    amount=(byte)Math.min(amount,sourceItem.stackCount);
    if (sourceItem.stackCount > amount) {
      sourceItem.stackCount-=amount;
      copyItem.stackCount=amount;
      copyItem.container=targetCell.ownerEntity;
      targetInventory.itemSlots.set(targetCell.slot,copy);
      return true;
    }
 else {
      sourceItem.container=targetCell.ownerEntity;
      targetInventory.itemSlots.set(targetCell.slot,item);
      sendToTransferSlot(null,(byte)0);
      return true;
    }
  }
  return false;
}
Program: 1147
Project: 1147
Buggy source:
/** 
 * Update the transfer icon position to the current mouse position.
 */
private void moveTransferIcon(){
  if (ownerEntity.getComponent(InventoryComponent.class) != null) {
    if (getFromTransferSlot().exists()) {
      ItemComponent item=getFromTransferSlot().getComponent(ItemComponent.class);
      if (item.container == ownerEntity) {
        transferIcon.setPosition(new Vector2f(Mouse.getX() - getSize().x / 2,Display.getHeight() - Mouse.getY() - getSize().y / 2));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the transfer icon position to the current mouse position. TODO all item cells with the same ownerEntity are updating the position -> just the dragged (source) item cell should update the position
 */
private void moveTransferIcon(){
  if (ownerEntity.getComponent(InventoryComponent.class) != null) {
    if (getFromTransferSlot().exists()) {
      ItemComponent item=getFromTransferSlot().getComponent(ItemComponent.class);
      if (item.container == ownerEntity) {
        transferIcon.setPosition(new Vector2f(Mouse.getX() - getSize().x / 2,Display.getHeight() - Mouse.getY() - getSize().y / 2));
      }
    }
  }
}
Program: 1148
Project: 1148
Buggy source:
/** 
 * Processes the given keyboard input.
 * @param event The key event
 */
public void processKeyboardInput(KeyEvent event){
  super.processKeyboardInput(event);
  if (!isVisible())   return;
  if (!event.isDown()) {
    return;
  }
switch (event.getKey()) {
case Keyboard.KEY_BACK:
    int length=_consoleInput.length() - 1;
  if (length < 0) {
    length=0;
  }
_consoleInput.setLength(length);
break;
case Keyboard.KEY_RETURN:
processConsoleString();
break;
case Keyboard.KEY_UP:
rotateRingBuffer(1);
break;
case Keyboard.KEY_DOWN:
rotateRingBuffer(-1);
break;
default :
char c=event.getKeyCharacter();
if (!Character.isISOControl(c)) {
_consoleInput.append(c);
}
break;
}
}

Fixed version (ground truth):
/** 
 * Processes the given keyboard input.
 * @param event The key event
 */
public void processKeyboardInput(KeyEvent event){
  super.processKeyboardInput(event);
  if (!isVisible())   return;
  if (!event.isDown()) {
    return;
  }
switch (event.getKey()) {
case Keyboard.KEY_BACK:
    int length=_consoleInput.length() - 1;
  if (length < 0) {
    length=0;
  }
_consoleInput.setLength(length);
event.consume();
break;
case Keyboard.KEY_RETURN:
processConsoleString();
event.consume();
break;
case Keyboard.KEY_UP:
rotateRingBuffer(1);
event.consume();
break;
case Keyboard.KEY_DOWN:
rotateRingBuffer(-1);
event.consume();
break;
default :
char c=event.getKeyCharacter();
if (!Character.isISOControl(c)) {
_consoleInput.append(c);
event.consume();
}
break;
}
}
Program: 1150
Project: 1150
Buggy source:
public void init(GameEngine engine){
  ModManager modManager=new ModManager();
  for (  Mod mod : modManager.getMods()) {
    mod.setEnabled(true);
  }
  modManager.saveModSelectionToConfig();
  AssetManager.getInstance().clear();
  BlockManager.getInstance().load(worldInfo.getBlockIdMap());
  cacheTextures();
  entityManager=new EntitySystemBuilder().build();
  eventSystem=CoreRegistry.get(EventSystem.class);
  componentSystemManager=new ComponentSystemManager();
  CoreRegistry.put(ComponentSystemManager.class,componentSystemManager);
  localPlayerSys=new LocalPlayerSystem();
  componentSystemManager.register(localPlayerSys,"String_Node_Str");
  cameraTargetSystem=new CameraTargetSystem();
  CoreRegistry.put(CameraTargetSystem.class,cameraTargetSystem);
  componentSystemManager.register(cameraTargetSystem,"String_Node_Str");
  inputSystem=new InputSystem();
  CoreRegistry.put(InputSystem.class,inputSystem);
  componentSystemManager.register(inputSystem,"String_Node_Str");
  componentSystemManager.loadEngineSystems();
  componentSystemManager.loadSystems("String_Node_Str","String_Node_Str");
  CoreRegistry.put(WorldPersister.class,new WorldPersister(entityManager));
  loadPrefabs();
}

Fixed version (ground truth):
public void init(GameEngine engine){
  ModManager modManager=new ModManager();
  for (  Mod mod : modManager.getMods()) {
    mod.setEnabled(true);
  }
  modManager.saveModSelectionToConfig();
  AssetManager.getInstance().clear();
  BlockManager.getInstance().load(worldInfo.getBlockIdMap());
  cacheTextures();
  cacheBlockMesh();
  entityManager=new EntitySystemBuilder().build();
  eventSystem=CoreRegistry.get(EventSystem.class);
  componentSystemManager=new ComponentSystemManager();
  CoreRegistry.put(ComponentSystemManager.class,componentSystemManager);
  localPlayerSys=new LocalPlayerSystem();
  componentSystemManager.register(localPlayerSys,"String_Node_Str");
  cameraTargetSystem=new CameraTargetSystem();
  CoreRegistry.put(CameraTargetSystem.class,cameraTargetSystem);
  componentSystemManager.register(cameraTargetSystem,"String_Node_Str");
  inputSystem=new InputSystem();
  CoreRegistry.put(InputSystem.class,inputSystem);
  componentSystemManager.register(inputSystem,"String_Node_Str");
  componentSystemManager.loadEngineSystems();
  componentSystemManager.loadSystems("String_Node_Str","String_Node_Str");
  CoreRegistry.put(WorldPersister.class,new WorldPersister(entityManager));
  loadPrefabs();
}
Program: 1153
Project: 1153
Buggy source:
@Override public void initialise(){
  physics=CoreRegistry.get(BulletPhysics.class);
}

Fixed version (ground truth):
@Override public void initialise(){
  physics=CoreRegistry.get(BulletPhysics.class);
  skipProcessingFrames=4;
}
Program: 1154
Project: 1154
Buggy source:
private void generateMesh(){
  Tessellator tessellator=new Tessellator();
  for (  BlockPart dir : BlockPart.values()) {
    BlockMeshPart part=meshPart.get(dir);
    if (part != null) {
      float lightLevel=DIRECTION_LIT_LEVEL.get(dir);
      tessellator.setColor(new Vector4f(lightLevel,lightLevel,lightLevel,lightLevel));
      tessellator.addMeshPart(part);
    }
  }
  mesh=tessellator.generateMesh(new AssetUri(AssetType.MESH,uri.toString()));
}

Fixed version (ground truth):
private void generateMesh(){
  Tessellator tessellator=new Tessellator();
  for (  BlockPart dir : BlockPart.values()) {
    BlockMeshPart part=meshPart.get(dir);
    if (part != null) {
      float lightLevel=DIRECTION_LIT_LEVEL.get(dir);
      tessellator.setColor(new Vector4f(lightLevel,lightLevel,lightLevel,lightLevel));
      tessellator.addMeshPart(part);
    }
  }
  mesh=tessellator.generateMesh(new AssetUri(AssetType.MESH,uri.toString()));
  AssetManager.getInstance().addAssetTemporary(mesh.getURI(),mesh);
}
Program: 1155
Project: 1155
Buggy source:
private BufferedImage generateAtlas(int mipMapLevel){
  int size=Block.ATLAS_SIZE_IN_PX / (1 << mipMapLevel);
  int textureSize=Block.TEXTURE_SIZE_IN_PX / (1 << mipMapLevel);
  BufferedImage result=new BufferedImage(size,size,BufferedImage.TYPE_INT_ARGB);
  Graphics g=result.getGraphics();
  if (tiles.size() > MAX_TILES) {
    logger.severe("String_Node_Str");
  }
  g.setColor(new Color(0,0,0));
  g.drawRect(0,0,textureSize,textureSize);
  for (int index=0; index < tiles.size() && index < MAX_TILES; ++index) {
    Tile tile=tiles.get(index);
    int posX=(index) % Block.ATLAS_ELEMENTS_PER_ROW_AND_COLUMN;
    int posY=(index) / Block.ATLAS_ELEMENTS_PER_ROW_AND_COLUMN;
    g.drawImage(tile.getImage().getScaledInstance(textureSize,textureSize,Image.SCALE_SMOOTH),posX * textureSize,posY * textureSize,null);
  }
  return result;
}

Fixed version (ground truth):
private BufferedImage generateAtlas(int mipMapLevel){
  int size=Block.ATLAS_SIZE_IN_PX / (1 << mipMapLevel);
  int textureSize=Block.TEXTURE_SIZE_IN_PX / (1 << mipMapLevel);
  BufferedImage result=new BufferedImage(size,size,BufferedImage.TYPE_INT_ARGB);
  Graphics g=result.getGraphics();
  if (tiles.size() > MAX_TILES) {
    logger.severe("String_Node_Str");
  }
  for (int index=0; index < tiles.size() && index < MAX_TILES; ++index) {
    Tile tile=tiles.get(index);
    int posX=(index) % Block.ATLAS_ELEMENTS_PER_ROW_AND_COLUMN;
    int posY=(index) / Block.ATLAS_ELEMENTS_PER_ROW_AND_COLUMN;
    g.drawImage(tile.getImage().getScaledInstance(textureSize,textureSize,Image.SCALE_SMOOTH),posX * textureSize,posY * textureSize,null);
  }
  return result;
}
Program: 1156
Project: 1156
Buggy source:
private int strToKey(String skey){
  if (skey.startsWith("String_Node_Str")) {
    if (skey == "String_Node_Str") {
      return 256;
    }
 else     if (skey == "String_Node_Str") {
      return 257;
    }
 else     if (skey == "String_Node_Str") {
      return 258;
    }
 else     if (skey == "String_Node_Str") {
      return 259;
    }
 else     if (skey == "String_Node_Str") {
      return 260;
    }
 else {
      return 261;
    }
  }
 else {
    return Keyboard.getKeyIndex(skey);
  }
}

Fixed version (ground truth):
private int strToKey(String skey){
  if (skey.startsWith("String_Node_Str")) {
    if (skey.equals("String_Node_Str")) {
      return 256;
    }
 else     if (skey.equals("String_Node_Str")) {
      return 257;
    }
 else     if (skey.equals("String_Node_Str")) {
      return 258;
    }
 else     if (skey.equals("String_Node_Str")) {
      return 259;
    }
 else     if (skey.equals("String_Node_Str")) {
      return 260;
    }
 else {
      return 261;
    }
  }
 else {
    return Keyboard.getKeyIndex(skey);
  }
}
Program: 1157
Project: 1157
Buggy source:
private ChunkGeneratorManager initChunkGeneratorManager(String title){
  ChunkGeneratorManager chunkGeneratorManager=null;
  File generatorDataFile=new File(PathManager.getInstance().getWorldSavePath(title),CHUNK_GENERATOR_FILE);
  try {
    chunkGeneratorManager=new ChunkGeneratorPersister().load(generatorDataFile);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  if (chunkGeneratorManager == null) {
switch (Config.getInstance().getChunkGenerator()) {
case 1:
      chunkGeneratorManager=new ChunkGeneratorManagerImpl();
    chunkGeneratorManager.registerChunkGenerator(new FlatTerrainGenerator());
  chunkGeneratorManager.registerChunkGenerator(new FloraGenerator());
chunkGeneratorManager.registerChunkGenerator(new LiquidsGenerator());
break;
default :
chunkGeneratorManager=ChunkGeneratorManagerImpl.getDefaultInstance();
}
try {
new ChunkGeneratorPersister().save(generatorDataFile,chunkGeneratorManager);
}
 catch (IOException e) {
logger.log(Level.SEVERE,"String_Node_Str",e);
}
}
return chunkGeneratorManager;
}

Fixed version (ground truth):
private ChunkGeneratorManager initChunkGeneratorManager(String title){
  ChunkGeneratorManager chunkGeneratorManager=null;
  File generatorDataFile=new File(PathManager.getInstance().getWorldSavePath(title),CHUNK_GENERATOR_FILE);
  try {
    chunkGeneratorManager=new ChunkGeneratorPersister().load(generatorDataFile);
  }
 catch (  IOException e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  if (chunkGeneratorManager == null) {
switch (Config.getInstance().getChunkGenerator()) {
case 1:
      chunkGeneratorManager=ChunkGeneratorManagerImpl.getFlatInstance();
    break;
default :
  chunkGeneratorManager=ChunkGeneratorManagerImpl.getDefaultInstance();
}
try {
new ChunkGeneratorPersister().save(generatorDataFile,chunkGeneratorManager);
}
 catch (IOException e) {
logger.log(Level.SEVERE,"String_Node_Str",e);
}
}
return chunkGeneratorManager;
}
Program: 1158
Project: 1158
Buggy source:
public ChunkGeneratorManager load(final File file) throws IOException {
  final FileInputStream in=new FileInputStream(file);
  ChunkGeneratorManager chunkGeneratorManager=null;
  try {
    final BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(in));
    chunkGeneratorManager=ChunkGeneratorJSONFormat.read(bufferedReader);
  }
  finally {
    try {
      in.close();
    }
 catch (    final IOException e) {
      logger.log(Level.SEVERE,"String_Node_Str",e);
    }
  }
  return chunkGeneratorManager;
}

Fixed version (ground truth):
public ChunkGeneratorManager load(final File file) throws IOException {
  ChunkGeneratorManager chunkGeneratorManager=null;
  if (file.exists()) {
    final FileInputStream in=new FileInputStream(file);
    try {
      final BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(in));
      chunkGeneratorManager=ChunkGeneratorJSONFormat.read(bufferedReader);
    }
  finally {
      try {
        in.close();
      }
 catch (      final IOException e) {
        logger.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
  }
  return chunkGeneratorManager;
}
Program: 1159
Project: 1159
Buggy source:
private Vector3d getCameraPosition(){
  return CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
}

Fixed version (ground truth):
private Vector3f getCameraPosition(){
  return CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
}
Program: 1160
Project: 1160
Buggy source:
protected void updatePosition(Vector3d position){
  float[] pos=new float[]{(float)position.x,(float)position.y,(float)position.z};
  if (isAbsolute()) {
    Vector3d cameraPos=getCameraPosition();
    pos[0]-=cameraPos.x;
    pos[1]-=cameraPos.y;
    pos[2]-=cameraPos.z;
  }
  alSource3f(getSourceId(),AL10.AL_POSITION,pos[0],pos[1],pos[2]);
  OpenALException.checkState("String_Node_Str");
}

Fixed version (ground truth):
protected void updatePosition(Vector3d position){
  float[] pos=new float[]{(float)position.x,(float)position.y,(float)position.z};
  if (isAbsolute()) {
    Vector3f cameraPos=getCameraPosition();
    pos[0]-=cameraPos.x;
    pos[1]-=cameraPos.y;
    pos[2]-=cameraPos.z;
  }
  alSource3f(getSourceId(),AL10.AL_POSITION,pos[0],pos[1],pos[2]);
  OpenALException.checkState("String_Node_Str");
}
Program: 1161
Project: 1161
Buggy source:
@Override protected boolean checkDistance(Vector3d soundSource){
  Camera camera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
  if (camera == null) {
    return false;
  }
  Vector3d soundPosition=new Vector3d(soundSource);
  soundPosition.sub(camera.getPosition());
  return soundPosition.lengthSquared() < MAX_DISTANCE_SQUARED;
}

Fixed version (ground truth):
@Override protected boolean checkDistance(Vector3d soundSource){
  Camera camera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
  if (camera == null) {
    return false;
  }
  Vector3f soundPosition=new Vector3f(soundSource);
  soundPosition.sub(camera.getPosition());
  return soundPosition.lengthSquared() < MAX_DISTANCE_SQUARED;
}
Program: 1163
Project: 1163
Buggy source:
private double calcBobbingOffset(float phaseOffset,float amplitude,float frequency){
  return java.lang.Math.sin(bobFactor * frequency + phaseOffset) * amplitude;
}

Fixed version (ground truth):
private float calcBobbingOffset(float phaseOffset,float amplitude,float frequency){
  return (float)java.lang.Math.sin(bobFactor * frequency + phaseOffset) * amplitude;
}
Program: 1164
Project: 1164
Buggy source:
private void updateCamera(CharacterMovementComponent charMovementComp,Vector3f position,Quat4f rotation){
  Vector3d cameraPosition=new Vector3d();
  cameraPosition.add(new Vector3d(position),new Vector3d(0,0.6f,0));
  playerCamera.getPosition().set(cameraPosition);
  Vector3f viewDir=new Vector3f(0,0,1);
  QuaternionUtil.quatRotate(rotation,viewDir,viewDir);
  playerCamera.getViewingDirection().set(viewDir);
  float stepDelta=charMovementComp.footstepDelta - lastStepDelta;
  if (stepDelta < 0)   stepDelta+=charMovementComp.distanceBetweenFootsteps;
  bobFactor+=stepDelta;
  lastStepDelta=charMovementComp.footstepDelta;
  if (cameraBobbing) {
    playerCamera.setBobbingRotationOffsetFactor(calcBobbingOffset(0.0f,0.01f,2.5f));
    playerCamera.setBobbingVerticalOffsetFactor(calcBobbingOffset((float)java.lang.Math.PI / 4f,0.025f,3f));
  }
 else {
    playerCamera.setBobbingRotationOffsetFactor(0.0);
    playerCamera.setBobbingVerticalOffsetFactor(0.0);
  }
  if (charMovementComp.isGhosting) {
    playerCamera.extendFov(24);
  }
 else {
    playerCamera.resetFov();
  }
}

Fixed version (ground truth):
private void updateCamera(CharacterMovementComponent charMovementComp,Vector3f position,Quat4f rotation){
  Vector3d cameraPosition=new Vector3d();
  cameraPosition.add(new Vector3d(position),new Vector3d(0,0.6f,0));
  playerCamera.getPosition().set(cameraPosition);
  Vector3f viewDir=new Vector3f(0,0,1);
  QuaternionUtil.quatRotate(rotation,viewDir,playerCamera.getViewingDirection());
  float stepDelta=charMovementComp.footstepDelta - lastStepDelta;
  if (stepDelta < 0)   stepDelta+=charMovementComp.distanceBetweenFootsteps;
  bobFactor+=stepDelta;
  lastStepDelta=charMovementComp.footstepDelta;
  if (cameraBobbing) {
    playerCamera.setBobbingRotationOffsetFactor(calcBobbingOffset(0.0f,0.01f,2.5f));
    playerCamera.setBobbingVerticalOffsetFactor(calcBobbingOffset((float)java.lang.Math.PI / 4f,0.025f,3f));
  }
 else {
    playerCamera.setBobbingRotationOffsetFactor(0.0f);
    playerCamera.setBobbingVerticalOffsetFactor(0.0f);
  }
  if (charMovementComp.isGhosting) {
    playerCamera.extendFov(24);
  }
 else {
    playerCamera.resetFov();
  }
}
Program: 1165
Project: 1165
Buggy source:
@Override public void renderOverlay(){
  if (effectsTexture == null)   return;
  ShaderManager.getInstance().enableDefaultTextured();
  glBindTexture(GL11.GL_TEXTURE_2D,effectsTexture.getId());
  glEnable(GL11.GL_BLEND);
  glBlendFunc(GL_DST_COLOR,GL_ZERO);
  Vector3d cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  for (  EntityRef entity : entityManager.iteratorEntities(HealthComponent.class,BlockComponent.class)) {
    HealthComponent health=entity.getComponent(HealthComponent.class);
    if (health.currentHealth == health.maxHealth)     continue;
    BlockComponent blockComp=entity.getComponent(BlockComponent.class);
    if (!worldProvider.isBlockActive(blockComp.getPosition()))     continue;
    glPushMatrix();
    glTranslated(blockComp.getPosition().x - cameraPosition.x,blockComp.getPosition().y - cameraPosition.y,blockComp.getPosition().z - cameraPosition.z);
    float offset=java.lang.Math.round((1.0f - (float)health.currentHealth / health.maxHealth) * 10.0f) * 0.0625f;
    glMatrixMode(GL_TEXTURE);
    glPushMatrix();
    glTranslatef(offset,0f,0f);
    glMatrixMode(GL_MODELVIEW);
    overlayMesh.render();
    glPopMatrix();
    glMatrixMode(GL_TEXTURE);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
  }
  glDisable(GL11.GL_BLEND);
}

Fixed version (ground truth):
@Override public void renderOverlay(){
  if (effectsTexture == null)   return;
  ShaderManager.getInstance().enableDefaultTextured();
  glBindTexture(GL11.GL_TEXTURE_2D,effectsTexture.getId());
  glEnable(GL11.GL_BLEND);
  glBlendFunc(GL_DST_COLOR,GL_ZERO);
  Vector3f cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  for (  EntityRef entity : entityManager.iteratorEntities(HealthComponent.class,BlockComponent.class)) {
    HealthComponent health=entity.getComponent(HealthComponent.class);
    if (health.currentHealth == health.maxHealth)     continue;
    BlockComponent blockComp=entity.getComponent(BlockComponent.class);
    if (!worldProvider.isBlockActive(blockComp.getPosition()))     continue;
    glPushMatrix();
    glTranslated(blockComp.getPosition().x - cameraPosition.x,blockComp.getPosition().y - cameraPosition.y,blockComp.getPosition().z - cameraPosition.z);
    float offset=java.lang.Math.round((1.0f - (float)health.currentHealth / health.maxHealth) * 10.0f) * 0.0625f;
    glMatrixMode(GL_TEXTURE);
    glPushMatrix();
    glTranslatef(offset,0f,0f);
    glMatrixMode(GL_MODELVIEW);
    overlayMesh.render();
    glPopMatrix();
    glMatrixMode(GL_TEXTURE);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
  }
  glDisable(GL11.GL_BLEND);
}
Program: 1168
Project: 1168
Buggy source:
public void update(){
  if (!target.exists() && targetBlockPos != null) {
    target=blockRegistry.getOrCreateEntityAt(targetBlockPos);
  }
  boolean lostTarget=false;
  if (!target.exists()) {
    targetBlockPos=null;
    lostTarget=true;
  }
  Camera camera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
  BulletPhysicsRenderer physicsRenderer=CoreRegistry.get(BulletPhysicsRenderer.class);
  HitResult hitInfo=physicsRenderer.rayTrace(new Vector3f(camera.getPosition()),new Vector3f(camera.getViewingDirection()),TARGET_DISTANCE);
  if (hitInfo.isHit()) {
    hitPosition=hitInfo.getHitPoint();
    hitNormal=hitInfo.getHitNormal();
    Vector3i newBlockPos=null;
    BlockComponent blockComp=hitInfo.getEntity().getComponent(BlockComponent.class);
    if (blockComp != null) {
      newBlockPos=new Vector3i(blockComp.getPosition());
    }
    if (!Objects.equal(targetBlockPos,newBlockPos) || lostTarget) {
      EntityRef oldTarget=target;
      target=EntityRef.NULL;
      targetBlockPos=newBlockPos;
      if (newBlockPos != null) {
        target=hitInfo.getEntity();
      }
      oldTarget.send(new CameraOutEvent());
      target.send(new CameraOverEvent());
      localPlayer.getEntity().send(new CameraTargetChangedEvent(oldTarget,target));
    }
  }
}

Fixed version (ground truth):
public void update(){
  if (!target.exists() && targetBlockPos != null) {
    target=blockRegistry.getOrCreateEntityAt(targetBlockPos);
  }
  boolean lostTarget=false;
  if (!target.exists()) {
    targetBlockPos=null;
    lostTarget=true;
  }
  Camera camera=CoreRegistry.get(WorldRenderer.class).getActiveCamera();
  BulletPhysicsRenderer physicsRenderer=CoreRegistry.get(BulletPhysicsRenderer.class);
  HitResult hitInfo=physicsRenderer.rayTrace(new Vector3f(camera.getPosition()),new Vector3f(camera.getViewingDirection()),TARGET_DISTANCE);
  Vector3i newBlockPos=null;
  if (hitInfo.isHit()) {
    hitPosition=hitInfo.getHitPoint();
    hitNormal=hitInfo.getHitNormal();
    BlockComponent blockComp=hitInfo.getEntity().getComponent(BlockComponent.class);
    if (blockComp != null) {
      newBlockPos=new Vector3i(blockComp.getPosition());
    }
  }
  if (!Objects.equal(targetBlockPos,newBlockPos) || lostTarget) {
    EntityRef oldTarget=target;
    target=EntityRef.NULL;
    targetBlockPos=newBlockPos;
    if (newBlockPos != null) {
      target=hitInfo.getEntity();
    }
    oldTarget.send(new CameraOutEvent());
    target.send(new CameraOverEvent());
    localPlayer.getEntity().send(new CameraTargetChangedEvent(oldTarget,target));
  }
}
Program: 1169
Project: 1169
Buggy source:
/** 
 * Renders this AABB. <p/>
 * @param lineThickness The thickness of the line
 */
public void render(float lineThickness){
  ShaderManager.getInstance().enableDefault();
  glPushMatrix();
  Vector3d cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  glTranslated(getPosition().x - cameraPosition.x,-cameraPosition.y,getPosition().z - cameraPosition.z);
  renderLocally(lineThickness);
  glPopMatrix();
}

Fixed version (ground truth):
/** 
 * Renders this AABB. <p/>
 * @param lineThickness The thickness of the line
 */
public void render(float lineThickness){
  ShaderManager.getInstance().enableDefault();
  glPushMatrix();
  Vector3f cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  glTranslated(getPosition().x - cameraPosition.x,-cameraPosition.y,getPosition().z - cameraPosition.z);
  renderLocally(lineThickness);
  glPopMatrix();
}
Program: 1171
Project: 1171
Buggy source:
public Vector3d getPosition(){
  return _position;
}

Fixed version (ground truth):
public Vector3f getPosition(){
  return _position;
}
Program: 1172
Project: 1172
Buggy source:
public Vector3d getViewingDirection(){
  return _viewingDirection;
}

Fixed version (ground truth):
public Vector3f getViewingDirection(){
  return _viewingDirection;
}
Program: 1173
Project: 1173
Buggy source:
public Vector3d getUp(){
  return _up;
}

Fixed version (ground truth):
public Vector3f getUp(){
  return _up;
}
Program: 1174
Project: 1174
Buggy source:
public void loadModelViewMatrix(){
  glMatrixMode(GL11.GL_MODELVIEW);
  glLoadIdentity();
  Vector3d right=new Vector3d();
  right.cross(_viewingDirection,_up);
  right.scale(_bobbingRotationOffsetFactor);
  GLU.gluLookAt(0f,(float)_bobbingVerticalOffsetFactor * 2.0f,0f,(float)_viewingDirection.x,(float)_viewingDirection.y + (float)_bobbingVerticalOffsetFactor * 2.0f,(float)_viewingDirection.z,(float)_up.x + (float)right.x,(float)_up.y + (float)right.y,(float)_up.z + (float)right.z);
  _viewFrustum.updateFrustum();
}

Fixed version (ground truth):
public void loadModelViewMatrix(){
  glMatrixMode(GL11.GL_MODELVIEW);
  glLoadIdentity();
  Vector3f right=new Vector3f();
  right.cross(_viewingDirection,_up);
  right.scale(_bobbingRotationOffsetFactor);
  GLU.gluLookAt(0f,(float)_bobbingVerticalOffsetFactor * 2.0f,0f,(float)_viewingDirection.x,(float)_viewingDirection.y + (float)_bobbingVerticalOffsetFactor * 2.0f,(float)_viewingDirection.z,(float)_up.x + (float)right.x,(float)_up.y + (float)right.y,(float)_up.z + (float)right.z);
  _viewFrustum.updateFrustum();
}
Program: 1175
Project: 1175
Buggy source:
public void loadNormalizedModelViewMatrix(){
  glMatrixMode(GL11.GL_MODELVIEW);
  glLoadIdentity();
  Vector3d right=new Vector3d();
  right.cross(_viewingDirection,_up);
  right.scale(_bobbingRotationOffsetFactor);
  GLU.gluLookAt(0f,0f,0f,(float)_viewingDirection.x,(float)_viewingDirection.y,(float)_viewingDirection.z,(float)_up.x + (float)right.x,(float)_up.y + (float)right.y,(float)_up.z + (float)right.z);
  _viewFrustum.updateFrustum();
}

Fixed version (ground truth):
public void loadNormalizedModelViewMatrix(){
  glMatrixMode(GL11.GL_MODELVIEW);
  glLoadIdentity();
  Vector3f right=new Vector3f();
  right.cross(_viewingDirection,_up);
  right.scale(_bobbingRotationOffsetFactor);
  GLU.gluLookAt(0f,0f,0f,(float)_viewingDirection.x,(float)_viewingDirection.y,(float)_viewingDirection.z,(float)_up.x + (float)right.x,(float)_up.y + (float)right.y,(float)_up.z + (float)right.z);
  _viewFrustum.updateFrustum();
}
Program: 1176
Project: 1176
Buggy source:
public void setBobbingRotationOffsetFactor(double f){
  _bobbingRotationOffsetFactor=f;
}

Fixed version (ground truth):
public void setBobbingRotationOffsetFactor(float f){
  _bobbingRotationOffsetFactor=f;
}
Program: 1177
Project: 1177
Buggy source:
public void setBobbingVerticalOffsetFactor(double f){
  _bobbingVerticalOffsetFactor=f;
}

Fixed version (ground truth):
public void setBobbingVerticalOffsetFactor(float f){
  _bobbingVerticalOffsetFactor=f;
}
Program: 1178
Project: 1178
Buggy source:
public void update(){
  super.update();
  _healthBar.setPosition(new Vector2f(_toolbar.getPosition().x,_toolbar.getPosition().y - _toolbar.getSize().y + 8f));
  _crosshair.setPosition(new Vector2f(Display.getWidth() / 2,Display.getHeight() / 2));
  boolean enableDebug=Config.getInstance().isDebug();
  _debugLine1.setVisible(enableDebug);
  _debugLine2.setVisible(enableDebug);
  _debugLine3.setVisible(enableDebug);
  _debugLine4.setVisible(enableDebug);
  if (enableDebug) {
    double memoryUsage=((double)Runtime.getRuntime().totalMemory() - (double)Runtime.getRuntime().freeMemory()) / 1048576.0;
    Timer timer=CoreRegistry.get(Timer.class);
    _debugLine1.setText(String.format("String_Node_Str",timer.getFps(),memoryUsage,Runtime.getRuntime().totalMemory() / 1048576.0,Runtime.getRuntime().maxMemory() / 1048576.0));
    _debugLine2.setText(String.format("String_Node_Str",CoreRegistry.get(LocalPlayer.class)));
    _debugLine3.setText(String.format("String_Node_Str",CoreRegistry.get(WorldRenderer.class)));
    _debugLine4.setText(String.format("String_Node_Str",ChunkTessellator.getVertexArrayUpdateCount(),CoreRegistry.get(GameEngine.class).getActiveTaskCount()));
  }
}

Fixed version (ground truth):
public void update(){
  super.update();
  _healthBar.setPosition(new Vector2f(_toolbar.getPosition().x,_toolbar.getPosition().y - _toolbar.getSize().y + 8f));
  _crosshair.setPosition(new Vector2f(Display.getWidth() / 2,Display.getHeight() / 2));
  boolean enableDebug=Config.getInstance().isDebug();
  _debugLine1.setVisible(enableDebug);
  _debugLine2.setVisible(enableDebug);
  _debugLine3.setVisible(enableDebug);
  _debugLine4.setVisible(enableDebug);
  if (enableDebug) {
    CameraTargetSystem cameraTarget=CoreRegistry.get(CameraTargetSystem.class);
    double memoryUsage=((double)Runtime.getRuntime().totalMemory() - (double)Runtime.getRuntime().freeMemory()) / 1048576.0;
    Timer timer=CoreRegistry.get(Timer.class);
    _debugLine1.setText(String.format("String_Node_Str",timer.getFps(),memoryUsage,Runtime.getRuntime().totalMemory() / 1048576.0,Runtime.getRuntime().maxMemory() / 1048576.0));
    _debugLine2.setText(String.format("String_Node_Str",cameraTarget.toString()));
    _debugLine3.setText(String.format("String_Node_Str",CoreRegistry.get(WorldRenderer.class)));
    _debugLine4.setText(String.format("String_Node_Str",ChunkTessellator.getVertexArrayUpdateCount(),CoreRegistry.get(GameEngine.class).getActiveTaskCount()));
  }
}
Program: 1179
Project: 1179
Buggy source:
@Override public void render(){
  FloatBuffer mBuffer=BufferUtils.createFloatBuffer(16);
  float[] mFloat=new float[16];
  GL11.glPushMatrix();
  Vector3d cameraPosition=_parent.getActiveCamera().getPosition();
  GL11.glTranslated(-cameraPosition.x,-cameraPosition.y,-cameraPosition.z);
  List<CollisionObject> collisionObjects=_discreteDynamicsWorld.getCollisionObjectArray();
  for (  CollisionObject co : collisionObjects) {
    if (co.getClass().equals(BlockRigidBody.class)) {
      BlockRigidBody br=(BlockRigidBody)co;
      Block block=BlockManager.getInstance().getBlock(br.getType());
      Transform t=new Transform();
      br.getMotionState().getWorldTransform(t);
      t.getOpenGLMatrix(mFloat);
      mBuffer.put(mFloat);
      mBuffer.flip();
      GL11.glPushMatrix();
      GL11.glMultMatrix(mBuffer);
      if (br.getCollisionShape() == _blockShapeHalf)       GL11.glScalef(0.5f,0.5f,0.5f);
 else       if (br.getCollisionShape() == _blockShapeQuarter)       GL11.glScalef(0.25f,0.25f,0.25f);
      block.renderWithLightValue(_parent.getRenderingLightValueAt(t.origin));
      GL11.glPopMatrix();
    }
  }
  GL11.glPopMatrix();
}

Fixed version (ground truth):
@Override public void render(){
  FloatBuffer mBuffer=BufferUtils.createFloatBuffer(16);
  float[] mFloat=new float[16];
  GL11.glPushMatrix();
  Vector3f cameraPosition=_parent.getActiveCamera().getPosition();
  GL11.glTranslated(-cameraPosition.x,-cameraPosition.y,-cameraPosition.z);
  List<CollisionObject> collisionObjects=_discreteDynamicsWorld.getCollisionObjectArray();
  for (  CollisionObject co : collisionObjects) {
    if (co.getClass().equals(BlockRigidBody.class)) {
      BlockRigidBody br=(BlockRigidBody)co;
      Block block=BlockManager.getInstance().getBlock(br.getType());
      Transform t=new Transform();
      br.getMotionState().getWorldTransform(t);
      t.getOpenGLMatrix(mFloat);
      mBuffer.put(mFloat);
      mBuffer.flip();
      GL11.glPushMatrix();
      GL11.glMultMatrix(mBuffer);
      if (br.getCollisionShape() == _blockShapeHalf)       GL11.glScalef(0.5f,0.5f,0.5f);
 else       if (br.getCollisionShape() == _blockShapeQuarter)       GL11.glScalef(0.25f,0.25f,0.25f);
      block.renderWithLightValue(_parent.getRenderingLightValueAt(t.origin));
      GL11.glPopMatrix();
    }
  }
  GL11.glPopMatrix();
}
Program: 1180
Project: 1180
Buggy source:
@Override public void applyParameters(ShaderProgram program){
  PostProcessingRenderer.FBO scene=PostProcessingRenderer.getInstance().getFBO("String_Node_Str");
  GL13.glActiveTexture(GL13.GL_TEXTURE1);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE2);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE3);
  glBindTexture(GL11.GL_TEXTURE_2D,texture.getId());
  GL13.glActiveTexture(GL13.GL_TEXTURE4);
  scene.bindDepthTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE0);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  program.setInt("String_Node_Str",0);
  program.setInt("String_Node_Str",1);
  program.setInt("String_Node_Str",2);
  program.setInt("String_Node_Str",3);
  program.setInt("String_Node_Str",4);
  program.setFloat("String_Node_Str",Config.getInstance().getActiveViewingDistance() * 8.0f);
  if (CoreRegistry.get(LocalPlayer.class).isValid()) {
    Vector3d cameraPos=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
    Block block=CoreRegistry.get(WorldProvider.class).getBlock(new Vector3f(cameraPos));
    program.setInt("String_Node_Str",block.isLiquid() ? 1 : 0);
  }
}

Fixed version (ground truth):
@Override public void applyParameters(ShaderProgram program){
  PostProcessingRenderer.FBO scene=PostProcessingRenderer.getInstance().getFBO("String_Node_Str");
  GL13.glActiveTexture(GL13.GL_TEXTURE1);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE2);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE3);
  glBindTexture(GL11.GL_TEXTURE_2D,texture.getId());
  GL13.glActiveTexture(GL13.GL_TEXTURE4);
  scene.bindDepthTexture();
  GL13.glActiveTexture(GL13.GL_TEXTURE0);
  PostProcessingRenderer.getInstance().getFBO("String_Node_Str").bindTexture();
  program.setInt("String_Node_Str",0);
  program.setInt("String_Node_Str",1);
  program.setInt("String_Node_Str",2);
  program.setInt("String_Node_Str",3);
  program.setInt("String_Node_Str",4);
  program.setFloat("String_Node_Str",Config.getInstance().getActiveViewingDistance() * 8.0f);
  if (CoreRegistry.get(LocalPlayer.class).isValid()) {
    Vector3f cameraPos=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
    Block block=CoreRegistry.get(WorldProvider.class).getBlock(cameraPos);
    program.setInt("String_Node_Str",block.isLiquid() ? 1 : 0);
  }
}
Program: 1181
Project: 1181
Buggy source:
@Override public void render(){
  ShaderManager.getInstance().enableDefault();
  for (int i=0; i < 2; i++) {
    if (i == 0) {
      glColorMask(false,false,false,false);
    }
 else {
      glColorMask(true,true,true,true);
    }
    for (    BlockPosition gp : _gridPositions) {
      GL11.glPushMatrix();
      Vector3d cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
      GL11.glTranslated(gp.x - cameraPosition.x,gp.y - cameraPosition.y,gp.z - cameraPosition.z);
      _mesh.render();
      GL11.glPopMatrix();
    }
  }
}

Fixed version (ground truth):
@Override public void render(){
  ShaderManager.getInstance().enableDefault();
  for (int i=0; i < 2; i++) {
    if (i == 0) {
      glColorMask(false,false,false,false);
    }
 else {
      glColorMask(true,true,true,true);
    }
    for (    BlockPosition gp : _gridPositions) {
      GL11.glPushMatrix();
      Vector3f cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
      GL11.glTranslated(gp.x - cameraPosition.x,gp.y - cameraPosition.y,gp.z - cameraPosition.z);
      _mesh.render();
      GL11.glPopMatrix();
    }
  }
}
Program: 1182
Project: 1182
Buggy source:
private void renderChunk(Chunk chunk,ChunkMesh.RENDER_PHASE phase){
  if (chunk.getChunkState() == Chunk.State.COMPLETE && chunk.getMesh() != null) {
    ShaderProgram shader=ShaderManager.getInstance().getShaderProgram("String_Node_Str");
    shader.setFloat3("String_Node_Str",(float)(chunk.getPos().x * Chunk.SIZE_X),(float)(chunk.getPos().y * Chunk.SIZE_Y),(float)(chunk.getPos().z * Chunk.SIZE_Z));
    GL11.glPushMatrix();
    Vector3d cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
    GL11.glTranslated(chunk.getPos().x * Chunk.SIZE_X - cameraPosition.x,chunk.getPos().y * Chunk.SIZE_Y - cameraPosition.y,chunk.getPos().z * Chunk.SIZE_Z - cameraPosition.z);
    for (int i=0; i < VERTICAL_SEGMENTS; i++) {
      if (!chunk.getMesh()[i].isEmpty()) {
        if (Config.getInstance().isRenderChunkBoundingBoxes()) {
          chunk.getSubMeshAABB(i).renderLocally(1f);
          _statRenderedTriangles+=12;
        }
        shader.enable();
        chunk.getMesh()[i].render(phase);
        _statRenderedTriangles+=chunk.getMesh()[i].triangleCount();
      }
    }
    GL11.glPopMatrix();
  }
 else {
    _statChunkNotReady++;
  }
}

Fixed version (ground truth):
private void renderChunk(Chunk chunk,ChunkMesh.RENDER_PHASE phase){
  if (chunk.getChunkState() == Chunk.State.COMPLETE && chunk.getMesh() != null) {
    ShaderProgram shader=ShaderManager.getInstance().getShaderProgram("String_Node_Str");
    shader.setFloat3("String_Node_Str",(float)(chunk.getPos().x * Chunk.SIZE_X),(float)(chunk.getPos().y * Chunk.SIZE_Y),(float)(chunk.getPos().z * Chunk.SIZE_Z));
    GL11.glPushMatrix();
    Vector3f cameraPosition=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
    GL11.glTranslated(chunk.getPos().x * Chunk.SIZE_X - cameraPosition.x,chunk.getPos().y * Chunk.SIZE_Y - cameraPosition.y,chunk.getPos().z * Chunk.SIZE_Z - cameraPosition.z);
    for (int i=0; i < VERTICAL_SEGMENTS; i++) {
      if (!chunk.getMesh()[i].isEmpty()) {
        if (Config.getInstance().isRenderChunkBoundingBoxes()) {
          chunk.getSubMeshAABB(i).renderLocally(1f);
          _statRenderedTriangles+=12;
        }
        shader.enable();
        chunk.getMesh()[i].render(phase);
        _statRenderedTriangles+=chunk.getMesh()[i].triangleCount();
      }
    }
    GL11.glPopMatrix();
  }
 else {
    _statChunkNotReady++;
  }
}
Program: 1183
Project: 1183
Buggy source:
private float distanceToCamera(Chunk chunk){
  Vector3f result=new Vector3f((chunk.getPos().x + 0.5f) * Chunk.SIZE_X,0,(chunk.getPos().z + 0.5f) * Chunk.SIZE_Z);
  Vector3d cameraPos=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  result.x-=cameraPos.x;
  result.z-=cameraPos.z;
  return result.length();
}

Fixed version (ground truth):
private float distanceToCamera(Chunk chunk){
  Vector3f result=new Vector3f((chunk.getPos().x + 0.5f) * Chunk.SIZE_X,0,(chunk.getPos().z + 0.5f) * Chunk.SIZE_Z);
  Vector3f cameraPos=CoreRegistry.get(WorldRenderer.class).getActiveCamera().getPosition();
  result.x-=cameraPos.x;
  result.z-=cameraPos.z;
  return result.length();
}
Program: 1184
Project: 1184
Buggy source:
private void propagateFrom(int blockX,int blockY,int blockZ){
  propagateSunlightFrom(blockX,blockY,blockZ);
  propagateLightFrom(blockX,blockY,blockZ);
}

Fixed version (ground truth):
private void propagateFrom(int blockX,int blockY,int blockZ){
  propagateSunlightFrom(blockX,blockY,blockZ);
}
Program: 1186
Project: 1186
Buggy source:
private void propagateLightFrom(int blockX,int blockY,int blockZ){
  byte lightLevel=worldView.getLight(blockX,blockY,blockZ);
  if (lightLevel <= 1)   return;
  for (  Vector3i adjDir : HORIZONTAL_LIGHT_DIRECTIONS) {
    int adjX=blockX + adjDir.x;
    int adjZ=blockZ + adjDir.z;
    byte adjLightValue=worldView.getLight(adjX,blockY,adjZ);
    if (adjLightValue < lightLevel - 1 && worldView.getBlock(adjX,blockY,adjZ).isTranslucent()) {
      worldView.setLight(adjX,blockY,adjZ,(byte)(lightLevel - 1));
      propagateLightFrom(adjX,blockY,adjZ);
    }
  }
  if (blockY > 0) {
    byte lowerLight=worldView.getLight(blockX,blockY - 1,blockZ);
    if (lowerLight < lightLevel - 1) {
      worldView.setLight(blockX,blockY - 1,blockZ,(byte)(lightLevel - 1));
      propagateLightFrom(blockX,blockY - 1,blockZ);
    }
  }
  if (blockY < NewChunk.CHUNK_DIMENSION_Y - 1) {
    byte upperLight=worldView.getLight(blockX,blockY + 1,blockZ);
    if (upperLight < lightLevel - 1) {
      worldView.setLight(blockX,blockY + 1,blockZ,(byte)(lightLevel - 1));
      propagateLightFrom(blockX,blockY + 1,blockZ);
    }
  }
}

Fixed version (ground truth):
private void propagateLightFrom(int blockX,int blockY,int blockZ){
  byte lightLevel=worldView.getLight(blockX,blockY,blockZ);
  if (lightLevel <= 1)   return;
  for (  Vector3i adjDir : HORIZONTAL_LIGHT_DIRECTIONS) {
    int adjX=blockX + adjDir.x;
    int adjZ=blockZ + adjDir.z;
    byte adjLightValue=worldView.getLight(adjX,blockY,adjZ);
    if (adjLightValue < lightLevel - 1 && worldView.getBlock(adjX,blockY,adjZ).isTranslucent()) {
      worldView.setLight(adjX,blockY,adjZ,(byte)(lightLevel - 1));
      propagateLightFrom(adjX,blockY,adjZ);
    }
  }
  if (blockY > 0 && worldView.getBlock(blockX,blockY - 1,blockZ).isTranslucent()) {
    byte lowerLight=worldView.getLight(blockX,blockY - 1,blockZ);
    if (lowerLight < lightLevel - 1) {
      worldView.setLight(blockX,blockY - 1,blockZ,(byte)(lightLevel - 1));
      propagateLightFrom(blockX,blockY - 1,blockZ);
    }
  }
  if (blockY < NewChunk.CHUNK_DIMENSION_Y - 1 && worldView.getBlock(blockX,blockY + 1,blockZ).isTranslucent()) {
    byte upperLight=worldView.getLight(blockX,blockY + 1,blockZ);
    if (upperLight < lightLevel - 1) {
      worldView.setLight(blockX,blockY + 1,blockZ,(byte)(lightLevel - 1));
      propagateLightFrom(blockX,blockY + 1,blockZ);
    }
  }
}
Program: 1187
Project: 1187
Buggy source:
private void spreadSunlightInternal(NewChunk chunk,int x,int y,int z){
  byte lightValue=chunk.getSunlight(x,y,z);
  if (lightValue <= 1)   return;
  for (  Vector3i adjDir : HORIZONTAL_LIGHT_DIRECTIONS) {
    int adjX=x + adjDir.x;
    int adjZ=z + adjDir.z;
    if (chunk.isInBounds(adjX,y,adjZ)) {
      byte adjLightValue=chunk.getSunlight(adjX,y,adjZ);
      if (adjLightValue < lightValue - 1 && chunk.getBlock(adjX,y,adjZ).isTranslucent()) {
        chunk.setSunlight(adjX,y,adjZ,(byte)(lightValue - 1));
        spreadSunlightInternal(chunk,adjX,y,adjZ);
      }
    }
  }
  if (y > 0 && lightValue < NewChunk.MAX_LIGHT && chunk.getSunlight(x,y - 1,z) < lightValue - 1 && chunk.getBlock(x,y - 1,z).isTranslucent()) {
    chunk.setSunlight(x,y - 1,z,(byte)(lightValue - 1));
    spreadSunlightInternal(chunk,x,y - 1,z);
  }
}

Fixed version (ground truth):
private void spreadSunlightInternal(NewChunk chunk,int x,int y,int z){
  byte lightValue=chunk.getSunlight(x,y,z);
  if (y > 0 && lightValue < NewChunk.MAX_LIGHT && chunk.getSunlight(x,y - 1,z) < lightValue - 1 && chunk.getBlock(x,y - 1,z).isTranslucent()) {
    chunk.setSunlight(x,y - 1,z,(byte)(lightValue - 1));
    spreadSunlightInternal(chunk,x,y - 1,z);
  }
  if (y < NewChunk.CHUNK_DIMENSION_Y && lightValue < NewChunk.MAX_LIGHT && chunk.getSunlight(x,y + 1,z) < lightValue - 1 && chunk.getBlock(x,y + 1,z).isTranslucent()) {
    chunk.setSunlight(x,y + 1,z,(byte)(lightValue - 1));
    spreadSunlightInternal(chunk,x,y + 1,z);
  }
  if (lightValue <= 1)   return;
  for (  Vector3i adjDir : HORIZONTAL_LIGHT_DIRECTIONS) {
    int adjX=x + adjDir.x;
    int adjZ=z + adjDir.z;
    if (chunk.isInBounds(adjX,y,adjZ)) {
      byte adjLightValue=chunk.getSunlight(adjX,y,adjZ);
      if (adjLightValue < lightValue - 1 && chunk.getBlock(adjX,y,adjZ).isTranslucent()) {
        chunk.setSunlight(adjX,y,adjZ,(byte)(lightValue - 1));
        spreadSunlightInternal(chunk,adjX,y,adjZ);
      }
    }
  }
}
Program: 1188
Project: 1188
Buggy source:
/** 
 * Returns the byte value at the given position.
 */
public byte get(int x,int y,int z){
  int pos=(x * _lX * _lY) + (y * _lX) + z;
  if (x >= _lX || y >= _lY || z >= _lZ || x < 0 || y < 0 || z < 0)   return -1;
  if (pos < _halfSize) {
    int bArray=_array[pos] & 0xFF;
    return (byte)((bArray & 0x0F) & 0xFF);
  }
  int bArray=_array[pos % _halfSize] & 0xFF;
  return (byte)(bArray >> 4);
}

Fixed version (ground truth):
/** 
 * Returns the byte value at the given position.
 */
public byte get(int x,int y,int z){
  int pos=(x * _lX * _lY) + (y * _lX) + z;
  if (x >= _lX || y >= _lY || z >= _lZ || x < 0 || y < 0 || z < 0) {
    throw new IndexOutOfBoundsException(String.format("String_Node_Str",x,y,z));
  }
  if (pos < _halfSize) {
    int bArray=_array[pos] & 0xFF;
    return (byte)((bArray & 0x0F) & 0xFF);
  }
  int bArray=_array[pos % _halfSize] & 0xFF;
  return (byte)(bArray >> 4);
}
Program: 1191
Project: 1191
Buggy source:
public void RightMouseReleased(){
  UIMinion minionbehaviourmenu=(UIMinion)GUIManager.getInstance().getWindowById(behaviourmenu);
  if (minionbehaviourmenu != null) {
    GUIManager.getInstance().removeWindow(minionbehaviourmenu);
    if (GUIManager.getInstance().getWindowById("String_Node_Str") != null) {
      GUIManager.getInstance().setFocusedWindow("String_Node_Str");
    }
  }
  setMinionSelectMode(false);
  if (getSelectedBehaviour() == MinionComponent.MinionBehaviour.Disappear) {
    DestroyActiveMinion();
  }
 else   if (getSelectedBehaviour() == MinionComponent.MinionBehaviour.Inventory) {
    LocalPlayer localPlayer=CoreRegistry.get(LocalPlayer.class);
    if (localPlayer == null)     return;
    getSelectedMinion().send(new ActivateEvent(getSelectedMinion(),localPlayer.getEntity()));
  }
  MinionComponent minioncomp=getSelectedMinion().getComponent(MinionComponent.class);
  getSelectedMinion().saveComponent(minioncomp);
}

Fixed version (ground truth):
public void RightMouseReleased(){
  UIMinion minionbehaviourmenu=(UIMinion)GUIManager.getInstance().getWindowById(behaviourmenu);
  if (minionbehaviourmenu != null) {
    GUIManager.getInstance().removeWindow(minionbehaviourmenu);
    if (GUIManager.getInstance().getWindowById("String_Node_Str") != null) {
      GUIManager.getInstance().setFocusedWindow("String_Node_Str");
    }
  }
  setMinionSelectMode(false);
  if (getSelectedBehaviour() == MinionComponent.MinionBehaviour.Disappear) {
    DestroyActiveMinion();
  }
 else   if (getSelectedBehaviour() == MinionComponent.MinionBehaviour.Inventory) {
    LocalPlayer localPlayer=CoreRegistry.get(LocalPlayer.class);
    if (localPlayer == null)     return;
    getSelectedMinion().send(new ActivateEvent(getSelectedMinion(),localPlayer.getEntity()));
    MinionComponent minioncomp=getSelectedMinion().getComponent(MinionComponent.class);
    minioncomp.minionBehaviour=MinionComponent.MinionBehaviour.Move;
  }
  MinionComponent minioncomp=getSelectedMinion().getComponent(MinionComponent.class);
  getSelectedMinion().saveComponent(minioncomp);
}