YapYap API is a library mod that lets you give any entity a full conversation. You build a branching dialog tree, attach it to an NPC, and the player talks to that NPC in a custom in-game screen with a portrait, typewriter text, and clickable response options.
It is meant to be used by other mods and by datapacks. On its own it adds an admin command and a couple of example conversations, nothing else.
Requires: NeoForge 21.1.190 or newer, Minecraft 1.21.1, Java 21. Side: needs to be installed on both the client and the server. License: MIT.
/reload command. Actions can run vanilla commands and functions, so a pure datapack can drive quests without any Java.Conditions: check a flag, whether a node was visited before, an advancement, a scoreboard score, permission level, held items, a random chance, sneaking state, the current dimension, and the logic combiners all of, any of, and not.
Actions: run a command, run a function, set or add a flag, give or take items, grant an advancement, play a sound, send a chat or action bar message, open another dialog, open the NPC trade screen, jump to another node, and end the conversation.
Text placeholders such as the player name, the NPC name, and the villager profession are filled in when the line is shown.
Put dialog files at data/<namespace>/yapyap/dialogs/<name>.json. Bind a dialog to a mob with the in-game command, then right-click the mob. Dialogs reload with /reload. A full working example is included in the mod jar.
Add the mod as a dependency and use the YapYapAPI class. You can register dialogs, register your own condition and action types, open and close conversations, bind dialogs to entities, and read or write player flags. A DialogBuilder gives you a readable way to define trees in code.
All /yapyap subcommands need permission level 2.
talk starts a conversation for one or more players.assign and unassign bind or unbind a dialog on an entity.stop force-closes conversations.reset clears a player's visited history.flag reads or edits player flags.list shows every loaded dialog id.demo gives you a villager spawn egg for a quick test. The placed villager gets a random profession and an example dialog with a trade option and a small quest.villager_on turns on a generic greeting for all un-bound adult villagers.The last one is off by default and is also editable in the config file.
The config file config/yapyap-common.toml controls right-click behaviour, the auto-close distance, whether command actions are allowed, and the auto-dialog toggles. The file config/yapyap-client.toml controls typewriter speed and background dimming. Both files are plain text and safe to edit by hand.
Full documentation is available as a wiki. It covers the complete JSON format, every condition and action with its fields, the Java API, the event list, all commands, all config keys, and the texture spec.