Minecraft Data Packs / Game Mechanic

Infinite Villager Trade Restocks v1.2 for 1.20.2

  • check_circle Functions
  • 12,472 views, 14 today
  • 2,555 downloads, 3 today
  • 27
  • 23
  • 4
NerdAmethyst's Avatar NerdAmethyst
Level 45 : Master Dragonborn
51
  This datapack allows for villagers to infinitely restocks their trade. They still lock their trades until they restock to not make it op. Villagers can restock up to 2 times before entering a cooldown until they can restock again (Villagers can trade for 2 times per in game days in vanilla).

    They have in their entity data that determines when will they restock, RestocksToday and LastRestock. The datapack when is enabled (default) keeps the value of RestocksToday to 0 without allowing to reach the limit of 2. They also have a tag each in their trades, Offers.Recipes[<trade/s no.(0-9)>].rewardExp <value,1b/0b>, that determines whether a trade should give the player xp orbs. I added the ability for players to disable it if they think that having able to trade "infinitely" and get xp is op.
  
  I'm making a project on my survival that that requires a ton quartz block (I know the nether is an option but it's the nether), and I have a mason villager. I'm planning to make a mason hall but it would take a of hours of trading or I could shorten it by having a lot mason villagers but sacrificing optimization. I know there are mods and datapacks that would allow for infinite trading but I wanted to challenge myself and improve my knowledge with datapacks, plus I found it as a good hobby.

To enable/disable Infinite Trading (ON by default):
/trigger ToggleInfiniteTrading

To enable/disable Reward xp orbs to players (ON by default):
/trigger ToggleRewardxp

To uninstall:
/function trade:uninstall

*UNINSTALL THE OLD VERSION (V1.1) IF YOU'RE USING IT BEFORE USING THE CURRENT VERSION.


Features:
  • Modifies the entity data of villagers to allow them to restock without limit.
  • They will still only trade within their working hours.
  • Allows to disable/enable villagers from giving xp orbs to players when trading (on by default), if you think getting xp from "infinite trading" is op.
  • Allows for better gameplay optimization since you'll only need a few villagers for your trading hall removing the necessity for a huge number of villagers that causes entity lag.
CompatibilityMinecraft 1.20
Tags

2 Update Logs

Update #2 : by NerdAmethyst 12/30/2023 8:46:09 amDec 30th, 2023

  • Removed trigger RestockTime as it barely change the time delay for villagers to restock.
  • Optimizations. Uses villager nbt on selectors rather than using scores.
LOAD MORE LOGS

Create an account or sign in to comment.

2
06/22/2022 8:18 am
Level 1 : New Miner
oTiredd
oTiredd's Avatar
it doesn't work on 1.19 can you please fix this
1
12/30/2023 8:48 am
Level 45 : Master Dragonborn
NerdAmethyst
NerdAmethyst's Avatar
Updated to 1.20.2, pack format 18
1
04/21/2022 8:57 am
Level 7 : Apprentice Crafter
IeFHC233
IeFHC233's Avatar
Create for 1.17 :)
1
12/30/2023 8:49 am
Level 45 : Master Dragonborn
NerdAmethyst
NerdAmethyst's Avatar
I won't be backporting.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome