Defining an origin in JSON - apace100/origins-fabric GitHub Wiki

Origins are defined in JSON files. Let's use these to create a fictional new origin, a Supermorph, for our data pack which we call OriginSuperPack. We'd like this Origin to be a bit overpowered: Metamorphs are immune to fire, have elytra-flight and can teleport with ender pearls. Their only drawback is that they need a bed at a high altitude, just like Avians. This would be a JSON file which would accomplish that:

{
	"powers": [
		"origins:fire_immunity",
		"origins:elytra",
		"origins:throw_ender_pearl",
		"origins:fresh_air"
	],
	"icon": "minecraft:slime_ball",
	"order": 4,
	"impact": 1
}

This is the JSON file defining our new Supermorph origin. We put it in data/originsuperpack/origins/supermorph.json. In general, the file location should be as follows: data/<namespace>/origins/<path>.json. You can also use the namespace origins and the name of an existing origin, such as avian, in order to override the origin defined by the default mod: data/origins/origins/avian.json.

When you put the file in the correct file structure of a data pack and put it into a world (either when you create the world, or after the world is loaded drag it into the world's datapacks folder), the new origin still does not appear (at least not in v0.3.0 and above)! Why? Layers.

The new origin still needs to be added to the origin layer. Layers are Origins' way of allowing players to have multiple origins. By default, there is only one layer, origins:origin. If you wanted, you could create your own layer and allow players to select a second origin! Here's how to add our origin to the default origin layer though: we need to create a layer file with the same ID of the layer we want to add to. This means our file should be located in data/origins/origin_layers/origin.json. The file content would then look like this:

{
	"replace": false,
	"origins": [
		"originsuperpack:supermorph"
	]
}

replace just tells Origins that we want to add to the already existing layer, instead of replacing it entirely. The origins field meanwhile specifies the IDs of the origins we want to append to the layer. See below for a complete description of the layer format (which is relevant if you want to create your own layer).

Now, our newly created Supermorph origin should show up, along with a nice slimeball icon, in the list.

However, the origin still doesn't display a correct name or description. For that, you'd need to add a resource pack as well, with a translation for the language you're playing in (probably en_us.json):

{
	"origin.originsuperpack.supermorph.name": "Supermorph",
	"origin.originsuperpack.supermorph.description": "The Supermorphs are crazy origins which I created for a tutorial!"
}

Instead of adding these to a resource pack though, which would be required on the client-side, Origins also allows setting a name and description in the datapack. To do that, just add a name and a description field to the JSON file defining your origin!


Here's a description of every key the Origin JSON format:

icon, string: The item ID of the item to use as the icon for this origin in the origin screen.

impact, integer: The impact value of the origin, where 0 = none, 1 = low, 2 = medium, 3 = high.

order, integer: In the origin screen, origins are sorted first by impact, and second by this order value, where lower values come first.

powers, array of strings: IDs of powers which this origin should have. Refer to List of powers for the power IDs.

loading_priority, integer, default = 0: Origins with higher loading priority override origins registered under the same ID with a lower loading priority. Use a value greater than 0 if you want to override origins added by the mod itself.

unchoosable, boolean, default = false: If this is set to true, the origin will not be shown in the origin selection screen and cannot be chosen.

upgrades, array of Upgrade objects, optional: Defines origins this origin will change into when an advancement is reached by the player. (Requires v0.3.0 or later)

name, string, optional: When defined, this is the translation key (or literal text) that will be used as the name of the origin, instead of the default generated one. (Requires v0.3.5 or later)

description, string, optional: When defined, this is the translation key (or literal text) that will be used as the description of the origin, instead of the default generated one. (Requires v0.3.5 or later)

An Upgrade JSON object has the following keys:

condition, string: ID of the advancement which is required for this upgrade to trigger.

origin, string: ID of the origin to upgrade to.

announcement, string: Translation key or literal text which will be displayed for a player who acquires this upgrade.


Here's a complete description of every key in the layer JSON format:

order, integer, default = last: Layers with higher order values will be shown to the player after layers with lower order values when choosing or viewing the origins.

origins, array of strings: IDs of origins which are allowed in the layer.

enabled, boolean, default = true: Whether players can actually have an origin in this layer. Mainly useful for disabling already existing layers.

name, string, optional: When defined, this is the translation key (or literal text) that will be used as the name of the layer, instead of the default generated one.

⚠️ **GitHub.com Fallback** ⚠️