Minecraft – Prevent Villager from restocking in Vanilla game

minecraft-commandsminecraft-java-edition

Is it possible to (and, if so, how do you) spawn in a villager which is incapable of restocking?

I'm going to make a guided Skyblock-like map, with the villager's trades representing different progression tasks (e.g. get 64 cobblestone); I want to make this in an entirely Vanilla way. I want to disable "grinding" for the rewards, however; they should be finite even if they require renewable resources.

(I actually do want, if possible, some custom trades to be gated behind level progression; this would make for an extra degree of freedom in the design; but that's not a hard requirement and is out of primary scope of this question.)

  • Can one program it to think that its job block must be a Dragon Egg or Barrier block (which it will never find, thus never claim, thus never restock)?
  • Can one create a Nitwit (villager unable to claim a job site) who has been, nevertheless, spawned in with some artificial trading ability?
  • If one simply assigns it a job block, which is encased in Barrier at y=0, can a crafty player nevertheless convince the villager to abandon it in favor of an accessible one?

Generally: is there any way to do this without mods?


This is related to, but not a duplicate of, “How do I prevent new villager trades from spawning?”.

  • That question concerns how to prevent villagers from unlocking new trades when the villager levels up
  • I am asking how to prevent them from restocking existing trades when they are exhausted

Best Answer

Basically, it can be done by adding {NoAI:1} tag to the villager, for example this command will summon a cartographer:

/summon villager ~ ~ ~ {VillagerData:{profession:"minecraft:cartographer",type:"minecraft:plains"},NoAI:1b}

One disadvantage of this method is that the villager will not move at all.

Also, the villager that is summoned that way doesn't need the job site to be placed near it.