From b8640b88dd476a840571673caa2c04c4d7d9d2d3 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Wed, 16 Aug 2023 17:51:03 -0500 Subject: [PATCH 1/6] Fix Day 1 tool time warning --- .../functions/rewards/announce_day1_tool_warning.mcfunction | 6 +++--- .../data/nincodedo/functions/rewards/load.mcfunction | 2 ++ .../ocw-stuff/data/nincodedo/functions/tick.mcfunction | 1 + .../functions/triggers/day1tooltimecheck.mcfunction | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/day1tooltimecheck.mcfunction diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/announce_day1_tool_warning.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/announce_day1_tool_warning.mcfunction index 90dcdaf4..3aecdc30 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/announce_day1_tool_warning.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/announce_day1_tool_warning.mcfunction @@ -1,4 +1,4 @@ title @s actionbar [{"score":{"name": "@s","objective": "day1tooldisplay"}},{"text": " minutes remaining on your Day 1 tools"}] -tag @s[scores={day1tooldisplay=15}] add 1stday1toolwarning -tag @s[scores={day1tooldisplay=10}] add 2ndday1toolwarning -tag @s[scores={day1tooldisplay=5}] add 3rdday1toolwarning +tag @s[scores={day1tooldisplay=..15}] add 1stday1toolwarning +tag @s[scores={day1tooldisplay=..10}] add 2ndday1toolwarning +tag @s[scores={day1tooldisplay=..5}] add 3rdday1toolwarning diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/load.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/load.mcfunction index e6df0531..efcd7903 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/load.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/load.mcfunction @@ -1,4 +1,6 @@ scoreboard objectives add day1toolticks dummy +scoreboard objectives add day1tooldisplay dummy +scoreboard objectives add day1tooltime trigger scoreboard players set day1tooltickinit rhcconfig 24000 scoreboard players set ticktominutes math 1200 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction index ebecfdb9..dcf06aba 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction @@ -1,5 +1,6 @@ execute as @a[scores={bannerplz=1}] at @s run function nincodedo:triggers/givebannerforlocation execute as @a[scores={nopotionsplz=1}] run function nincodedo:triggers/nopotionsplz +execute as @a[scores={day1tooltime=1}] run function nincodedo:triggers/day1tooltimecheck execute as @a[tag=!triggerbannerenabled] run function nincodedo:util/setup_new_player execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run scoreboard players enable @s nopotionsplz execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run tag @s add triggernopotionenabled diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/day1tooltimecheck.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/day1tooltimecheck.mcfunction new file mode 100644 index 00000000..3c753908 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/day1tooltimecheck.mcfunction @@ -0,0 +1,4 @@ +function nincodedo:rewards/announce_day1_tool_warning + +scoreboard players set @s day1tooltime 0 +scoreboard players enable @s day1tooltime From 5c9dc7a10a6419938d21f865dcc8225f20c1a5b6 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Wed, 16 Aug 2023 17:53:08 -0500 Subject: [PATCH 2/6] Initial --- .../ocw-stuff/data/nincodedo/functions/load.mcfunction | 6 ++++++ .../ocw-stuff/data/nincodedo/functions/tick.mcfunction | 1 + .../functions/triggers/ping/lifetime_watch.mcfunction | 4 ++++ .../nincodedo/functions/triggers/ping/raycast.mcfunction | 6 ++++++ .../functions/triggers/ping/start_ping.mcfunction | 5 +++++ .../functions/triggers/ping/this_block.mcfunction | 7 +++++++ .../functions/triggers/ping/this_entity.mcfunction | 4 ++++ .../nincodedo/functions/util/setup_new_player.mcfunction | 1 + 8 files changed, 34 insertions(+) create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/lifetime_watch.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/raycast.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/start_ping.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_entity.mcfunction diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction index d2faa417..d44b0c80 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction @@ -6,6 +6,9 @@ scoreboard objectives add advrewards dummy scoreboard objectives add bannerplz trigger scoreboard players enable @a bannerplz scoreboard objectives add ocwplayergiftcount dummy +scoreboard objectives add ping_lifetime dummy +scoreboard objectives add raycast_steps dummy +scoreboard objectives add ping trigger execute store result score current_day rhcdata run time query day function nincodedo:setuplogbreakcount @@ -18,3 +21,6 @@ scoreboard players set 8 math 8 scoreboard players set 5 math 5 scoreboard players set 2 math 2 scoreboard players set m1 math -1 + +scoreboard players set config_ping_ping_lifetime rhcconfig 140 +scoreboard players set max_raycast_steps rhcconfig 120 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction index dcf06aba..156e1908 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction @@ -1,6 +1,7 @@ execute as @a[scores={bannerplz=1}] at @s run function nincodedo:triggers/givebannerforlocation execute as @a[scores={nopotionsplz=1}] run function nincodedo:triggers/nopotionsplz execute as @a[scores={day1tooltime=1}] run function nincodedo:triggers/day1tooltimecheck +execute as @a[scores={ping=1}] at @s run function nincodedo:triggers/ping/start_ping execute as @a[tag=!triggerbannerenabled] run function nincodedo:util/setup_new_player execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run scoreboard players enable @s nopotionsplz execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run tag @s add triggernopotionenabled diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/lifetime_watch.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/lifetime_watch.mcfunction new file mode 100644 index 00000000..1f834a29 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/lifetime_watch.mcfunction @@ -0,0 +1,4 @@ +scoreboard players remove @e[tag=ping] ping_lifetime 1 +kill @e[tag=block_ping,scores={ping_lifetime=..0}] + +execute if entity @e[tag=ping] run schedule function nincodedo:triggers/ping/lifetime_watch 1t diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/raycast.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/raycast.mcfunction new file mode 100644 index 00000000..26d1b700 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/raycast.mcfunction @@ -0,0 +1,6 @@ +execute if score @s raycast_steps > max_raycast_steps rhcconfig run tag @s remove raycasting +execute if entity @s[tag=!raycasting] run return 0 +execute if entity @s[tag=raycasting] if block ~ ~ ~ minecraft:air unless entity @e[distance=..1.5,type=!minecraft:marker,type=!minecraft:interaction,tag=!raycasting] positioned ^ ^ ^0.5 run function nincodedo:triggers/ping/raycast +execute if entity @s[tag=raycasting] unless block ~ ~ ~ minecraft:air run function nincodedo:triggers/ping/this_block +execute if entity @s[tag=raycasting] if entity @e[distance=..1.5,type=!minecraft:marker,type=!minecraft:interaction,tag=!raycasting] run function nincodedo:triggers/ping/this_entity +scoreboard players add @s raycast_steps 1 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/start_ping.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/start_ping.mcfunction new file mode 100644 index 00000000..6afc4c2e --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/start_ping.mcfunction @@ -0,0 +1,5 @@ +scoreboard players reset @s ping +scoreboard players enable @s ping +scoreboard players reset @s raycast_steps +tag @s add raycasting +execute anchored eyes positioned ^ ^ ^1 run function nincodedo:triggers/ping/raycast diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction new file mode 100644 index 00000000..18c74d6c --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction @@ -0,0 +1,7 @@ +tag @s remove raycasting +execute align xyz run summon minecraft:block_display ~ ~ ~ {Glowing:true,block_state:{Name:"minecraft:light_gray_stained_glass"},Tags:["block_ping","ping"]} +data modify entity @e[tag=ping,sort=nearest,limit=1] transformation.scale set value [0.98f,0.98f,0.98f] +execute as @e[tag=ping,sort=nearest,limit=1] at @s run tp ~0.01 ~0.01 ~0.01 +playsound minecraft:entity.player.levelup player @a ~ ~ ~ 1 2 +execute as @e[tag=ping,sort=nearest,limit=1] store result score @s ping_lifetime run scoreboard players get config_ping_ping_lifetime rhcconfig +schedule function nincodedo:triggers/ping/lifetime_watch 1t diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_entity.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_entity.mcfunction new file mode 100644 index 00000000..37615764 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_entity.mcfunction @@ -0,0 +1,4 @@ +effect give @e[distance=..1.5,type=!minecraft:marker,type=!minecraft:interaction,tag=!raycasting] glowing 10 0 true +playsound minecraft:entity.player.levelup player @a ~ ~ ~ 1 2 + +tag @s remove raycasting diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction index 660f74e6..5ad2a436 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction @@ -1,4 +1,5 @@ scoreboard players enable @s bannerplz +scoreboard players enable @s ping loot give @s loot nincodedo:docs/faq_book execute store result score @s day1toolticks run scoreboard players get day1tooltickinit rhcconfig From 8c4d24883a685b194c5bdf6997f661a617166055 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Wed, 16 Aug 2023 22:13:36 -0500 Subject: [PATCH 3/6] Add color config for ping --- .../data/nincodedo/functions/load.mcfunction | 7 +--- .../data/nincodedo/functions/tick.mcfunction | 5 +++ .../triggers/ping/color_ping_block.mcfunction | 35 +++++++++++++++++++ .../functions/triggers/ping/load.mcfunction | 8 +++++ .../triggers/ping/set_config.mcfunction | 4 +++ .../triggers/ping/show_config.mcfunction | 4 +++ .../triggers/ping/this_block.mcfunction | 1 + .../util/setup_new_player.mcfunction | 1 + 8 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/color_ping_block.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/set_config.mcfunction create mode 100644 datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction index d44b0c80..1715f2f5 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/load.mcfunction @@ -1,14 +1,12 @@ function nincodedo:uniqueitems/load function nincodedo:items/load function nincodedo:rewards/load +function nincodedo:triggers/ping/load scoreboard objectives add advrewards dummy scoreboard objectives add bannerplz trigger scoreboard players enable @a bannerplz scoreboard objectives add ocwplayergiftcount dummy -scoreboard objectives add ping_lifetime dummy -scoreboard objectives add raycast_steps dummy -scoreboard objectives add ping trigger execute store result score current_day rhcdata run time query day function nincodedo:setuplogbreakcount @@ -21,6 +19,3 @@ scoreboard players set 8 math 8 scoreboard players set 5 math 5 scoreboard players set 2 math 2 scoreboard players set m1 math -1 - -scoreboard players set config_ping_ping_lifetime rhcconfig 140 -scoreboard players set max_raycast_steps rhcconfig 120 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction index 156e1908..ee25b3f9 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/tick.mcfunction @@ -2,7 +2,12 @@ execute as @a[scores={bannerplz=1}] at @s run function nincodedo:triggers/giveba execute as @a[scores={nopotionsplz=1}] run function nincodedo:triggers/nopotionsplz execute as @a[scores={day1tooltime=1}] run function nincodedo:triggers/day1tooltimecheck execute as @a[scores={ping=1}] at @s run function nincodedo:triggers/ping/start_ping +execute as @a[scores={ping_config=0}] run function nincodedo:triggers/ping/show_config +execute as @a[scores={ping_config=1..16}] run function nincodedo:triggers/ping/set_config execute as @a[tag=!triggerbannerenabled] run function nincodedo:util/setup_new_player +execute as @a[tag=!ping_config_set] run scoreboard players enable @s ping_config +execute as @a[tag=!ping_config_set] run scoreboard players set @s ping_config -1 +execute as @a[tag=!ping_config_set] run tag @s add ping_config_set execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run scoreboard players enable @s nopotionsplz execute if score potionhorn rhcdata matches 1 as @a[tag=!triggernopotionenabled] run tag @s add triggernopotionenabled scoreboard players enable @a[advancements={nincodedo:unique_items/ascend/main=true},tag=!triggerascendemr] ascend_emergency_fix diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/color_ping_block.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/color_ping_block.mcfunction new file mode 100644 index 00000000..20e02833 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/color_ping_block.mcfunction @@ -0,0 +1,35 @@ +execute if score @s ping_color matches 1..16 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] Glowing set value true + +execute if score @s ping_color matches 1 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:white_stained_glass" +execute if score @s ping_color matches 2 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:light_gray_stained_glass" +execute if score @s ping_color matches 3 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:gray_stained_glass" +execute if score @s ping_color matches 4 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:black_stained_glass" +execute if score @s ping_color matches 5 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:brown_stained_glass" +execute if score @s ping_color matches 6 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:red_stained_glass" +execute if score @s ping_color matches 7 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:orange_stained_glass" +execute if score @s ping_color matches 8 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:yellow_stained_glass" +execute if score @s ping_color matches 9 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:lime_stained_glass" +execute if score @s ping_color matches 10 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:green_stained_glass" +execute if score @s ping_color matches 11 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:cyan_stained_glass" +execute if score @s ping_color matches 12 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:light_blue_stained_glass" +execute if score @s ping_color matches 13 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:blue_stained_glass" +execute if score @s ping_color matches 14 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:purple_stained_glass" +execute if score @s ping_color matches 15 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:magenta_stained_glass" +execute if score @s ping_color matches 16 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] block_state.Name set value "minecraft:pink_stained_glass" + +execute if score @s ping_color matches 1 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16777215 +execute if score @s ping_color matches 2 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 13882323 +execute if score @s ping_color matches 3 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 8421504 +execute if score @s ping_color matches 4 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 1315860 +execute if score @s ping_color matches 5 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 9127187 +execute if score @s ping_color matches 6 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16711680 +execute if score @s ping_color matches 7 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16753920 +execute if score @s ping_color matches 8 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16776960 +execute if score @s ping_color matches 9 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 12582656 +execute if score @s ping_color matches 10 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 65280 +execute if score @s ping_color matches 11 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 65535 +execute if score @s ping_color matches 12 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 11393254 +execute if score @s ping_color matches 13 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 255 +execute if score @s ping_color matches 14 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 8388736 +execute if score @s ping_color matches 15 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16711935 +execute if score @s ping_color matches 16 run data modify entity @e[tag=block_ping,sort=nearest,limit=1] glow_color_override set value 16761035 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction new file mode 100644 index 00000000..2569735c --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction @@ -0,0 +1,8 @@ +scoreboard objectives add ping_lifetime dummy +scoreboard objectives add ping_color dummy +scoreboard objectives add raycast_steps dummy +scoreboard objectives add ping trigger +scoreboard objectives add ping_config trigger + +scoreboard players set config_ping_ping_lifetime rhcconfig 140 +scoreboard players set max_raycast_steps rhcconfig 120 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/set_config.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/set_config.mcfunction new file mode 100644 index 00000000..fe09d53c --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/set_config.mcfunction @@ -0,0 +1,4 @@ +execute if score @s ping_config matches 1..16 store result score @s ping_color run scoreboard players get @s ping_config + +scoreboard players enable @s ping_config +scoreboard players set @s ping_config -1 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction new file mode 100644 index 00000000..a9abf675 --- /dev/null +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction @@ -0,0 +1,4 @@ +tellraw @s [{"text":"---Ping Color Config---\n"},{"text":"Click on a color to set your ping block's color.\n"},{"text":"White","color":"white","clickEvent":{"action":"run_command","value":"/trigger ping_config set 1"}},{"text":" - "},{"text":"Light Gray","color":"#d3d3d3","clickEvent":{"action":"run_command","value":"/trigger ping_config set 2"}},{"text":" - "},{"text":"Gray","color":"#808080","clickEvent":{"action":"run_command","value":"/trigger ping_config set 3"}},{"text":" - "},{"text":"Black\n","color":"#161616","clickEvent":{"action":"run_command","value":"/trigger ping_config set 4"}},{"text":"Brown","color":"#a52a2a","clickEvent":{"action":"run_command","value":"/trigger ping_config set 5"}},{"text":" - "},{"text":"Red","color":"red","clickEvent":{"action":"run_command","value":"/trigger ping_config set 6"}},{"text":" - "},{"text":"Orange","color":"#ffa500","clickEvent":{"action":"run_command","value":"/trigger ping_config set 7"}},{"text":" - "},{"text":"Yellow\n","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger ping_config set 8"}},{"text":"Lime","color":"green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 9"}},{"text":" - "},{"text":"Green","color":"dark_green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 10"}},{"text":" - "},{"text":"Cyan","color":"#1E817F","clickEvent":{"action":"run_command","value":"/trigger ping_config set 11"}},{"text":" - "},{"text":"Light Blue\n","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger ping_config set 12"}},{"text":"Blue","color":"blue","clickEvent":{"action":"run_command","value":"/trigger ping_config set 13"}},{"text":" - "},{"text":"Purple","color":"dark_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 14"}},{"text":" - "},{"text":"Magenta","color":"light_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 15"}},{"text":" - "},{"text":"Pink","color":"#ffcccc"}] + +scoreboard players enable @s ping_config +scoreboard players set @s ping_config -1 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction index 18c74d6c..ed1b6c22 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/this_block.mcfunction @@ -1,5 +1,6 @@ tag @s remove raycasting execute align xyz run summon minecraft:block_display ~ ~ ~ {Glowing:true,block_state:{Name:"minecraft:light_gray_stained_glass"},Tags:["block_ping","ping"]} +function nincodedo:triggers/ping/color_ping_block data modify entity @e[tag=ping,sort=nearest,limit=1] transformation.scale set value [0.98f,0.98f,0.98f] execute as @e[tag=ping,sort=nearest,limit=1] at @s run tp ~0.01 ~0.01 ~0.01 playsound minecraft:entity.player.levelup player @a ~ ~ ~ 1 2 diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction index 5ad2a436..180ea25d 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/util/setup_new_player.mcfunction @@ -1,5 +1,6 @@ scoreboard players enable @s bannerplz scoreboard players enable @s ping +execute unless score @s ping_color matches 1..16 run scoreboard players set @s ping_color 2 loot give @s loot nincodedo:docs/faq_book execute store result score @s day1toolticks run scoreboard players get day1tooltickinit rhcconfig From b8254d7956f4a2493414472f7401df1f8c186af0 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Thu, 17 Aug 2023 12:33:22 -0500 Subject: [PATCH 4/6] Add docs --- docs/index.md | 1 + docs/trigger/index.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 docs/trigger/index.md diff --git a/docs/index.md b/docs/index.md index 1cfcc2b0..c19531f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -14,6 +14,7 @@ There are a few non-vanilla Java Minecraft features implemented through datapack - [Minecraft Bedrock's bone meal](https://github.com/Nincodedo/mc-java-bedrock-bone-meal-datapack) - [Custom composter items](customcomposter/index.md) +- [Trigger Commands](trigger/index.md) ### OCW Features diff --git a/docs/trigger/index.md b/docs/trigger/index.md new file mode 100644 index 00000000..dc38dc3b --- /dev/null +++ b/docs/trigger/index.md @@ -0,0 +1,17 @@ +# Trigger Commands + +## bannerplz + +Using `/trigger bannerplz` when at certain structure locations will give the player a banner. The banner is intended to be placed at the structure and used for maps. This trigger has a 2 minute cooldown. + +## day1tooltime + +Using `/trigger day1tooltime` will show you how much time you have left on your Day 1 tools. + +## ping + +Using `/trigger ping` will highlight the block or entity you're looking at to notify other players. + +### ping_config + +As part of `/trigger ping`, you can also use `/trigger ping_config` to change your ping's block color. From 336aefc4f99acbbfd0ee461d8a1019f5addb83f8 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Thu, 17 Aug 2023 12:33:50 -0500 Subject: [PATCH 5/6] Change Day 1 tool time trigger to only be enabled when you have Day 1 tool time remaining --- .../data/nincodedo/functions/rewards/removeday1tools.mcfunction | 1 + docs/trigger/index.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/removeday1tools.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/removeday1tools.mcfunction index 46db0d20..968d4ded 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/rewards/removeday1tools.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/rewards/removeday1tools.mcfunction @@ -8,3 +8,4 @@ tellraw @s[scores={clearday1tools=1}] {"text":"Aww, your Day 1 tool vanished..." tellraw @s[scores={clearday1tools=2..}] [{"text":"Aww, your "},{"score":{"name":"@s","objective":"clearday1tools"}},{"text":" Day 1 tools vanished..."}] advancement revoke @s only nincodedo:rewards/removeday1tools +scoreboard players reset @s day1tooltime diff --git a/docs/trigger/index.md b/docs/trigger/index.md index dc38dc3b..0c740979 100644 --- a/docs/trigger/index.md +++ b/docs/trigger/index.md @@ -6,7 +6,7 @@ Using `/trigger bannerplz` when at certain structure locations will give the pla ## day1tooltime -Using `/trigger day1tooltime` will show you how much time you have left on your Day 1 tools. +Using `/trigger day1tooltime` will show you how much time you have left on your Day 1 tools. This trigger is only available if you have remaining Day 1 tool time. ## ping From 04bff02a594ed0b4f615dfaed7d2ad4544533c42 Mon Sep 17 00:00:00 2001 From: Nincodedo Date: Thu, 17 Aug 2023 17:05:48 -0500 Subject: [PATCH 6/6] Display current ping color on the config --- .../functions/triggers/ping/load.mcfunction | 17 +++++++++++++++++ .../triggers/ping/show_config.mcfunction | 19 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction index 2569735c..813cbadf 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/load.mcfunction @@ -6,3 +6,20 @@ scoreboard objectives add ping_config trigger scoreboard players set config_ping_ping_lifetime rhcconfig 140 scoreboard players set max_raycast_steps rhcconfig 120 + +data modify storage nincodedo:storage colors append value "White" +data modify storage nincodedo:storage colors append value "Light Gray" +data modify storage nincodedo:storage colors append value "Gray" +data modify storage nincodedo:storage colors append value "Black" +data modify storage nincodedo:storage colors append value "Brown" +data modify storage nincodedo:storage colors append value "Red" +data modify storage nincodedo:storage colors append value "Orange" +data modify storage nincodedo:storage colors append value "Yellow" +data modify storage nincodedo:storage colors append value "Lime" +data modify storage nincodedo:storage colors append value "Green" +data modify storage nincodedo:storage colors append value "Cyan" +data modify storage nincodedo:storage colors append value "Light Blue" +data modify storage nincodedo:storage colors append value "Blue" +data modify storage nincodedo:storage colors append value "Purple" +data modify storage nincodedo:storage colors append value "Magenta" +data modify storage nincodedo:storage colors append value "Pink" diff --git a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction index a9abf675..0709060e 100644 --- a/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction +++ b/datapacks/ocw-stuff/data/nincodedo/functions/triggers/ping/show_config.mcfunction @@ -1,4 +1,21 @@ -tellraw @s [{"text":"---Ping Color Config---\n"},{"text":"Click on a color to set your ping block's color.\n"},{"text":"White","color":"white","clickEvent":{"action":"run_command","value":"/trigger ping_config set 1"}},{"text":" - "},{"text":"Light Gray","color":"#d3d3d3","clickEvent":{"action":"run_command","value":"/trigger ping_config set 2"}},{"text":" - "},{"text":"Gray","color":"#808080","clickEvent":{"action":"run_command","value":"/trigger ping_config set 3"}},{"text":" - "},{"text":"Black\n","color":"#161616","clickEvent":{"action":"run_command","value":"/trigger ping_config set 4"}},{"text":"Brown","color":"#a52a2a","clickEvent":{"action":"run_command","value":"/trigger ping_config set 5"}},{"text":" - "},{"text":"Red","color":"red","clickEvent":{"action":"run_command","value":"/trigger ping_config set 6"}},{"text":" - "},{"text":"Orange","color":"#ffa500","clickEvent":{"action":"run_command","value":"/trigger ping_config set 7"}},{"text":" - "},{"text":"Yellow\n","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger ping_config set 8"}},{"text":"Lime","color":"green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 9"}},{"text":" - "},{"text":"Green","color":"dark_green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 10"}},{"text":" - "},{"text":"Cyan","color":"#1E817F","clickEvent":{"action":"run_command","value":"/trigger ping_config set 11"}},{"text":" - "},{"text":"Light Blue\n","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger ping_config set 12"}},{"text":"Blue","color":"blue","clickEvent":{"action":"run_command","value":"/trigger ping_config set 13"}},{"text":" - "},{"text":"Purple","color":"dark_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 14"}},{"text":" - "},{"text":"Magenta","color":"light_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 15"}},{"text":" - "},{"text":"Pink","color":"#ffcccc"}] +execute if score @s ping_color matches 1 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[0] +execute if score @s ping_color matches 2 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[1] +execute if score @s ping_color matches 3 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[2] +execute if score @s ping_color matches 4 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[3] +execute if score @s ping_color matches 5 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[4] +execute if score @s ping_color matches 6 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[5] +execute if score @s ping_color matches 7 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[6] +execute if score @s ping_color matches 8 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[7] +execute if score @s ping_color matches 9 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[8] +execute if score @s ping_color matches 10 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[9] +execute if score @s ping_color matches 11 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[10] +execute if score @s ping_color matches 12 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[11] +execute if score @s ping_color matches 13 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[12] +execute if score @s ping_color matches 14 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[13] +execute if score @s ping_color matches 15 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[14] +execute if score @s ping_color matches 16 run data modify storage nincodedo:storage current_color set from storage nincodedo:storage colors[15] + +tellraw @s [{"text":"---Ping Color Config---\n"},{"text":"Click on a color to set your ping block's color.\n"},{"text":"Current ping color: "},{"nbt":"current_color","storage":"nincodedo:storage"},{"text":"\n"},{"text":"White","color":"white","clickEvent":{"action":"run_command","value":"/trigger ping_config set 1"}},{"text":" - "},{"text":"Light Gray","color":"#d3d3d3","clickEvent":{"action":"run_command","value":"/trigger ping_config set 2"}},{"text":" - "},{"text":"Gray","color":"#808080","clickEvent":{"action":"run_command","value":"/trigger ping_config set 3"}},{"text":" - "},{"text":"Black\n","color":"#161616","clickEvent":{"action":"run_command","value":"/trigger ping_config set 4"}},{"text":"Brown","color":"#a52a2a","clickEvent":{"action":"run_command","value":"/trigger ping_config set 5"}},{"text":" - "},{"text":"Red","color":"red","clickEvent":{"action":"run_command","value":"/trigger ping_config set 6"}},{"text":" - "},{"text":"Orange","color":"#ffa500","clickEvent":{"action":"run_command","value":"/trigger ping_config set 7"}},{"text":" - "},{"text":"Yellow\n","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger ping_config set 8"}},{"text":"Lime","color":"green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 9"}},{"text":" - "},{"text":"Green","color":"dark_green","clickEvent":{"action":"run_command","value":"/trigger ping_config set 10"}},{"text":" - "},{"text":"Cyan","color":"#1E817F","clickEvent":{"action":"run_command","value":"/trigger ping_config set 11"}},{"text":" - "},{"text":"Light Blue\n","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger ping_config set 12"}},{"text":"Blue","color":"blue","clickEvent":{"action":"run_command","value":"/trigger ping_config set 13"}},{"text":" - "},{"text":"Purple","color":"dark_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 14"}},{"text":" - "},{"text":"Magenta","color":"light_purple","clickEvent":{"action":"run_command","value":"/trigger ping_config set 15"}},{"text":" - "},{"text":"Pink","color":"#ffcccc"}] scoreboard players enable @s ping_config scoreboard players set @s ping_config -1