1

Random trades from a villager in a structure (block)?

Arkaliasus's Avatar Arkaliasus8/25/22 7:29 am history
8/26/2022 5:37 am
Arkaliasus's Avatar Arkaliasus
Hey guys, im trying to work out if its possible to have a villager thats saved in a structure block have random trades.

i figured that they MIGHT be the same but thought i would be able to work a way around it, I even thought about having a dispenser spawn the villager but then theres a dispenser there too xD, maybe it's more a loot table thing?

any help would be greatly appreciated! (assuming its possible ofc :P )
Posted by Arkaliasus's Avatar
Arkaliasus
Level 40 : Master Mage
31

Create an account or sign in to comment.

2

Spuduking
08/26/2022 2:40 am
Level 33 : Artisan Procrastinator
Spuduking's Avatar
If you're using functions in data packs, then you could hide an entity (with a special tag) and save it in the structure. In a loop function you could 'replace' the hidden entity with the villager.

Example loop function (using an item frame with tag "villager")
execute at @e[type=item_frame,tag=villager] run summon villager ~ ~ ~ {DESIRED_NBT}
kill @e[type=item_frame,tag=villager]

You could also have a 'main' tick/loop function, and run a function off of it:

execute as @e[tag=item_frame,tag=villager] run function namespace:spawn_villager

function namespace:spawn_villager:

execute at @s run summon villager ~ ~ ~ {DESIRED_NBT}
kill @s


Hope this helps!
2
Arkaliasus
08/26/2022 5:37 am
Level 40 : Master Mage
Arkaliasus's Avatar
mate thats awesome! i'll give them a go later!! :D
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome