Editor for regular villagers - Shopkeepers/Shopkeepers-Wiki GitHub Wiki
Sometimes users of the Shopkeepers plugins are looking for a convenient way to setup vanilla villagers with custom trades in order to avoid having to use complex Minecraft commands for this. The Shopkeepers plugin therefore also contains an editor for regular villagers and wandering traders.
Villager editor:
images/villager-editor/VillagerEditor.png
Scope of this feature
The scope of this feature is limited to simply configuring a selected vanilla villager. Basically the equivalent of setting the trades of a villager once via regular Minecraft commands.
Anything else is up to the user of this feature. For example, vanilla villagers may occassionally lose or change their trades, stop trading, have trade progression if they are traded with often, might change their profession, wander away, get killed, search for new villages, etc. The plugin does not deal with all of these vanilla mechanics and may actually conflict with some of them.
Edited villagers and their trades may behave similar to admin shopkeepers. They may no longer naturally change their profession, progress their trades, or take player-specific discounts into account.
The edited villager may also not support all vanilla villager and trading features. For example, various options available for vanilla trading recipes are not available when using this villager editor (see Editing Trades below).
Globally reconfiguring the trades of vanilla villagers, their trade progression, or their behavior is out of scope for this plugin as well.
Opening the Villager Editor
This villager editor works similar to the shopkeeper editor and can be used for any villagers and wandering traders which are neither shopkeepers nor Citizens NPCs.
You can use the command /shopkeepers editVillager [villager]
(see the Commands page) to open the editor for a targeted villager or wandering trader. Players need the permissions shopkeeper.edit-villagers
and shopkeeper.edit-wandering-traders
(default: op
) to edit regular villagers or wandering traders respectively.
You can also enable the settings edit-regular-villagers
and edit-regular-wandering-traders
(default: false
) inside the config and then open the editor by sneaking and right-clicking a villager or wandering trader (similar to how opening the editor works for shopkeepers).
Editing Trades
The editor supports editing the villager trades, similar to how editing works for admin shopkeepers.
Note that trades created or edited via the editor will have infinite uses, no xp rewards, no price multipliers and the current uses counter gets reset to 0 (there are currently no options to edit or persist these attributes).
To not accidentally edit all original trades whenever the editor is opened and closed (and thereby change the above mentioned trade attributes), we compare the trades from the editor with the villager's current trades before applying the trades from the editor: If the items of a trade are still the same, we keep the original trade without changes. A message in chat indicates how many trades have been modified after closing the editor window.
Since villagers may change their trades whenever they change or reset their profession, we set the villager's xp to at least 1 whenever the villager's trades or profession have been modified via the editor. However, if the villager has no profession yet, or you remove its profession again, it may search for nearby work blocks again and pick a new profession with new trades if it finds one, regardless of its current xp.
If the villager is killed or gets unloaded while editing, any changes in the editor will have no effect. Changes to the villager while editing may not be reflected in the editor.
Other Editor Options
Other supported villager editor options are:
- Deleting the villager entity.
- Opening a copy of the villager's inventory. Note that any changes to the opened inventory are not reflected in the villager's inventory currently (i.e. you can view, but not modify the villager inventory with this).
- Changing the villager profession. Changing the profession via the editor will keep the current trades. We set the villager's xp to 1 so that it no longer naturally changes or resets its profession.
However, if you reset the villager's profession again via the editor, the villager will look for a nearby work block again and pick a new profession with new trades if it finds one, regardless of its current xp. - Changing the villager type (i.e. the biome specific outfit).
- Changing the villager level (i.e. the badge color). This also affects which level is displayed and whether the villager's xp is shown within the villager's trading UI.
- Toggling the villager's AI on and off. This is useful to make the villager stationary while editing it. Otherwise it may wander away.
- Toggling the villager's
Invulnerable
flag. - Editing the villager's equipment.
Why is this not a separate plugin?
This editor is part of of the Shopkeepers plugin and not a separate plugin because it shares a lot of its implementation. Having this as part of the Shopkeepers plugins simplifies its implementation and maintenance.