Amadron and Datapacks - TeamPneumatic/pnc-repressurized GitHub Wiki
As of 1.15.2, the Amadron system has moved to using datapacks for all core Amadron trades. You can add or modify Amadron offers by adding JSON files to your datapack, under data/<MODID>/recipes/amadron/.
See https://github.com/TeamPneumatic/pnc-repressurized/tree/1.20.1/src/generated/resources/data/pneumaticcraft/recipes/amadron for the default Amadron offers added by the mod.
The type field is mandatory and must be pneumaticcraft:amadron.
Example offer:
{
"type": "pneumaticcraft:amadron",
"static": true,
"input": {
"type": "ITEM",
"id": "minecraft:emerald",
"amount": 8
},
"output": {
"type": "ITEM",
"id": "pneumaticcraft:pcb_blueprint",
"amount": 1
},
"level": 0
}- The
staticfield must be present, and may betrue(offer always appears in the Amadron tablet), orfalse(offer appears at random intervals). - The
inputandoutputfields must be present, and must contain atypefield which is eitherITEMorFLUID.- The
idfield must be the registry name of an item or fluid, respectively. - The
amountfield is optional and defaults to 1.
- The
- The
levelfield may be present and defaults to 1 if omitted. It is ignored whenstaticis true (you may also see alevel: 0in this case). Whenstaticis false, the level defines the rarity of the trade's appearance; 1 being common, and 5 being very rare.
20 (by default) non-static trades are randomly chosen from the available list of all trades once per Minecraft day (by default). The level of each trade is a weighted random, according to the table below.
- Both the reshuffle time and the number of periodic trades are configurable in mod config; see the
Amadronsection inconfig/pneumaticcraft-common.toml.
Level rarities table:
- 1: 50%
- 2: 25%
- 3: 15%
- 4: 7%
- 5: 3%
Custom NBT data for input and output items is supported. Use the standard Minecraft SNBT syntax for specifying NBT, e.g. this excerpt from an offer defines an Enchanted Book with Fortune III:
"output": {
"type": "ITEM",
"id": "minecraft:enchanted_book",
"amount": 1,
"nbt": "{StoredEnchantments:[{lvl:3s,id:\"minecraft:fortune\"}]}"
},You may have to escape any embedded quote marks (") in the NBT data, since it's in turn being embedded in a JSON string.
If in doubt about syntax, it may be useful to add the item of interest as a player offer in a test world, and view the resulting saved offer in saves/<world-name>/pneumaticcraft/AmadronPlayerOffers.cfg.
This is a feature only supported in 1.16.5+ (2.14.3 and later). Offers can be limited by properties of the player using the tablet. They can be whitelisted or blacklisted by a combination of the player's current dimension ID and/or biome category by default, and potentially by other properties too; as of 2.14.5, Gamestages stages are supported. API exists to register custom player filters.
Example whitelisted offer - trading diamonds for lava, but only if the player is in a "river" biome AND in the overworld:
{
"type": "pneumaticcraft:amadron",
"static": true,
"input": {
"type": "ITEM",
"id": "minecraft:diamond",
"amount": 1
},
"output": {
"type": "FLUID",
"id": "minecraft:lava",
"amount": 1000
},
"level": 0,
"maxStock": 5,
"whitelist": {
"and": {
"dimensions": [ "minecraft:overworld" ],
"biome_categories": [ "river" ]
"gamestages": { "any": [ "stage1", "stage2" ] }
}
}
}- You can specify
whitelistorblacklist - At least one key (e.g.
dimensions,biome_categories...) must be specified - Keys are combined with either
andoror, with the obvious meaning- If you only specify one key, then the logical operator doesn't matter (but must still be used)
- The
dimensionsandbiome_categoriesmatchers take a list of dimension names or biome tags, respectively; this is implicitly an "any" match, since the player can be in only one dimension or biome at a time. - The
gamestagesmatcher takes an"any": [ ... ]or"all": [ ... ]argument, where you can give one or more stage names that the player must have. This can be "any" or "all" since a player can have multiple stages active. - A valid list of biome categories can be found on the official Minecraft Wiki (see the category tag)
- As of 2.14.5, custom matchers can be registered via API. Builtin matcher keys are
pneumaticcraft:dimensions,pneumaticcraft:biome_categories, and (if Gamestages is installed)pneumaticcraft:gamestages. Matcher keys are resource locations, e.g. "pneumaticcraft:dimensions", but if the namespace is omitted, "pneumaticcraft" is the default, so a plain "dimensions" will also work, as in the example above.
The Amadron Tablet GUI will show an icon and extra tooltip data for offers which are location-limited in this way.
There are two other types of offer which do not come from the datapack:
- Villager trades. PNC:R will scan all villager trades at startup and add non-static offers for each trade it finds. The offer
levelis taken from the villager trade level, so level 5 villager trades can appear at random, but very rarely. - Player <-> Player trades. These are added by players via the Amadron Tablet GUI. Such offers are stored separately per-world, under
saves/<world>/pneumaticcraft/AmadronPlayerOffers.cfg(SSP) orworld/pneumaticcraft/AmadronPlayerOffers.cfg(SMP); this is also a JSON file. These trades are static, and always appear in the tablet. Offers in this file are in a format similar to the above, but have several extra fields needed for tracking these trades. In general, you should not directly edit this file. If you need to, stop the server first, then edit the file, then restart the server.