• check_circle Advancements
  • check_circle Functions
  • 12,745 views, 22 today
  • 621 downloads, 1 today
  • 19
  • 18
  • 13
surfrock66's Avatar surfrock66
Level 26 : Expert Engineer
2
I created a datapack which helps with villager lag in trading halls.

Previous versions for different minecraft versions are available here: www.teh3l3m3nts.com/stillagers-datapack/

If you name tag a villager with “Stillager” or “stillager” they will stop moving and path finding altogether. This is done by setting the “NoAI” tag of the villager to 1. This typically eliminates restocks, so I have a function to manually restock all trades at 8:00 AM and 2:00 PM. This is mostly consistent with vanilla behavior, villagers restock twice a day at slightly random times, but their 4 phases of the day (work, gather, wander, and sleep) can be divided into 4 segments which is the logic behind the restock times.

If you want to disable this, you tag the villager with “Moveager” or “moveager” and the name disappears and their AI is restored.

This is particularly useful for trading halls where villagers are locked in 1×1 spaces. In my test world where I have a trading hall with ~150 villagers, it took the tps from 15 to 20, the MSPT from ~65 to ~50, and the FPS to ~30 to ~60 (where I have it capped). This has tremendous lag reduction impacts without the headache of doing double-carpet tricks, and is completely optional so villagers in mob farms or those that are naturally spawned are completely unaffected; this is opt-in.

The only mobs impacted by this are villagers. If you name another mob "Stillager" or "Moveager" it will be unaffected.

Special thanks to the VanillaTweaks team; this was made using their “SilenceMe” and “Track Raw Statistics” datapacks as templates.

This is my first datapack, so feedback is welcome.

-- UPDATE 2021.12.11 -- This has been tested in 1.18 and 1.18.1 and still works as expected.

-- UPDATE 2022.06.17 -- Updated the "pack format" tag marking it as compatible with 1.19, fully tested and working.

-- UPDATE 2023.06.08 -- Updated the "pack format" tag marking it as compatible with 1.20 and 1.20.1, fully tested and working.

-- UPDATE 2023.12.25 -- Updated the "pack format" tag marking it as compatible with 1.20.2, fully tested and working

-- UPDATE 2023.12.25 -- Updated the "pack format" tag marking it as compatible with 1.20.3 and 1.20.4, fully tested and working

-- UPDATE 2024.04.23 -- Updated the "pack format" tag marking it as compatible with 1.20.4, fully tested and working
CreditVanillaTweaks
CompatibilityMinecraft 1.14
toMinecraft 1.20
Tags

8 Update Logs

Stillagers.v1.0.8 : by surfrock66 04/23/2024 9:10:26 pmApr 23rd

Updated version for 1.20.5
LOAD MORE LOGS

Create an account or sign in to comment.

1
08/27/2023 8:13 pm
Level 1 : New Miner
allanonmage
allanonmage's Avatar
I used this datapack on my server for my villager trading hall. I did not see a measurable decrease in MSPT. I was ad 20 MSPT the other day, and then all of a sudden it went to 50 and hovers around there. Using the stillager nametags didn't seem to change much of anything tick wise.

I'm on 1.19.2 fabric, and with many mods, including performance ones. I have about 60 - 80 villagers in my hall in minecarts. Minihud says I have ~900 entities in my base, which I presume are chests*, item frames, banners, etc. I have Enhanced Block entities running, so the chests shouldn't be causing lag.

I've got basically maxed out Ryzen 9's for client and server, so I can't add more hardware to the problem.

Aside from adding more performance mods, I can't find any advice on how to reduce MSPT besides remove entities. Given the hardware that I have, I suspect there's something I'm missing though.
1
12/15/2021 6:55 am
Level 2 : Apprentice Explorer
SirJoeDoe
SirJoeDoe's Avatar
Have noticed an issue with applying this to villagers before you have them fully set up. While restocks work, if you are attempting to unlock new trades for the villager, they don't
1
06/07/2022 4:53 pm
Level 26 : Expert Engineer
surfrock66
surfrock66's Avatar
I only saw this now because I guess I'm not getting email notifications?



The NoAI tag will stop leveling up. You need to trade them up BEFORE applying the stillager tag, or, use a "moveager" tag to re-enable their AI, trade them up, and then re-apply the "stillager" nametag.
1
10/30/2021 3:28 pm
Level 1 : New Miner
probablypablito
probablypablito's Avatar
Would it be possible to only disable Movement AI? I want to use this for villagers inside of an iron farm, which due to being in the spawn chunks causes a long of lag.
1
10/18/2021 9:46 pm
Level 37 : Artisan Princess
Kate1902019
Kate1902019's Avatar
Can you make it work with other mobs too?(since I don't want zombies to chase and kill my villagers, I don't want wolves to chase and kill my sheeps, I don't want skeletons to shoot my iron golems that is hard for them to reach and tied to a lead(because that's cheating! BLAME MOJANG!!!!!) & I don't want iron golems to attack Players when they are about to attack the others Players and me)
1
06/07/2022 5:01 pm
Level 26 : Expert Engineer
surfrock66
surfrock66's Avatar
It appears I stopped getting notifications for comments and haven't checked until now.

It would be possible to build a datapack like that, but not like this one. The one here looks for entities of type "villager" with the name "stillager" or "moveager" to change the data item "NoAI" to true. You'd be looking for one that is constantly searching for mobs of a type and removing the NoAI tag; there's no way to select just ones chasing villagers and such. At that point, you may as well just disable their spawning, they would spawn and stand there until they burned.
1
10/30/2021 1:50 pm
Level 3 : Apprentice Artist
DjGamer123
DjGamer123's Avatar
I don't think that skeletons shooting iron golems is "cheating."

Also, why do you still play Minecraft if you hate Mojang that much?
1
10/18/2021 9:41 pm
Level 37 : Artisan Princess
Kate1902019
Kate1902019's Avatar
Thank you. That would be useful because I hated it when they moves around and escaping thinks(houses, villager breeding stations, villager farms, villager houses etc.)
1
09/13/2021 8:51 pm
Level 41 : Master Creeper
ThanosSmellsBad
ThanosSmellsBad's Avatar
LOL

I'll make them still and push them into the lava pit if they annoy me.
1
09/11/2021 9:21 am
Level 1 : New Miner
kershi23
kershi23's Avatar
cool
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome