Amadron and Datapacks - TeamPneumatic/pnc-repressurized GitHub Wiki

Amadron and Datapacks

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.

JSON format

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 static field must be present, and may be true (offer always appears in the Amadron tablet), or false (offer appears at random intervals).
  • The input and output fields must be present, and must contain a type field which is either ITEM or FLUID.
    • The id field must be the registry name of an item or fluid, respectively.
    • The amount field is optional and defaults to 1.
  • The level field may be present and defaults to 1 if omitted. It is ignored when static is true (you may also see a level: 0 in this case). When static is 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 Amadron section in config/pneumaticcraft-common.toml.

Level rarities table:

  • 1: 50%
  • 2: 25%
  • 3: 15%
  • 4: 7%
  • 5: 3%

Item NBT

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.

Player Filtering

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 whitelist or blacklist
  • At least one key (e.g. dimensions, biome_categories ...) must be specified
  • Keys are combined with either and or or, with the obvious meaning
    • If you only specify one key, then the logical operator doesn't matter (but must still be used)
  • The dimensions and biome_categories matchers 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 gamestages matcher 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.

Non-Datapack Offers

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 level is 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) or world/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.
⚠️ **GitHub.com Fallback** ⚠️