Datapack Configuration - endorh/aerobatic-elytra GitHub Wiki
Besides recipes, the Aerobatic Elytra mod exposes several extension points to datapacks.
In order to promote these features, document them, and provide quick templates, this mod includes some example bundled datapacks, which can be easily installed by using 2 commands, which are only available for operators:
-
/aerobaticelytra datapack install <name>
installs the specified datapack in the server, by extracting its files from the mod jar and copying them into thedatapacks
folder of the server. -
/datapack enable <name>
which is the vanilla command to enable the now available datapack.
You can use the first command in single player worlds with cheats enabled to easily get yourself a local copy of these datapacks, or directly browse their source.
Tip
All bundled datapacks are covered more in the respective page.
Datapacks can always edit recipes. However, Aerobatic Elytra introduces a few recipe types, with their own JSON spec.
These recipes can be performed by sneak-using a whole stack with the Elytra in the offhand, in addition to the crafting table, as they only use one ingredient. This makes it possible to apply the same recipe multiple times (using the whole stack).
These recipes always consume the ingredient item, and modify the abilities of the Aerobatic Elytra. As such, they don't have a result, and specifying multiple ingredients means all of them are valid ingredients for the recipe, but only one of them is required.
The JSON spec for upgrade recipes contains two attributes:
-
type
:aerobaticelytra:upgrade_recipe
-
ingredients
list of item selectors -
upgrades
list of upgrade descriptors-
type
name of the ability modified by the upgrade -
expression
mathematical expression to compute the new value
-
Derived from LazuLib's NBT inheriting shaped recipe, also preserving Aerobatic Elytra abilities in addition to NBT data.
It's like a regular shaped recipe, extended with the option to inherit NBT data and Elytra abilities from certain marked source ingredients.
The JSON spec is:
-
type
:aerobaticelytra:ability_nbt_inheriting_shaped_recipe
-
pattern
crafting grid pattern, similar to shaped recipes, but uppercase letters denote NBT/ability source ingredients -
allow_unknown_items
forgive unknown items in the recipe if at least one is known (useful to have the same recipe be compatible with missing mods) -
key
similar to shaped recipes, but using the uppercase/lowercase frompattern
-
result
similar to shaped recipes, but with the following extra tags-
tag
JSON NBT tag for the result item, which overrides NBT from the source ingredients -
abilities
map of ability names to their values, which override abilities from the source ingredients
-
Can include items required to split the Aerobatic Elytra into two wing items. The recipe is always shapeless, and leaves the left wing in the crafting bench as a result.
In the JSON, you may specify any number of items required for the recipe, as well as if they are left in the crafting bench and the damage they take by applying the recipe. By default, you split Aerobatic Elytras using shears, which receive one point of damage in the process.
The JSON spec is:
-
type
:aerobaticelytra:split_recipe
-
ingredients
list of ingredient descriptors, with the following additional properties-
leave
boolean to leave the item in the crafting grid after applying the recipe -
damage
integer amount of damage applied to the ingredient (only relevant ifleave
is true)
-
This is a special recipe type that enables datapacks to customize the Aerobatic Elytra items available in the creative inventory menu, though you may use it for any other items.
The JSON spec is:
-
type
:aerobaticelytra:creative_tab_ability_set
-
item
item ID -
group
group ID of the inventory tab, such astransportation
orredstone
-
abilities
map of ability names to their values
This recipe type allows you to specify items which can be used to repair Aerobatic Elytras in an anvil.
The JSON spec is:
-
type
:aerobaticelytra:repair_recipe
-
ingredient
ingredient descriptor
Additionally, it also introduces a few singleton recipe types for special recipes, which have no JSON parameters. The only thing you can do with these is replacing their associated recipes with an empty JSON to disable them:
Recipe Type | Associated Recipe | Description |
---|---|---|
aerobaticelytra:banner_recipe |
aerobatic_elytra_banner_recipe.json |
Imprint banner patterns into Aerobatic Elytras |
aerobaticelytra:crafted_upgrade_recipe |
aerobatic_elytra_crafted_upgrade_recipe.json |
Apply Upgrade Recipes in a crafting table |
aerobaticelytra:dye_recipe |
aerobatic_elytra_dye_recipe.json |
Combine an Aerobatic Elytra with dyes |
aerobaticelytra:join_recipe |
aerobatic_elytra_join_recipe.json |
Join two Aerobatic Elytra wings back together |
aerobaticelytra:trail_recipe |
aerobatic_elytra_trail_recipe.json |
Change the trail of an Aerobatic Elytra with rockets |
Aerobatic Elytra exposes a new loot table, allowing datapacks to replace the elytra item generated at End Ships.
This loot table is named end_ship_elytra.json
and is of type minecraft:chest
, but since the result is placed in an item frame, only the first loot roll is taken, and its stack size is forced to 1.
The default for this loot table simply includes a single entry pool for the vanilla elytra with a weight of 100.
The mod also adds a few loot conditions, which may be used in the above loot table, or as activation predicates for the abilities described later on.
-
aerobaticelytra:origin_distance
-
min
minimum distance to satisfy the condition -
max
maximum distance to satisfy the condition
-
-
aerobaticelytra:aerobatic_flying
true when the loot context entity is flying aerobatically (no parameters) -
aerobaticelytra:elytra_flying
true when the loot context entity is flying with elytra (in any mode) (no parameters) -
aerobaticelytra:submerged
true when the loot context entity is submerged (eye level is inside) in a fluid-
fluid
fluid ID
-
In order to set abilities of elytras generated with loot tables, the mod also introduces an aerobaticelytra:set_abilities
loot function, which takes as arguments any ability name mapped to its value.
For example, this function is used in the bundled datapack that generates Aerobatic Elytras on end ships, in its end_ship_elytra.json
loot table.
Datapacks may also define their own Aerobatic Elytra Effect Abilities, configuring their default value, display name and color, and being able to define conditional potion effects granted by Elytras with the ability.
The ability can define a set of potion effects applied, and a list of loot conditions that must be met for the effects to apply.
Effect abilities are defined as JSON objects with type
of aerobaticelytra:effect
within the aerobatic-elytra-abilities
resource path (single directory). Their JSON spec is:
-
id
an identifier without space characters, to be used in mathematical expressions for upgrades -
color
optional text color name for the ability name when displayed on tooltips and other UI -
default
numerical default value (defaults to 0) -
effects
map of potion effect IDs to their options-
amplifier
the amplifier of the effect - the duration option cannot be configured, as the effect is applied for as long as the loot conditions match
-
-
conditions
list of loot conditions that must all match with the player as context to apply the effect