Skip to content

Datapack: Bargain

Tictim edited this page Mar 24, 2026 · 4 revisions

Bargain is UI-based exchange system used by Goddess Statues and Horned Statue. Most parts of the bargain system can be controlled by datapacks, not just adjusting individual recipes but creating entirely new set of catalog, separate from Paraglider's content.

Bargain recipe

Each bargain recipe adds one entry to the set bargain catalog. Bargain recipes have list of demands and offers, which can be an item, Heart Container, Stamina Vessel, or Essence (player bound pseudo-currency used by Horned Statue).

JSON Format Static Badge

{
  "type": "paraglider:statue_bargain",

  "bargainType": "paraglider:horned_statue", // valid bargain type ID

  "demands": { // optional
    // 0 or more
    "items": [ // optional
      {
        "ingredient": { // ingredient
          "tag": "c:gems/emerald"
        },
        "quantity": 6
      }
    ],
    "heartContainers": 1, // optional
    "staminaVessels": 1, // optional
    "essences": 1 // optional
  },

  "offers": { // optional
    // 0 or more
    "items": [ // optional
      {
        "item": { // item stack
          "id": "minecraft:emerald"
        },
        "quantity": 5
      }
    ],
    "heartContainers": 1, // optional
    "staminaVessels": 1, // optional
    "essences": 1 // optional
  }
}

JSON Format Static Badge

{
  "type": "paraglider:statue_bargain",

  "bargainType": "paraglider:horned_statue", // valid bargain type ID

  "demands": { // optional
    // 0 or more
    "items": [ // optional
      {
        "ingredient": { // ingredient
          "item": "minecraft:emerald"
        },
        "quantity": 6 // optional, default: 1
      }
    ],
    "heartContainers": 1, // optional
    "staminaVessels": 1, // optional
    "essences": 1 // optional
  },

  "offers": { // optional
    // 0 or more
    "items": [ // optional
      {
        "count": 5,
        "item": "minecraft:emerald" // item ID
      }
    ],
    "heartContainers": 1, // optional
    "staminaVessels": 1, // optional
    "essences": 1 // optional
  }
}

Bargain type

A bargain type denotes a unique type of bargain recipe catalog. When the bargain UI is opened, the game uses ID of the bargain type to choose the right recipes for the catalog.

Adding a new bargain type needs a JSON file at location [datapack namespace]/paraglider/bargain_types/[bargain type name].json. The corresponding ID of the bargain type will be [datapack namespace]:[bargain type name]. Subdirectories are also valid location.

  • For example, JSON file of default bargain type paraglider:goddess_statue is located at paraglider/paraglider/bargain_types/goddess_statue.json.

JSON Format

{
  "dialog": {
    "initial": [ {/*...*/} ], // bargain dialog, 0 or more
    "success": [ {/*...*/} ], // bargain dialog, 0 or more
    "fail": [ {/*...*/} ], // bargain dialog, 0 or more

    "initial_fallback": {/*...*/}, // bargain dialog, optional
    "success_fallback": {/*...*/}, // bargain dialog, optional
    "fail_fallback": {/*...*/}, // bargain dialog, optional
  }
}

Bargain dialog

Bargain type also contains dialog information for the UI. The dialogs are divided into three categories, each corresponding to three contexts dialog is displayed:

  • Initial (on UI open) dialog,
  • on-success dialog,
  • and on-fail dialog.

A single dialog have four components:

  • Text component,
  • random weight,
  • set of "bargain recipe tags,"
  • and set of "bargain failure reasons."

Each time a bargain dialog is displayed, one dialog entry is chosen randomly from the list. For on-success context, only entries that matches the bargain recipe tags will be included. For on-fail context, bargain failure reasons will be checked in addition to tags.

If no dialog matches the condition, fallback dialog is displayed, if exists. Fallback dialog ignores conditional checks.

List of bargain recipe tags

Bargain recipe has a set of strings that describe the property of the recipe for dialogs. This system is not related to registry tags.

Recipe tags are checked in on-success and on-fail dialog context. Dialog will only get displayed if all tags specified in the dialog are included in the recipe's tags.

Below is a list of tags used in bargain recipe.

String Description
consumes_item Bargain has item as one of its demands
consumes_heart_container Bargain has Heart Container as one of its demands
consumes_stamina_vessel Bargain has Stamina Vessel as one of its demands
consumes_essence Bargain has Essence as one of its demands
gives_item Bargain has item as one of its offers
gives_heart_container Bargain has Heart Container as one of its offers
gives_stamina_vessel Bargain has Stamina Vessel as one of its offers
gives_essence Bargain has Essence as one of its offers

Also note that, for custom bargain recipes, it is possible for other strings to be used as tags.

List of bargain failure reasons

Bargain failure reasons are checked in on-fail dialog context. After the user tries to bargain and fails, the UI will try to display a dialog that is relevant for the interaction.

Bargain failure reasons describe "reasons" behind missing criteria for successful bargain, such as missing item or Heart Container. Dialog will only get displayed if all reasons specified in the dialog are included in the set of failure reasons.

Below is a list of tags returned by bargain recipe.

String Description
not_enough_items Not enough items
not_enough_hearts Not enough Heart Containers
not_enough_stamina Not enough Stamina Vessels
not_enough_essences Not enough Essences
heart_full Reached max. number of Heart Containers (as specified in config)
stamina_full Reached max. number of Stamina Vessels (as specified in config)
essence_full Reached max. number of Essences (hardcoded number of 2147483647)

Also note that, for custom bargain recipes, it is possible for other strings to be used as reasons.

Example

Let's look into how dialog selection works with an example.

{ // bargain type
  "dialog": {
    "fail": [
      {
        "dialog": { "text": "A" }
      },
      {
        "dialog": { "text": "B" },
        "reason": [ "not_enough_items" ]
      },
      {
        "dialog": { "text": "C" },
        "reason": [ "not_enough_hearts" ]
      },
      {
        "dialog": { "text": "D" },
        "reason": [ "not_enough_items", "not_enough_hearts" ]
      }
    ],

    "fail_fallback": {
      "dialog": { "text": "E" }
    }
  }
}

{ // bargain recipe
  "demands": {
    "items": [
      {
        "ingredient": { "item": "minecraft:diamond" },
        "quantity": 1
      }
    ],
    "heartContainers": 1,
    "staminaVessels": 1
  },

  "offers": {
    // ...
  }
}

If a player has no Heart Containers and no diamonds:

  • Dialog A can be displayed, since it has no conditions.
  • Dialog B can be displayed, since the failure reason has not_enough_items.
  • Dialog C can be displayed, since the failure reason has not_enough_hearts.
  • Dialog D can be displayed, since the failure reason has both not_enough_items and not_enough_hearts.
  • Dialog E can't be displayed, since at least one non-fallback dialog is valid.

If a player has no Heart Containers, but a diamond:

  • Dialog A can be displayed, since it has no conditions.
  • Dialog B can't be displayed, since the failure reason doesn't have not_enough_items.
  • Dialog C can be displayed, since the failure reason has not_enough_hearts.
  • Dialog D can't be displayed, since the failure reason has not_enough_hearts but not not_enough_items.
  • Dialog E can't be displayed, since at least one non-fallback dialog is valid.

If a player has a Heart Container and a diamond, but no Stamina Vessels:

  • Dialog A can be displayed, since it has no conditions.
  • Dialog B can't be displayed, since the failure reason doesn't have not_enough_items.
  • Dialog C can't be displayed, since the failure reason doesn't have not_enough_hearts.
  • Dialog D can't be displayed, since the failure reason doesn't have not_enough_items nor not_enough_hearts.
  • Dialog E can't be displayed, since at least one non-fallback dialog is valid.

JSON Format

{
  "dialog": { // text component
    "translate": "bargain.dialog.goddess_statue.failure.not_enough_items.0"
  },
  "weight": 1, // optional, default: 1
  "tag": [ // bargain recipe tags, optional
    "gives_heart_container"
  ],
  "reason": [ // bargain failure reasons, optional
    "not_enough_items"
  ]
}

Clone this wiki locally