Skip to content

Offerings

Sky James edited this page Aug 20, 2022 · 2 revisions

"Offerings" are favor events that are triggered when the player interacts with an altar while holding an item. If the offering is accepted, the item is taken from the player and they may gain/lose favor or receive a different item in return.

Data

Each offering is defined as a JSON file located at data/[namespace]/deity/offering/[deity_name]/[offering_name].json. The namespace and deity_name indicate which deity can accept the offering. The offering_name is not important but must be unique to that deity.

The JSON file can specify:

  • item (Item Stack or Item ID): the item to accept. If not defined, the offering will not do anything. NBT data is mostly ignored, except for enchantments.
  • favor (number): the amount of favor to add or remove from the player when they offer this item. Optional. Defaults to 0.
  • trade (Item Stack or Item ID): an item to give to the player when this offering is accepted. If trade is the same as item, then the two items have their NBT data and enchantments merged. Otherwise, trade is the item to give directly to the player when the offering item is removed. Optional.
  • minlevel (number): the minimum favor level for an offering or trade. Optional. Defaults to -2147483648.
  • maxlevel (number): the maximum favor level for an offering or trade. Optional. Defaults to 2147483647.
  • maxuses (number): the number of offerings to accept before "locking" this offering. Optional. Defaults to 16
  • restocks (number): the number of restocks until the offering is locked forever. Optional. Defaults to -1 which results in infinite restocks.
  • cooldown (number): the number of ticks before this offering becomes "unlocked" again. Optional. Defaults to 12000
  • function (ID): an MC function to execute when this offering is accepted. Optional.
  • function_text (string): a translation key to use in the tooltip text that describes the function. Optional. Defaults to the text "Something special may happen when you offer this item"

Example

This offering is located at data/greek/deity/offering/aphrodite/apple.json and does the following when the player right-clicks on an Altar to Aphrodite while holding an apple:

  • The apple is removed
  • The player gains 4 favor points with greek:aphrodite
  • Because maxuses and cooldown are not defined, the sacrifice will become locked for 12000 ticks after the player offers 16 apples.
{
  "item": "minecraft:apple",
  "favor": 4
}

This offering is located at data/greek/deity/offering/zeus/iron_to_clear.json and does the following:

  • If the player is below favor level 9 with greek:zeus, nothing will happen. If they are at least level 9:
    • The iron block that the player is holding will be removed
    • No trade item will be given because the trade is empty
    • Removes 10 favor with greek:zeus
    • Because maxuses is 1, the offering will be placed on cooldown for 12000 ticks after being used once.
    • Executes a function at greek:set_clear with tooltip text located in the localization file at perk.function.set_clear
{
  "item": "minecraft:iron_block",
  "trade": {
    "id": "minecraft:air",
    "Count": 0
  },
  "favor": -10,
  "minlevel": 9,
  "function": "greek:set_clear",
  "maxuses": 1,
  "cooldown": 12000,
  "function_text": "perk.function.set_clear"
}
Clone this wiki locally