[Demonstration 1]

[Buggy Method]
public void attack(Direction dir) {
    this.canAttack = false;
    Actor targetedEnemy = null;
    if (dir == Direction.UP) {
        for (Actor actor : nearbyActors) {
            if ((actor.getRow() < this.row) && (actor.getCol() == this.col)) {
                if (targetedEnemy != null) {
                    if (actor.getRow() > targetedEnemy.getRow())
                        targetedEnemy = actor;
                } else {
                    targetedEnemy = actor;
                }
            }
        }
    }
    if (dir == Direction.DOWN) {
        for (Actor actor : nearbyActors) {
            if ((actor.getRow() > this.row) && (actor.getCol() == this.col)) {
                if (targetedEnemy != null) {
                    if (actor.getRow() < targetedEnemy.getRow())
                        targetedEnemy = actor;
                } else {
                    targetedEnemy = actor;
                }
            }
        }
    }
    if (dir == Direction.LEFT) {
        for (Actor actor : nearbyActors) {
            if ((actor.getCol() < this.col) && (actor.getRow() == this.row)) {
                if (targetedEnemy != null) {
                    if (actor.getCol() > targetedEnemy.getCol())
                        targetedEnemy = actor;
                } else {
                    targetedEnemy = actor;
                }
            }
        }
    }
    if (dir == Direction.RIGHT) {
        for (Actor actor : nearbyActors) {
            if ((actor.getCol() > this.col) && (actor.getRow() == this.row)) {
                if (targetedEnemy != null) {
                    if (actor.getCol() < targetedEnemy.getCol())
                        targetedEnemy = actor;
                } else {
                    targetedEnemy = actor;
                }
            }
        }
    }
    if (targetedEnemy == null && remainingAmmo > 0)
        missedEnemy = true;
    if ((remainingAmmo > 0) && (targetedEnemy != null)) {
        targetedEnemy.setActive(false);
        killedEnemy = true;
        nearbyActors.clear();
    }
    this.remainingAmmo -= 1;
}

[Buggy Hunk]
this.remainingAmmo -= 1;

[Patch]
if (remainingAmmo > 0) this.remainingAmmo -= 1;

[Demonstration 2]

[Buggy Method]
private void flushActivityDataHolder() {
    GregorianCalendar timestamp = this.activityDataTimestampProgress;
    byte category, intensity, steps;
    for (int i = 0; i < this.activityDataHolder.length; i += 3) {
        category = this.activityDataHolder[i];
        intensity = this.activityDataHolder[i + 1];
        steps = this.activityDataHolder[i + 2];
        GBApplication.getActivityDatabaseHandler().addGBActivitySample((int) (timestamp.getTimeInMillis() / 1000), GBActivitySample.PROVIDER_MIBAND, intensity, steps, category);
        ACTIVITYLOG.info(" timestamp:" + DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() + " category:" + category + " intensity:" + intensity + " steps:" + steps);
        timestamp.add(Calendar.MINUTE, 1);
    }
    this.activityDataHolderProgress = 0;
    this.activityDataTimestampProgress = timestamp;
}

[Buggy Hunk]
for (int i=0; i<this.activityDataHolder.length; i+=3) {

[Patch]
for (int i=0; i<this.activityDataHolderProgress; i+=3) { //TODO: check if multiple of 3, if not something is wrong

[Demonstration 3]

[Buggy Method]
private void trySpawnSticks(World world, BlockPos pos, Random random) {
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    y++;
    int origy = y;
    if (!world.isAirBlock(new BlockPos(x, y, z))) {
        return;
    }
    y++;
    for (int i = 0; i < 15; i++) {
        if (!world.isAirBlock(new BlockPos(x, y, z))) {
            if (isLeafBlock(world.getBlockState(new BlockPos(x, y, z)).getBlock())) {
                world.setBlockState(pos.up(), ModBlocks.sticksBlock.getDefaultState().withProperty(GenericBlock.FACING_HORIZ, EnumFacing.getHorizontal(random.nextInt(4))), 3);
                SticksTE sticksTE = (SticksTE) world.getTileEntity(new BlockPos(x, origy, z));
                sticksTE.setSticks(random.nextInt(6) + 1);
            }
            return;
        }
        y++;
    }
}

[Buggy Hunk]
SticksTE sticksTE = (SticksTE) world.getTileEntity(new BlockPos(x, origy, z));

[Patch]
SticksTE sticksTE = (SticksTE) world.getTileEntity(pos.up());