1
Random trades from a villager in a structure (block)?
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 )
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 )
Create an account or sign in to comment.
2
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!
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!
mate thats awesome! i'll give them a go later!! :D