Apex Upgrading - TinyModularThings/UniqueEnchantments GitHub Wiki

First you'll need this structure:
apex_structure

For this method you only need the Chest on the very top (the other Chests still have to be present, to be detected as correct Structure).
You can only upgrade ONE Enchantment at once.
Put the item to enchant in the first slot and fill the Chest with Enchanted Books you want to use for this process.
The Enchantment that will be upgraded is the one with the highest Collective Level.
It will calculate all Enchantments down to how many Level 1 Books you'd have of said Enchantment and scale it up.
To increase a level you need 4 of the same level.
This means:
Using 4x Power 5, will grant you 1x Power 6.
Using 16x Power 4, will grant you 1x Power 6.
Using 14x Power 4, will grant you 1x Power 5.

You will also need a bit of experience for this process, these cost scale with multiple factors, most notably Rarity.
However while initiating you will be notified if you do not have enough EXP (it uses Experience Points, not Experience Levels).
To now initiate the process you have to interact with the chest at the very top with a Totem of Undying.

Mathematical Explanation:

The general formula for the points an enchantment is worth is: 4^level Situation, you have 1x Power 5.
4^5 = 1024
Situation, you want 1x Power 6.
4^6 = 4096
To reach Power 6 in this situation, you'd need 4x Power 5 to have the required Points(4096/1024 = 4).

Situation, you have amassed many books and want to combine these for higher level enchantments, to be exact 27x Power 4.
4^4 = 256
256 * 27 = 6912
How does it now figure out which level to grant? Formula: floor(log4(totalPoints)) = level
floor means it will always round DOWN (4.6 -> 4).
log4(6912) = 6.37744375108
floor(log4(6912)) = 6
In this scenario you'd lose the some points, because you do not have enough for the next level.

Situation, you want to know how many books you need, to reach lvl 5 with lvl 2 books.
4^5 = 1024
4^2 = 16
1024/16 = 64
Using only vanilla Chest, such step is not possible(because a Vanilla Chest has 27 slots).

Creating an Apex Upgrading Recipe

{
    "type": "uniqueapex:fusion_upgrade",
    "ingredients": [
        {
            "input": { "item" : "minecraft:stone" },
            "amount": 64
        },
        {
            "input": { "tags" : "forge:gems/quartz" },
            "amount": 32
        },
        {
            "input": { 
		"type": "forge:nbt",
		"item": "minecraft:potion",
		"nbt": { "Potion": "minecraft:strong_regeneration"}
	    },
            "amount": 1
        }
    ]
    "target": "minecraft:fortune",
    "xp": 300, //Defaults to 0
    "books": 2, //defaults to 4
    "maxLevel": 10 //defaults to 10
}

ingredients is the item cost per Chest, this can be and is by default empty.
target is the enchantment in question to be upgraded.
xp is the base xp cost, which is added to the exp cost from calculation.
books how many copies of the Enchantment are required to upgrade it.
maxLevel the maximum level the enchantment can become by this.