From 231e0d24863c3e11bc53f67f201774bd62c1ee41 Mon Sep 17 00:00:00 2001 From: HeroChris Date: Wed, 1 Nov 2023 16:01:25 +0100 Subject: [PATCH] Effects - Sound effect - Particle effect - offHand tnt for visualization --- data/herohost/functions/core/initialize.mcfunction | 1 + data/herohost/functions/core/reconnect.mcfunction | 3 +++ data/herohost/functions/main.mcfunction | 5 +++++ data/herohost/functions/tnt/core.mcfunction | 10 ++++++++-- data/herohost/functions/tnt/get_tnt.mcfunction | 2 ++ data/herohost/functions/tnt/give_tnt.mcfunction | 2 +- 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/herohost/functions/core/initialize.mcfunction b/data/herohost/functions/core/initialize.mcfunction index b068e3b..3bebab4 100644 --- a/data/herohost/functions/core/initialize.mcfunction +++ b/data/herohost/functions/core/initialize.mcfunction @@ -4,6 +4,7 @@ tellraw @s [{"text":"» ","color":"gray"},{"text":"Welcome ","color":"white"},{" tellraw @a[tag=hc.initialized] [{"text":"» ","color":"gray"},{"text":"Everyone, give ","color":"white"},{"selector":"@s","color":"yellow"},{"text":" a warm welcome!","color":"white"}] execute at @s run playsound minecraft:entity.player.levelup master @s execute in herohost:world run tp @s 0 101 0 0 0 +execute in herohost:world run spawnpoint 0 100 0 0 0 gamemode adventure @s[tag=!hc.debug] # initialize player diff --git a/data/herohost/functions/core/reconnect.mcfunction b/data/herohost/functions/core/reconnect.mcfunction index 506d783..c1166b3 100644 --- a/data/herohost/functions/core/reconnect.mcfunction +++ b/data/herohost/functions/core/reconnect.mcfunction @@ -6,5 +6,8 @@ execute at @s run playsound minecraft:entity.player.levelup master @s execute in herohost:world run tp @s 0 101 0 0 0 gamemode adventure @s[tag=!hc.debug] +# protection +clear @s + # reset player score scoreboard players reset @s +hc.disconnect \ No newline at end of file diff --git a/data/herohost/functions/main.mcfunction b/data/herohost/functions/main.mcfunction index f7134db..170826c 100644 --- a/data/herohost/functions/main.mcfunction +++ b/data/herohost/functions/main.mcfunction @@ -4,5 +4,10 @@ execute as @a[tag=!hc.initialized] run function herohost:core/initialize execute as @a[scores={+hc.disconnect=1..}] run function herohost:core/reconnect +# protection +gamemode adventure @a[tag=!hc.debug,gamemode=!adventure] +execute as @a[nbt=!{Dimension:"herohost:world"},tag=!hc.debug] in herohost:world run tp @s 0 100 0 0 0 +kill @e[type=item,nbt={Item:{tag:{clear:1b}}}] + # games execute in herohost:world if entity @p[x=-125,y=50,z=-376,dx=250,dy=100,dz=250] run function herohost:tnt/core \ No newline at end of file diff --git a/data/herohost/functions/tnt/core.mcfunction b/data/herohost/functions/tnt/core.mcfunction index 2549088..3b95464 100644 --- a/data/herohost/functions/tnt/core.mcfunction +++ b/data/herohost/functions/tnt/core.mcfunction @@ -1,7 +1,13 @@ # --- HeroGames - Copyright (c) HeroHost team (code provided by HeroChris). --- # give and remove tnt -item replace entity @a[tag=hc.get_tnt] armor.head with tnt{HideFlags:1,Enchantments:[{id:"minecraft:binding_curse",lvl:1s}]} 1 -item replace entity @a[tag=hc.give_tnt] armor.head with air 1 +item replace entity @a[tag=hc.get_tnt] armor.head with tnt{HideFlags:1,Enchantments:[{id:"minecraft:binding_curse",lvl:1s}],AttributeModifiers:[{Slot:"head",AttributeName:"generic.movement_speed", Name:"generic.movement_speed", Amount:0.02, Operation:0, UUID:[I;1,1,1,1]}],display:{Name:'[{"text":"Hostile boom box","color":"#de3131","italic":false}]',Lore:['{"text":"Stop reading.. get rid of it!"}','{"text":""}','{"text":"+2% Speed","color":"dark_green","italic":false}']}} 1 +clear @a[tag=hc.give_tnt] minecraft:tnt + +# tnt in offhand +execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:tnt"}]}] if entity @s[nbt=!{Inventory:[{Slot:-106b,id:"minecraft:tnt"}]}] run clear @s minecraft:tnt{clear:1b} +execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:tnt"}]}] if entity @s[nbt=!{Inventory:[{Slot:-106b,id:"minecraft:tnt"}]}] run item replace entity @s weapon.offhand with minecraft:tnt{clear:1b} + +# remove get/give tag tag @a remove hc.get_tnt tag @a remove hc.give_tnt \ No newline at end of file diff --git a/data/herohost/functions/tnt/get_tnt.mcfunction b/data/herohost/functions/tnt/get_tnt.mcfunction index 06fcb69..576c623 100644 --- a/data/herohost/functions/tnt/get_tnt.mcfunction +++ b/data/herohost/functions/tnt/get_tnt.mcfunction @@ -1,4 +1,6 @@ # --- HeroGames - Copyright (c) HeroHost team (code provided by HeroChris). --- +playsound minecraft:entity.firework_rocket.launch record @a ~ ~ ~ 1 1 1 +particle minecraft:totem_of_undying ~ ~1 ~ 0 0 0 1 30 normal advancement revoke @s only herohost:tnt/get_tnt tag @s add hc.get_tnt \ No newline at end of file diff --git a/data/herohost/functions/tnt/give_tnt.mcfunction b/data/herohost/functions/tnt/give_tnt.mcfunction index 8bf026a..b2febd0 100644 --- a/data/herohost/functions/tnt/give_tnt.mcfunction +++ b/data/herohost/functions/tnt/give_tnt.mcfunction @@ -1,4 +1,4 @@ # --- HeroGames - Copyright (c) HeroHost team (code provided by HeroChris). --- advancement revoke @s only herohost:tnt/give_tnt -tag @s add hc.give_tnt \ No newline at end of file +tag @s add hc.give_tnt