[Demonstration 1]

[Buggy Method]
@Override
public boolean doSpell(Player p, Nations n) {
    if (p.getHealth() < p.getMaxHealth()) {
        p.sendMessage(msgText);
        return true;
    }
    return false;
}

[Buggy Hunk]
p.sendMessage(msgText);

[Patch]
p.setHealth(p.getMaxHealth());

[Demonstration 2]

[Buggy Method]
@Override
protected Slot createSlot(SlotFactory slotFactory, IInventory inventory, int index, int x, int y, SlotType slotType) {
    if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT) {
        return new BaseSlot(inventory, index, x, y) {

            @Override
            public boolean isItemValid(ItemStack stack) {
                if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(), stack)) {
                    return false;
                }
                return super.isItemValid(stack);
            }
        };
    }
    return super.createSlot(slotFactory, inventory, index, x, y, slotType);
}

[Buggy Hunk]
if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT) {

[Patch]
if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT && slotType == SlotType.SLOT_INPUT) {

[Demonstration 3]

[Buggy Method]
public int getIndexFromCoordinate(int x, int y) {
    int row = getColOrRowFromCoordinate(y + mScroll);
    int col = getColFromCoordinate(row, x);
    // touch is between columns or rows
    if (col == -1 || row == -1) {
        return -1;
    }
    int index = 0;
    index = row * COL_COUNT + col;
    if (mUseMainTiles) {
        // If we click on (0, 2) and are using main tiles, that
        // position is empty
        if (row == 0 && col == COL_COUNT - 1) {
            return -1;
        }
        // There is one tile less from row > 0
        if (row > 0) {
            index--;
        }
    }
    if (index > getChildCount()) {
        return -1;
    }
    return index;
}

[Buggy Hunk]
if (index > getChildCount()) {

[Patch]
if (index >= getChildCount()) {