• check_circle Functions
  • 1,560 views, 6 today
  • 66 downloads, 0 today
  • 5
  • 5
  • 1
Speeskees's Avatar Speeskees
Level 8 : Apprentice System
0
Allows players to set pets to roam freely, or set any animal to roam within range of an armor stand, using name tags.


Description

Freely roaming pets will set the nearest player within 12 blocks as their owner, effectively making a pet friendly to everyone. Animals paired to an armor stand will get teleported back to their armor stand if they leave the armor stands range (either 16, 32, 48 or 64 blocks). Additionally, tamed pets paired to an armor stand change their owner to the nearest player within range of the armor stand, or set their owner to null if no players are within range, effectively making a pet friendly to everyone, while staying in range of it's armor stand.


How to use

In order to set a pet to roam freely, simply name it "ra_roam".

In order to pair one or more animals to an armor stand, first, name the animals you want to pair "ra_pair". Then, within 128 blocks of all to be paired animals, name an armor stand "ra_16", "ra_32", "ra_48", or "ra_64", depending on the range you want to set.

In order to un-pair an animal from it's armor stand, or have a pet keep it's current owner permanently, you can name it "ra_reset". In order to reset an armor stand and all paired entities at once, you can simply destroy it.

When a named entity gets updated, it's name will clear and it will get the glowing effect for 10 seconds as indication.


Issues & additional information

Tamed parrots seem to lose their scoreboard data when sitting down on a players shoulder, effectively resetting them whenever they do so. Untamed parrots do not have this issue, as they don't sit down on players' shoulders.

The datapack checks and updates entities every 20 ticks or one second. The amount of ticks between updates can be changed by entering the command "/scoreboard players set #global ra_timer_max [amount of ticks]". Increasing the time between updates can reduce performance draw, but setting the time too high could allow animals to get too far away from their armor stand to be teleported back, if the armor stand gets unloaded.

The datapack was tested on my 1.20.1 PaperMC server, and vanilla 1.20.1 in a singleplayer world. It should also work on older versions, as long as the command syntax and NBT structure of animals haven't changed, but is not tested.
CompatibilityMinecraft 1.20
Tags

Create an account or sign in to comment.

1
08/24/2023 6:55 pm
Level 36 : Artisan Zombie
MLG_Zombie
MLG_Zombie's Avatar
I misread this as roasting animals
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome