Abilities and Upgrades - endorh/aerobatic-elytra GitHub Wiki

The Aerobatic Elytra items use some special NBT values to affect their individual flight capabilities. This mod calls them abilities, and uses them for various purposes. For example, Fuel is an ability that tracks how much fuel your Elytra has left.

These abilities are edited by a special type of recipe, upgrade recipes.

Abilities

Abilities can be seen in the item tooltip of an Aerobatic Elytra while holding the Alt button.

Abilities in Aerobatic Elytra tooltip

This system is mainly intended to support extension through datapacks, as well as other mods, but some core features of the mod are implemented with abilities.

[!NOTE] If a mod/datapack adds an ability but is later unloaded/removed, its abilities are preserved, so adding back the same mod/datapack in the future won't cause the elytras to forget their abilities of that mod/datapack.

Core abilities

The following abilities are defined by the mod:

  • Fuel (Fuel): Is consumed when using thrust
  • Fuel Capacity (MaxFuel): Determines how much fuel the elytra can store at once
  • Speed (Speed): Determines max thrust strength
  • Lift (Lift): Makes it easier to maintain altitude and stability while flying
  • Aquatic (Aquatic): Enables underwater flight
  • Trail (Trail): Increases trail length (cosmetic)
  • Rocketless (Rocketless): Hides the rockets from the elytra model (cosmetic)

Effect abilities

Datapacks may create their own abilities, which can provide arbitrary potion effects to players with the Elytra, when certain loot conditions are satisfied.

One of the bundled datapacks provides two example effect abilities, granting players that fly underwater temporary water breathing or night vision, as long as they're using the Elytra. The datapack also includes upgrade recipes to add said abilities to already existing Elytras.

[!TIP] You may easily install this datapack with just two commands (see bundled datapacks).

Mod abilities

Other mods can register their own abilities. For example, the Aerobatic Elytra Jetpack mod, provides Jetpack, Hover, Hover Mining abilities, as well as several abilities related to jetpack dashes.


Editing Abilities with Commands

Abilities can be edited with the operator command /aerobaticelytra ability set. The command targets an entity and modifies the abilities of their currently worn Elytra.

There are also get, remove and reset commands, and an unknown command which may be used to edit unknown abilities (belonging to unloaded mods/datapacks).

Upgrades

The main way to modify Aerobatic Elytra abilities is through the so called Upgrade Recipes, which have their own tab in JEI.

Upgrade recipes consist of a single ingredient, which is merged with the Elytra.

[!IMPORTANT] Unlike regular recipes, when you apply an upgrade recipe, if multiple recipes apply to the ingredient, all of them are applied in succession (All the effects are combined).

Applying Upgrade recipes

Since you may want to apply the same upgrade recipe many times in a row (for example, adding fuel with firework rockets), there are two ways to apply upgrade recipes.

  • Bulk mode: By holding the Elytra in your offhand and using the ingredient item in the air while sneaking (Shift + Right Click). This applies the recipe as many times as possible, which is useful if you want to use a whole firework rockets stack as fuel.
  • Craft mode: By placing the ingredient item above the Aerobatic Elytra in a crafting bench. This is slower, because you can only use one ingredient item at a time, but plays well with mods that add auto-crafting to the game.

[!NOTE] When applying a recipe with sneak right click (bulk mode), the recipe won't consume more items if they don't modify the result, so you don't need to split your stack exactly to not waste rockets when refueling.

For recipes that toggle some ability between 0 and 1, the recipe won't consume more items if their result would be equal to the state of the Elytra before the upgrade.

Applying an Upgrade Recipe in bulk mode

[!NOTE] It's important you remember to sneak-use the ingredient item in the air to apply an upgrade in bulk mode. Otherwise you may actually use the ingredient item on the block you're looking at (most commonly, launch a firework rocket by accident).

Complex Upgrades

Upgrade recipes may have more complex requirements than regular recipes, using NBT predicates that allow, for example, to have different recipes depending on a Firework Rocket's flight duration. You can see the exact requirements for an upgrade recipe by hovering the + symbol of the recipe in its JEI tab.

[!TIP] Upgrade recipes use LazuLib's NBT Predicates, which can be pretty complex, and have their own documentation.

Upgrade Recipe NBT predicates

Instead of having item results, upgrade recipes only modify the abilities of the upgraded Elytra, and they can do so applying arbitrary math expressions to the current abilities of the Elytra. The exact definition of an upgrade recipe can be seen by hovering the symbol of the recipe in its JEI tab.

[!TIP] Upgrade recipes use LazuLib's Unicode Math expressions, which can also be pretty complex and have their own documentation.

Upgrade Recipe Expression

[!NOTE] Many upgrades define minimum and maximum values separately to their expression, which are also displayed while hovering the arrow in JEI.

Upgrade Recipe Expression bounds

[!TIP] You may preview the exact effects of an upgrade recipe on a concrete elytra in the JEI tab, by inspecting the result item.

Upgrade Recipe Preview