Minecraft Data Packs / Other

Enchanted Villagers

  • check_circle Functions
  • 12,090 views, 4 today
  • 464 downloads, 1 today
  • 10
  • 6
  • 2
manuelst's Avatar manuelst
Level 44 : Master Miner
11
The Enchanted Villagers helps to find a specified enchantment in a trading hall with a lot of librarians.


The player can obtain the enchanted villagers book by typing

/trigger ev_giveBook
into the chat. This book will list all enchantments with the cheapest price available.


By clicking on an enchantment, all villagers that trade this enchantment will be highlighted for a short period of time (this can be disabled by the player that adds the datapack).



There are two features for OP players:

Disable highlighting villagers

When adding the datapack, edit line 5 of the file "data/enchanted_villagers/functions/enable_trigger.mcfunction" and change the 1 at the end to a 0:

execute at @a unless score @p ev_canSearch matches 0.. run scoreboard players set @p ev_canSearch 1
You can also disable this setting for specific players:
scoreboard players set *player_name* ev_canSearch 0
and enable it only for specific players, too:
scoreboard players set *player_name* ev_canSearch 1
Just replace player_name with the in-game name of the player you want to target (or with any target selector to target multiple players).

Statistics
The datapack comes with two statistics you can use for other datapacks or functions if you want to:

ev_tookBooks: This scoreboard counts how often a player used the "/trigger ev_giveBook" command.
ev_searched: This scoreboard counts how often a player clicked on an enchantment to view the villagers that have this trade. It won't test if the search was successful (if there were one or multiple villagers that trade this book).
CompatibilityMinecraft 1.14
Tags

Create an account or sign in to comment.

1
10/18/2019 10:32 pm
Level 13 : Journeyman Dolphin
LordQwerty
LordQwerty's Avatar
does it work in a vannila server?
2
10/19/2019 4:48 am
Level 44 : Master Miner
manuelst
manuelst's Avatar
It should be multiplayer and server compatible.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome