• check_circle Advancements
  • check_circle Functions
  • check_circle Predicates
  • 29,237 views, 14 today
  • 9,029 downloads, 2 today
  • 70
  • 93
  • 30
the der discohund's Avatar the der discohund
Level 41 : Master Engineer
16

Villager Leads Minecraft Data Pack
Description

This is a very small data pack, with its only feature being that you can now also use leads on villagers.

Other implementations

I noticed that AustenFrisch made a data pack with the same features, but a few days earlier than I. To help you choose between which one to install, here is a table of differences in the implementation:

Feature
My pack
Austen's pack
Consequences
Activation
Advancement
Constant NBT and scoreboard tests
Performance-wise, NBT tests are rather expensive and especially so when they are called 80 times per player per second without anything being done. On the other hand, advancements only run commands when the corresponding event triggers, which means that my pack causes no server cost for the time that the player doesn't do anything.
This uses the advancement format introduced in 1.16, causing my pack to be incompatible with earlier versions.
Detection of the villager
Ray casting
Radius searchRay casting only searches in the player's line of sight, while searching in a radius may select any villager that is close enough, resulting in a far less accurate search.
Removing a lead item
Shulker box + loot table
/clear command
The /clear command removes the item from anywhere in the inventory, while my method only targets the slot that was actually used.

TL;DR:
My pack is far more efficient and accurate, but incompatible with 1.15 or earlier.

Also, all the features implemented from 12.02.2021 onwards only exist in my version.

In case you still want to check out Austen's pack, here's the link:
https://www.planetminecraft.com/data-pack/leashable-villagers/

How to uninstall

Removing the data pack from the 'datapacks' folder of your world directly doesn't have any noticeable side-effects, however, not uninstalling it properly first can leave a few bytes of extra storage on your world as well as impact the performance of other commands you may want to act on your world.
This can be avoided by running the command '/function tddh_villager_leads:uninstall' without reloading your world before removing the data pack.

Changelog

  • 07.12.2021: Added 1.18 compatibility
  • 15.07.2021: Added 1.17 compatibility
  • 18.02.2021: Minor tweaks to comply with official conventions, including adding the uninstall function and changing the trading GUI to not close anymore when villagers have the 'global.ignore.pos' tag
  • 18.02.2021: Fixed bug with multiple villagers being connected at once when in the same position
  • 14.02.2021: Fixed bug with trades being regenerated under some circumstances
  • 12.02.2021: Fixed bug with gamemode check being inverted
  • 12.02.2021: Increased interaction range in creative to 5 blocks
  • 12.02.2021: Made the trading GUI close when leashing a villager by resummoning it
  • 12.02.2021: Removed activation on interactions where the the lead is intended to be disconnected instead of connected
  • 11.02.2021: Made lead items not be consumed when used in creative
  • 10.02.2021: Fixed issue with shulker box being attempted to be found in different dimensions, causing leads to sometimes not be consumed
  • 10.02.2021: Fixed critical issue in relation to the /loot command
CompatibilityMinecraft 1.16
toMinecraft 1.18
Tags

Create an account or sign in to comment.

1
08/10/2022 6:49 pm
Level 1 : New Crafter
RosyBuilds
RosyBuilds's Avatar
Aw, yeah! No more playing a game of "follow the job block" for ~1,000 blocks! Thanks for the amazing datapack. Using it in 1.16.1
1
06/11/2022 2:44 pm
Level 1 : New Miner
Rendal
Rendal's Avatar
Great datapack but in 1.19 using the Villager Death Messages datapack it says that a villager had died in the position. It doesnt die though.
1
05/11/2022 2:12 pm
Level 1 : New Miner
sansboos
sansboos's Avatar
with which key is the leash attached
1
05/20/2022 5:47 pm
Level 41 : Master Engineer
the der discohund
the der discohund's Avatar
Just like with any other mob, you right click the villager with a leash to attach it.
1
12/25/2021 1:03 pm
Level 1 : New Miner
Queez
Queez's Avatar
Very good data pack! Working perfectly on my 1.18.1 server. Thank's you :D
1
12/22/2021 6:42 pm
Level 1 : New Crafter
johnnyok
johnnyok's Avatar
when i right click on a villager it gives me a deepslate block
1
12/17/2021 4:20 pm
Level 1 : New Miner
GameAndPhillip
GameAndPhillip's Avatar
I can't use a lead on Villagers. Can you fix this please? (I installed it but it doesn't work.)
1
12/18/2021 1:32 am
Level 41 : Master Engineer
the der discohund
the der discohund's Avatar
The pack still works in the newest version of the game.
Possible reasons for why it does not work on your end are:
  • You are playing on a version that is earlier than 1.16
  • You have mods installed that break technical Minecraft features
  • You have other data packs installed that break this one. While my pack does claim compatibility, this only means that it is designed in a way that it doesn't break other packs and is not broken by packs that follow the same conventions. It is virtually impossible to make a data pack resilient against every possible misbehaviour that other creators may partake in.
  • You may not actually have installed the data pack. A data pack is installed when you can open it while in the '.minecraft/saves/<world>/datapacks' folder, and right after opening it, the 'data' folder and 'pack.mcmeta' files are directly visible.
It's not really possible for me to give any more specific help/instructions unless I'm given more specific information, for example which data packs you're installing alongside mine to make it stop working.
1
12/18/2021 8:13 am
Level 1 : New Miner
GameAndPhillip
GameAndPhillip's Avatar
Ok then it's prob bc of other datapacks.
1
12/06/2021 6:12 pm
Level 1 : New Miner
milkycoffeebeans
milkycoffeebeans's Avatar
Update to 1.18 please
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome