minecraft-expanded-datapack/data/undeadm-m2/functions/talk.mcfunction

16 lines
895 B
Mcfunction

scoreboard players set @s me-core_talk 0
#
# select closest villager a block forward in the direction the player is lookin
## i might fight this later -- not now
execute positioned ^ ^ ^2.5 as @e[type=#undeadm-m2:talkable,limit=1,sort=nearest] unless score @s me-m2_talkCD matches 1.. run tag @s add talking
execute as @e[tag=talking] run scoreboard players set @s me-m2_talkCD 100
#execute as @e[tag=talking] run tellraw @a [{"text":"<"},{"selector":"@s"},{"text":"> Hello there"}]
# if havent talked in a while, salute!
execute as @e[tag=talking,type=minecraft:villager] run function undeadm-m2:villager_talk/salutation
execute as @e[tag=talking,type=minecraft:villager] run function undeadm-m2:villager_talk/interaction
execute as @e[tag=talking,type=minecraft:wandering_trader] run function undeadm-m2:wandering_trader_talk/salutation
execute as @e[tag=talking] run tag @s remove talking