Program: 174500
Project: 174500
Buggy source:
@Override public void run(EntityBismuth gem){
  if (this.lastBlockPlace > 20) {
    if (this.startedBuilding) {
      boolean placed=false;
      BlockPos nextPos=gem.getPosition();
      for (int y=0; y < this.height; ++y) {
        if (!gem.world.getBlockState(nextPos.up(y)).getBlock().isTopSolid(gem.world.getBlockState(nextPos.up(y)))) {
          placed=gem.placeBlock(this.bridgeBlock,nextPos.up(y));
          if (placed) {
            gem.setPosition(nextPos.getX(),nextPos.getY() + y + 1,nextPos.getZ());
            this.placeStack.shrink(1);
            if (this.placeStack.isEmpty()) {
              this.getBlock(gem);
            }
          }
 else {
            break;
          }
        }
      }
      this.startedBuilding=false;
      this.stillBuilding=placed;
      this.lastBlockPlace=0;
    }
 else {
      boolean placed=false;
      BlockPos nextPos=gem.getPosition().add(this.direction[0],-this.height,this.direction[1]);
      gem.lookAt(nextPos.add(this.direction[0],0,this.direction[1]));
      for (int y=0; y < this.height; ++y) {
        if (!gem.world.getBlockState(nextPos.up(y)).getBlock().isTopSolid(gem.world.getBlockState(nextPos.up(y)))) {
          placed=gem.placeBlock(this.bridgeBlock,nextPos.up(y));
          if (placed) {
            this.placeStack.shrink(1);
            if (this.placeStack.isEmpty()) {
              this.getBlock(gem);
            }
          }
 else {
            break;
          }
        }
      }
      gem.tryToMoveTo(nextPos.up(this.height));
      this.stillBuilding=placed;
      this.lastBlockPlace=0;
    }
  }
  ++this.lastBlockPlace;
}

Fixed version (ground truth):
@Override public void run(EntityBismuth gem){
  if (this.lastBlockPlace > 20) {
    if (this.startedBuilding) {
      boolean placed=false;
      BlockPos nextPos=gem.getPosition();
      for (int y=0; y < this.height; ++y) {
        if (!gem.world.getBlockState(nextPos.up(y)).getBlock().isTopSolid(gem.world.getBlockState(nextPos.up(y)))) {
          placed=gem.placeBlock(this.bridgeBlock,nextPos.up(y));
          if (placed) {
            gem.setPosition(nextPos.getX(),nextPos.getY() + y + 1,nextPos.getZ());
            this.placeStack.shrink(1);
            if (this.placeStack.isEmpty()) {
              placed=this.getBlock(gem) && placed;
              if (!placed) {
                break;
              }
            }
          }
 else {
            break;
          }
        }
      }
      this.startedBuilding=false;
      this.stillBuilding=placed;
      this.lastBlockPlace=0;
    }
 else {
      boolean placed=false;
      BlockPos nextPos=gem.getPosition().add(this.direction[0],-this.height,this.direction[1]);
      gem.lookAt(nextPos.add(this.direction[0],0,this.direction[1]));
      for (int y=0; y < this.height; ++y) {
        if (!gem.world.getBlockState(nextPos.up(y)).getBlock().isTopSolid(gem.world.getBlockState(nextPos.up(y)))) {
          placed=gem.placeBlock(this.bridgeBlock,nextPos.up(y));
          if (placed) {
            this.placeStack.shrink(1);
            if (this.placeStack.isEmpty()) {
              this.getBlock(gem);
            }
          }
 else {
            break;
          }
        }
      }
      gem.tryToMoveTo(nextPos.up(this.height));
      this.stillBuilding=placed;
      this.lastBlockPlace=0;
    }
  }
  ++this.lastBlockPlace;
}