Values
Facts the world supplies at the moment of speaking, arriving as ordinary translation arguments so a translator can put them anywhere.
Values are listed under with, and arrive in the line as translation arguments in that order.
{
"pages": [ { "translate": "mypack.golem.count" } ],
"with": [ { "value": "villagers", "radius": 32.0, "age": "adult" } ]
}{ "mypack.golem.count": "I keep %s of them. All of them, every night." }That says "I keep seven of them." Because they are arguments rather than text spliced into the sentence, a translator can put the number wherever their own language wants it.
with sits on the dialogue, on a variant, on a choice, or on a murmur line. A variant names its own rather than inheriting the file's.
The list
| Value | Fields | Gives |
|---|---|---|
player_name | none | Whoever is being spoken to. |
speaker_name | none | Whoever is talking, by the same name the panel is headed with. |
times_spoken | today=false, + number style | How often they have come to this speaker. |
villagers | radius=48, age=any, + number style | How many are within the speaker's sight. radius is 1 to 128. |
neighbour | professions (list), radius=48 | The nearest of that trade, by name. |
item | item, components, icon=true | An item's icon and name. Pointing at either in the panel shows its tooltip. |
sprite | sprite | A small image, such as a heart or a quest mark. |
age on villagers is any, adult or child.
Numbers arrive as words
"…seven" is a sentence. "…7" is a debug readout. Any value that counts therefore spells itself out, up to ninety-nine, after which it falls back to figures.
Three fields adjust that, on any counting value:
| Field | Default | Does |
|---|---|---|
digits | false | Figures instead of words. For a ledger, a price, a tally on a board. |
capitalize | false | For a number that begins a sentence. |
off_by | 0 | Shifts the number reported. For a speaker who counts badly on purpose. |
{ "value": "villagers", "radius": 32.0, "capitalize": true }off_by is for characterisation: a speaker who is sure there are eleven of them, and just as sure there are nine two lines later, is a person.
neighbour
Names the nearest villager of a given trade.
{
"pages": [ { "translate": "mypack.villager.neighbours", "fallback": "%s is about, if you need them." } ],
"with": [
{
"value": "neighbour",
"professions": [ "minecraft:farmer", "minecraft:librarian", "minecraft:cleric" ],
"radius": 48.0
}
]
}Where nobody of that trade is within reach, the line still has to say something, so it falls back to a vague phrase rather than a blank.
Pair it with `village_has`
Put a village_has condition over the same trades on the line that uses neighbour, and a line that names somebody is only ever given where there is somebody to name.
Values that choose the line
Values listed under key fill the %s in the translation key, not in the sentence. One line can then pick from a whole grid of lines:
{
"pages": [ { "translate": "mypack.merc.%s.%s.greeting" } ],
"key": [ { "value": "mymod:temper" }, { "value": "mymod:trade" } ]
}{
"mypack.merc.surly.sapper.greeting": "Mines are dug. Talk is not.",
"mypack.merc.cheerful.sapper.greeting": "Powder's dry and so am I. What do you need?"
}mymod:temper and mymod:trade stand for values a mod registers.
key sits wherever with does, and you can give both: key picks the line and with fills the blanks in it.
- Each value's text goes into the key as it is. A counting value needs
"digits": true, or the key becomesmypack.merc.seven. - Icons are left out of a key, so an
itemvalue gives only its name. - A key with more
%sthan values does not resolve, and the player sees the key itself.
Build the key here, not in your own code. A key your code translates is translated in the server's language, so every player gets English. A key built here stays a key, and each client looks it up in its own language.
Values in the speaker's name
A dialogue's with and key fill its pages only. A choice has its own for its label. For speaker, use speaker_with and speaker_key. They work the same way. To put a title before the name the speaker already has:
{
"speaker": { "translate": "mypack.guard.title" },
"speaker_with": [ { "value": "speaker_name" } ],
"pages": [ { "translate": "mypack.guard.greeting" } ]
}{ "mypack.guard.title": "Guard %s" }This shows "Guard Sydney". speaker_name is the entity's own name: its name tag, a name from a naming mod, or else its type. It never reads the file's speaker.
Without a lang file, "speaker": { "translate": "Guard %s" } works too: Minecraft shows the key itself when it has no translation.
Needs RPG Dialogue 1.0.10 or later.
Values in a choice
A choice takes its own with and key, which fill its label:
{
"label": { "translate": "mypack.smith.hand_over", "fallback": "Hand over %s" },
"with": [ { "value": "item", "item": "minecraft:diamond" } ],
"requires": [ { "condition": "has_items", "item": "minecraft:diamond" } ],
"actions": [ { "type": "take_item", "item": "minecraft:diamond" } ]
}The answer reads "Hand over Diamond", with the diamond's icon before its name. Labels are filled each time the answers are sent. Choices written for a slot take them too.
Needs RPG Dialogue 1.1.0 or later.
item
Names an item, with its icon before the name. Pointing at the icon or the name in the panel shows the item's tooltip, as in chat.
{
"pages": [ { "translate": "mypack.smith.bring", "fallback": "Bring me %s and %s is yours." } ],
"with": [
{ "value": "item", "item": "minecraft:diamond" },
{
"value": "item",
"item": "minecraft:iron_sword",
"components": {
"minecraft:item_name": "\"Kingsbane\"",
"minecraft:enchantments": { "levels": { "minecraft:sharpness": 3 } }
}
}
]
}| Field | Default | Does |
|---|---|---|
item | required | The item. Not minecraft:air. |
components | none | Data components, in the format of components in a recipe's result. |
icon | true | Draws the item's icon before its name. false gives the name alone. |
The icon is drawn as in the inventory, 16 pixels square: a block in 3D, an enchanted item with its glint. See Icons in a line.
The panel draws the name in the theme's link colour. It doesn't use the item's rarity colour: those are chat colours and can't be read on the panel's light stone.
Components are read when the line is said, not on /reload. Any that can't be read are left off, and the log says so once per /reload.
Murmurs show only the name, with no icon and no tooltip.
Needs RPG Dialogue 1.0.11 or later. The icon needs 1.1.0 or later.
sprite
Draws a small image in the line, such as a heart or a quest mark.
{ "value": "sprite", "sprite": "minecraft:hud/heart/full" }| Field | Default | Does |
|---|---|---|
sprite | required | A texture, by its path ending in .png, or a GUI sprite id. |
What each kind of id names, and how the panel draws it, is on Icons in a line.
Needs RPG Dialogue 1.1.0 or later.
Text this mod already ships
Two translation keys you can use in your own files, so the wording matches everywhere and is translated for you:
| Key | English |
|---|---|
rpg_dialogue.choice.leave | "I will trouble you no further." |
rpg_dialogue.someone | "one of the others" |
rpg_dialogue.choice.leave is the farewell the panel supplies when a conversation offers no valid choices, so using it for your own way out keeps the two consistent.
Adding your own
A record, a MapCodec, and one call. See For mod developers.
