Realized quite a few use cases for dialogues involved someone to talk to, so here goes.
At first the feature scope was :
dialogues get started with an optional interlocutor entity
the interlocutor is available both serverside and clientside through the screen handler
it is also available in commands through a new @interlocutor entity selector (only applicable to players)
it is also available in predicates through a new blabber:interlocutor_properties loot condition
texts in dialogues support serverside parsing operations, required for scoreboard and selector components
The latter change however means the dialogues have to be parsed and sent whenever a player starts one. Therefore, the registry's contents would only be used clientside to provide the suggestions in commands. It seemed to me that this may be somewhat overkill, so I killed the synced registry part, and synced just the identifiers using the new configuration phase.
Having removed one reason to use Minecraft's dynamic registries, I started looking at the other ones :
they store our entries (duh)
they load said entries automatically
they integrate well with existing APIs (notably registry events)
they offer natural client/server separation
However, they present some rather large downsides :
they are not reloadable
they give terrible error messages (codec issue)
they have a stupid quirk that prevents using records for the entries
Considering the cost of an in-house data loader is rather minimal, I figured this way may be best. The lack of registry events may be an issue for future add-on development, but I figured we could add our own callbacks when the need arises.
Future considerations :
the screen handler could be made officially part of the API
the interlocutor could be added as a parameter to DialogueAction (possible breaking change, though it could go to a separate interface)
the texts could be refreshed periodically while a dialogue is opened
Realized quite a few use cases for dialogues involved someone to talk to, so here goes.
At first the feature scope was :
@interlocutor
entity selector (only applicable to players)blabber:interlocutor_properties
loot conditionThe latter change however means the dialogues have to be parsed and sent whenever a player starts one. Therefore, the registry's contents would only be used clientside to provide the suggestions in commands. It seemed to me that this may be somewhat overkill, so I killed the synced registry part, and synced just the identifiers using the new configuration phase.
Having removed one reason to use Minecraft's dynamic registries, I started looking at the other ones :
However, they present some rather large downsides :
Considering the cost of an in-house data loader is rather minimal, I figured this way may be best. The lack of registry events may be an issue for future add-on development, but I figured we could add our own callbacks when the need arises.
Future considerations :
DialogueAction
(possible breaking change, though it could go to a separate interface)