diff --git a/data/aeternum/function/load.mcfunction b/data/aeternum/function/load.mcfunction index 2f518fb..4d33c8e 100644 --- a/data/aeternum/function/load.mcfunction +++ b/data/aeternum/function/load.mcfunction @@ -32,6 +32,8 @@ scoreboard objectives add aeternum.player.level.small dummy scoreboard objectives add aeternum.merchant.hurt_time dummy scoreboard objectives add aeternum.merchant.noAI dummy scoreboard objectives add aeternum.merchant.random dummy +scoreboard objectives add aeternum.merchant.timer dummy +scoreboard players set #global aeternum.merchant.timer 24000 scoreboard objectives add aeternum.gamerule.spawn_chunk_radius dummy scoreboard objectives add aeternum.world.difficulty dummy diff --git a/data/aeternum/function/main.mcfunction b/data/aeternum/function/main.mcfunction index 8aa61c7..b515d0e 100644 --- a/data/aeternum/function/main.mcfunction +++ b/data/aeternum/function/main.mcfunction @@ -13,4 +13,8 @@ execute as @e[type=wandering_trader] run function aeternum:tick/wandering_trader execute as @e[type=arrow] run function aeternum:tick/arrow_tick_main execute as @a run function aeternum:tick/player_tick -function aeternum:abilities/tick \ No newline at end of file +function aeternum:abilities/tick + +scoreboard players remove #global aeternum.merchant.timer 1 +execute if score #global aeternum.merchant.timer matches 0 run function aeternum:merchant/marker/spawn_summon +execute if score #global aeternum.merchant.timer matches 0 run scoreboard players remove #global aeternum.merchant.timer 24000 diff --git a/data/aeternum/function/merchant/marker/decide.mcfunction b/data/aeternum/function/merchant/marker/decide.mcfunction new file mode 100644 index 0000000..a3608e2 --- /dev/null +++ b/data/aeternum/function/merchant/marker/decide.mcfunction @@ -0,0 +1,3 @@ +spreadplayers ~ ~ 48 48 false @s +execute at @s unless entity @a[distance=..10] run function aeternum:merchant/summon +kill @s diff --git a/data/aeternum/function/merchant/marker/spawn_summon.mcfunction b/data/aeternum/function/merchant/marker/spawn_summon.mcfunction new file mode 100644 index 0000000..5a20004 --- /dev/null +++ b/data/aeternum/function/merchant/marker/spawn_summon.mcfunction @@ -0,0 +1,3 @@ +kill @e[type=marker,tag=aeternum.merchant.unispawn] +execute at @r run summon marker ~ ~ ~ {Tags:["aeternum.merchant.unispawn"]} +execute as @e[type=marker,tag=aeternum.merchant.unispawn] at @s run function aeternum:merchant/test \ No newline at end of file diff --git a/data/aeternum/function/merchant/quest/test.mcfunction b/data/aeternum/function/merchant/quest/test.mcfunction new file mode 100644 index 0000000..1ea75a9 --- /dev/null +++ b/data/aeternum/function/merchant/quest/test.mcfunction @@ -0,0 +1,10 @@ +execute if score .merchant.rarity aeternum.global_config matches 0 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.0} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 1 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.1} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 2 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.2} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 3 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.3} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 4 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.4} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 5 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.5} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 6 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.6} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 7 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.7} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 8 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.8} run function aeternum:merchant/quest/summon +execute if score .merchant.rarity aeternum.global_config matches 9 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.9} run function aeternum:merchant/quest/summon \ No newline at end of file diff --git a/data/aeternum/function/merchant/summon.mcfunction b/data/aeternum/function/merchant/summon.mcfunction index da40afc..f2ea20b 100644 --- a/data/aeternum/function/merchant/summon.mcfunction +++ b/data/aeternum/function/merchant/summon.mcfunction @@ -1,6 +1,6 @@ -execute at @s if score .merchant.alert.sound aeternum.global_config matches 1 as @a[distance=..30] run playsound minecraft:entity.wandering_trader.reappeared player @s ~ ~ ~ -execute at @s if score .merchant.alert.chat aeternum.global_config matches 1 as @a[distance=..30] run tellraw @s {"translate": "aeternum.merchant.spawn"} +execute at @s if score .merchant.alert.sound aeternum.global_config matches 1 as @a[distance=..50] run playsound minecraft:entity.wandering_trader.reappeared player @s ~ ~ ~ +execute at @s if score .merchant.alert.chat aeternum.global_config matches 1 as @a[distance=..50] run tellraw @s {"translate": "aeternum.merchant.spawn"} summon wandering_trader ~ ~ ~ {NoAI:1b,DespawnDelay:48000,DeathLootTable:"minecraft:empty",DeathTime:200s,ArmorDropChances:[-10000.0f,-10000.0f,-10000.0f,-10000.0f],HandDropChances:[-10000.0f,-10000.0f],Silent:1b,CustomNameVisible:1b,CanPickUpLoot:0b,Tags:["aeternum.entity.trader_dungeon"],CustomName:'{"color":"#FF8000","italic":false,"text":"Dungeon Merchant"}'} diff --git a/data/aeternum/function/merchant/test.mcfunction b/data/aeternum/function/merchant/test.mcfunction index 14ce618..164e483 100644 --- a/data/aeternum/function/merchant/test.mcfunction +++ b/data/aeternum/function/merchant/test.mcfunction @@ -1,12 +1,10 @@ -execute if score .merchant.rarity aeternum.global_config matches 0 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.0} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 1 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.1} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 2 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.2} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 3 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.3} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 4 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.4} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 5 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.5} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 6 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.6} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 7 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.7} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 8 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.8} run function aeternum:merchant/summon -execute if score .merchant.rarity aeternum.global_config matches 9 as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest] at @s if predicate {"condition":"minecraft:random_chance","chance":0.9} run function aeternum:merchant/summon - -tag @s[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned] add aeternum.entity.spawned \ No newline at end of file +execute if score .merchant.rarity aeternum.global_config matches 0 at @s if predicate {"condition":"minecraft:random_chance","chance":0.0} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 1 at @s if predicate {"condition":"minecraft:random_chance","chance":0.1} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 2 at @s if predicate {"condition":"minecraft:random_chance","chance":0.2} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 3 at @s if predicate {"condition":"minecraft:random_chance","chance":0.3} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 4 at @s if predicate {"condition":"minecraft:random_chance","chance":0.4} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 5 at @s if predicate {"condition":"minecraft:random_chance","chance":0.5} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 6 at @s if predicate {"condition":"minecraft:random_chance","chance":0.6} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 7 at @s if predicate {"condition":"minecraft:random_chance","chance":0.7} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 8 at @s if predicate {"condition":"minecraft:random_chance","chance":0.8} run function aeternum:merchant/marker/decide +execute if score .merchant.rarity aeternum.global_config matches 9 at @s if predicate {"condition":"minecraft:random_chance","chance":0.9} run function aeternum:merchant/marker/decide \ No newline at end of file diff --git a/data/aeternum/function/tick/wandering_trader.mcfunction b/data/aeternum/function/tick/wandering_trader.mcfunction index 638578c..3ac4997 100644 --- a/data/aeternum/function/tick/wandering_trader.mcfunction +++ b/data/aeternum/function/tick/wandering_trader.mcfunction @@ -1,4 +1,5 @@ -execute as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest,tag=!aeternum.entity.spawned] run function aeternum:merchant/test +execute as @s[type=minecraft:wandering_trader,tag=!aeternum.entity.trader_dungeon,tag=!aeternum.entity.villager.quest,tag=!aeternum.entity.spawned] run function aeternum:merchant/quest/test execute as @s[type=minecraft:wandering_trader,tag=aeternum.entity.trader_dungeon] run function aeternum:merchant/display -execute as @s[type=minecraft:wandering_trader,tag=aeternum.entity.villager.quest] run function aeternum:merchant/quest/display \ No newline at end of file +execute as @s[type=minecraft:wandering_trader,tag=aeternum.entity.villager.quest] run function aeternum:merchant/quest/display +tag @e[type=minecraft:wandering_trader,tag=!aeternum.entity.spawned] add aeternum.entity.spawned \ No newline at end of file