Skip to content

Commit

Permalink
implement most of it
Browse files Browse the repository at this point in the history
  • Loading branch information
katelyynn committed Jul 20, 2022
1 parent 77cba95 commit c9ae748
Show file tree
Hide file tree
Showing 23 changed files with 466 additions and 0 deletions.
26 changes: 26 additions & 0 deletions data/acrace/functions/defaults.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ACRACE defaults


# general timings
scoreboard players set period internal -1

# extras
scoreboard players set cut_clean global 1
scoreboard players set speed_uhc global 1

# world
worldborder set 10
gamerule doImmediateRespawn true
gamerule keepInventory false
effect clear @a
gamemode adventure @a[gamemode=!spectator]


# score
scoreboard players set score_increase global 10
# win time
## 2400 = 40 min
scoreboard players set end_time global 2400


scoreboard players set defaults internal 1
57 changes: 57 additions & 0 deletions data/acrace/functions/extras/cut_clean.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# CUT CLEAN
## auto-smelts ores & food


# 1.17+ ores
## iron
execute as @e[type=item,name="Raw Iron"] at @s run summon item ~ ~ ~ {Item:{id:"iron_ingot",Count:2b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Iron"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Iron"] at @s run kill @s
## gold
execute as @e[type=item,name="Raw Gold"] at @s run summon item ~ ~ ~ {Item:{id:"gold_ingot",Count:2b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Gold"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Gold"] at @s run kill @s
## copper
execute as @e[type=item,name="Raw Copper"] at @s run summon item ~ ~ ~ {Item:{id:"copper_ingot",Count:2b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Copper"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Copper"] at @s run kill @s

# 1.16- ores
## iron
execute as @e[type=item,name="Iron Ore"] at @s run summon item ~ ~ ~ {Item:{id:"iron_ingot",Count:2b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Iron Ore"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Iron Ore"] at @s run kill @s
## gold
execute as @e[type=item,name="Gold Ore"] at @s run summon item ~ ~ ~ {Item:{id:"gold_ingot",Count:2b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Gold Ore"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Gold Ore"] at @s run kill @s

# food
## porkchop
execute as @e[type=item,name="Raw Porkchop"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_porkchop",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Porkchop"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Porkchop"] at @s run kill @s
## mutton
execute as @e[type=item,name="Raw Mutton"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_mutton",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Mutton"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Mutton"] at @s run kill @s
## steak
execute as @e[type=item,name="Raw Beef"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_beef",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Beef"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Beef"] at @s run kill @s
## chicken
execute as @e[type=item,name="Raw Chicken"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_chicken",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Chicken"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Chicken"] at @s run kill @s
## rabbit
execute as @e[type=item,name="Raw Rabbit"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_rabbit",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Rabbit"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Rabbit"] at @s run kill @s
## cod
execute as @e[type=item,name="Raw Cod"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_cod",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Cod"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Cod"] at @s run kill @s
## salmon
execute as @e[type=item,name="Raw Salmon"] at @s run summon item ~ ~ ~ {Item:{id:"cooked_salmon",Count:1b},Motion:[0.0,0.05,0.0],PickupDelay:12s}
execute as @e[type=item,name="Raw Salmon"] at @s run particle minecraft:smoke ~ ~ ~ 0 0 0 0.01 30
execute as @e[type=item,name="Raw Salmon"] at @s run kill @s
9 changes: 9 additions & 0 deletions data/acrace/functions/extras/grindstone.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPEED UHC Grindstone patch
## prevents an infinite enchanting exploit


# fill away grindstones
execute as @a at @s run fill ~-5 ~-5 ~-5 ~5 ~5 ~5 air replace grindstone

# clear grindstones from inv
clear @a grindstone
5 changes: 5 additions & 0 deletions data/acrace/functions/extras/speed_uhc.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPEED UHC
## auto-enchants tools


enchant @a efficiency 2
24 changes: 24 additions & 0 deletions data/acrace/functions/last_login.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ACRACE last-login checks


# -1, pre-start
execute if score period internal matches -1 run gamemode adventure @a[gamemode=!adventure,team=!admin]
execute if score period internal matches -1 run effect give @a weakness 9999 255 true
execute if score period internal matches -1 run effect give @a resistance 9999 255 true
execute if score period internal matches -1 run effect give @a regeneration 9999 255 true
execute if score period internal matches -1 run effect give @a saturation 9999 255 true
execute if score period internal matches -1 run scoreboard players set @a last_login -1
# 1, main game
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run gamemode survival @s[team=!admin,gamemode=!spectator]
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run effect clear @s weakness
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run effect clear @s resistance
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run effect clear @s regeneration
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run effect clear @s saturation
execute as @a if score period internal matches 1 unless score @s last_login matches 1 run scoreboard players set @s last_login 1
# 3, victory
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run gamemode spectator @s[tag=!win,team=!admin]
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run effect clear @s weakness
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run effect give @s resistance 9999 255 true
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run effect clear @s regeneration
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run effect clear @s saturation
execute as @a if score period internal matches 3 unless score @s last_login matches 3 run scoreboard players set @s last_login 3
18 changes: 18 additions & 0 deletions data/acrace/functions/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ACRACE /reload


# scoreboards
scoreboard objectives add global dummy
scoreboard objectives add internal dummy
scoreboard objectives add last_login dummy

# track score
scoreboard objectives add score dummy ["",{"text":"[","color":"dark_gray"},{"text":"⭐","color":"green"},{"text":"]","color":"dark_gray"}]
scoreboard objectives setdisplay sidebar score

# bossbar
bossbar add acrace:main ""
bossbar set acrace:main color green

# defaults
execute unless score defaults internal matches 1.. run function acrace:defaults
25 changes: 25 additions & 0 deletions data/acrace/functions/main.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ACRACE main loop


# world
bossbar set acrace:main players @a

# time loop
function acrace:time

# achievement checks
execute if score period internal matches 1 run function acrace:pick/checks

# options
execute if score cut_clean global matches 1.. run function acrace:extras/cut_clean
execute if score speed_uhc global matches 1.. run function acrace:extras/speed_uhc
execute if score speed_uhc global matches 1.. run function acrace:extras/grindstone

# win checks
execute if score time_s internal >= end_time global run function acrace:win/checks

# range check for points
execute as @a unless score @s score matches 0.. run scoreboard players set @s score 0

# period checks
function acrace:last_login
42 changes: 42 additions & 0 deletions data/acrace/functions/pick/checks.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ACRACE achievement checks
# check if user has earned achivement


#> TODO: add all vanilla & modded? achievements


## generate.html
## typing this by hand would be awful:

execute if score achievement internal matches 0 if entity @a[advancements={minecraft:story/obtain_armor=true}] as @a[advancements={minecraft:story/obtain_armor=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 1 if entity @a[advancements={minecraft:story/lava_bucket=true}] as @a[advancements={minecraft:story/lava_bucket=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 2 if entity @a[advancements={minecraft:story/iron_tools=true}] as @a[advancements={minecraft:story/iron_tools=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 3 if entity @a[advancements={minecraft:story/deflect_arrow=true}] as @a[advancements={minecraft:story/deflect_arrow=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 4 if entity @a[advancements={minecraft:story/form_obsidian=true}] as @a[advancements={minecraft:story/form_obsidian=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 5 if entity @a[advancements={minecraft:story/mine_diamond=true}] as @a[advancements={minecraft:story/mine_diamond=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 6 if entity @a[advancements={minecraft:story/enter_the_nether=true}] as @a[advancements={minecraft:story/enter_the_nether=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 7 if entity @a[advancements={minecraft:story/shiny_gear=true}] as @a[advancements={minecraft:story/shiny_gear=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 8 if entity @a[advancements={minecraft:story/enchant_item=true}] as @a[advancements={minecraft:story/enchant_item=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 9 if entity @a[advancements={minecraft:nether/return_to_sender=true}] as @a[advancements={minecraft:nether/return_to_sender=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 10 if entity @a[advancements={minecraft:nether/find_bastion=true}] as @a[advancements={minecraft:nether/find_bastion=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 11 if entity @a[advancements={minecraft:nether/find_fortress=true}] as @a[advancements={minecraft:nether/find_fortress=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 12 if entity @a[advancements={minecraft:nether/obtain_crying_obsidian=true}] as @a[advancements={minecraft:nether/obtain_crying_obsidian=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 13 if entity @a[advancements={minecraft:nether/distract_piglin=true}] as @a[advancements={minecraft:nether/distract_piglin=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 14 if entity @a[advancements={minecraft:nether/obtain_blaze_rod=true}] as @a[advancements={minecraft:nether/obtain_blaze_rod=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 15 if entity @a[advancements={minecraft:adventure/spyglass_at_parrot=true}] as @a[advancements={minecraft:adventure/spyglass_at_parrot=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 16 if entity @a[advancements={minecraft:adventure/kill_a_mob=true}] as @a[advancements={minecraft:adventure/kill_a_mob=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 17 if entity @a[advancements={minecraft:adventure/trade=true}] as @a[advancements={minecraft:adventure/trade=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 18 if entity @a[advancements={minecraft:adventure/ol_betsy=true}] as @a[advancements={minecraft:adventure/ol_betsy=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 19 if entity @a[advancements={minecraft:adventure/sleep_in_bed=true}] as @a[advancements={minecraft:adventure/sleep_in_bed=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 20 if entity @a[advancements={minecraft:adventure/throw_trident=true}] as @a[advancements={minecraft:adventure/throw_trident=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 21 if entity @a[advancements={minecraft:adventure/shoot_arrow=true}] as @a[advancements={minecraft:adventure/shoot_arrow=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 22 if entity @a[advancements={minecraft:adventure/totem_of_undying=true}] as @a[advancements={minecraft:adventure/totem_of_undying=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 23 if entity @a[advancements={minecraft:adventure/summon_iron_golem=true}] as @a[advancements={minecraft:adventure/summon_iron_golem=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 24 if entity @a[advancements={minecraft:husbandry/safely_harvest_honey=true}] as @a[advancements={minecraft:husbandry/safely_harvest_honey=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 25 if entity @a[advancements={minecraft:husbandry/breed_an_animal=true}] as @a[advancements={minecraft:husbandry/breed_an_animal=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 26 if entity @a[advancements={minecraft:husbandry/tame_an_animal=true}] as @a[advancements={minecraft:husbandry/tame_an_animal=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 27 if entity @a[advancements={minecraft:husbandry/make_a_sign_glow=true}] as @a[advancements={minecraft:husbandry/make_a_sign_glow=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 28 if entity @a[advancements={minecraft:husbandry/fishy_business=true}] as @a[advancements={minecraft:husbandry/fishy_business=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 29 if entity @a[advancements={minecraft:husbandry/plant_seed=true}] as @a[advancements={minecraft:husbandry/plant_seed=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 30 if entity @a[advancements={minecraft:husbandry/tactical_fishing=true}] as @a[advancements={minecraft:husbandry/tactical_fishing=true},limit=1,sort=random] at @s run function achunt:pick/take
execute if score achievement internal matches 31 if entity @a[advancements={minecraft:husbandry/axolotl_in_a_bucket=true}] as @a[advancements={minecraft:husbandry/axolotl_in_a_bucket=true},limit=1,sort=random] at @s run function achunt:pick/take
9 changes: 9 additions & 0 deletions data/acrace/functions/pick/take.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ACRACE achievement take
## when a user earns a achievement
## ran as user


# announce
tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"+10","color":"green","bold":true},{"text":"] ","color":"dark_gray"},{"selector":"@s","color":"gold"},{"text":" earned an achievement!","color":"yellow"}]
# score
scoreboard players operation @s score += score_increase global
9 changes: 9 additions & 0 deletions data/acrace/functions/setup.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DS setup


#> TODO: rework to generate line-by-line
# tellraw
tellraw @a ["",{"text":"\nDEATHSWAP Setup\n\n","color":"red","bold":true},{"text":"Before the game begins, check your options and invite everyone to the game.\n"},{"text":"\nOPTIONS:","color":"red","bold":true},{"text":"\nCut Clean: "},{"text":"[ON]","color":"green","bold":true,"underlined":true,"hoverEvent":{"action":"show_text","contents":[{"text":"(default)"}]},"clickEvent":{"action":"run_command","value":"/scoreboard players set cut_clean global 1"}},{"text":" [OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set cut_clean global 0"}},{"text":"\nSpeed UHC: "},{"text":"[ON]","color":"green","bold":true,"underlined":true,"hoverEvent":{"action":"show_text","contents":[{"text":"(default)"}]},"clickEvent":{"action":"run_command","value":"/scoreboard players set speed_uhc global 1"}},{"text":" [OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set speed_uhc global 0"}},{"text":"\nSwap interval: "},{"text":"[1m]","color":"gray","clickEvent":{"action":"run_command","value":"/scoreboard players set interval global 60"}},{"text":" [3m]","color":"gray","clickEvent":{"action":"run_command","value":"/scoreboard players set interval global 180"}},{"text":" [5m]","color":"gold","underlined":true,"hoverEvent":{"action":"show_text","contents":[{"text":"(default)"}]},"clickEvent":{"action":"run_command","value":"/scoreboard players set interval global 500"}},{"text":" [7m]","color":"gray","clickEvent":{"action":"run_command","value":"/scoreboard players set interval global 420"}},{"text":" [10m]","color":"gray","clickEvent":{"action":"run_command","value":"/scoreboard players set interval global 600"}},{"text":"\n\nTo configure the interval more precisely, run "},{"text":"/scoreboard players set interval global ","color":"dark_gray"},{"text":"[value in s]","color":"gray"},{"text":"\nThe interval is also lowered every swap at 20s, configure with: "},{"text":"/scoreboard players set interval_lower global ","color":"dark_gray"},{"text":"[value in s]\n","color":"gray"},{"text":"\nOnce you're ready, run "},{"text":"/function ds:start","color":"green","clickEvent":{"action":"run_command","value":"/function ds:start"}},{"text":" and let the games begin!\n"}]


scoreboard players set setup internal 1
16 changes: 16 additions & 0 deletions data/acrace/functions/start.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ACRACE start


scoreboard players set can_start internal 0

# count up players
scoreboard players reset alive internal
execute as @a[gamemode=!spectator] run scoreboard players add alive internal 1

# check
execute if score alive internal matches 2.. run scoreboard players set can_start internal 1


# run
execute unless score can_start internal matches 1.. run tellraw @s ["",{"text":"[","color":"dark_gray"},{"text":"X","color":"red"},{"text":"] ","color":"dark_gray"},{"text":"Cannot start, atleast 2 people required for Achievement Race.","color":"red"}]
execute if score can_start internal matches 1.. run function acrace:start_c
23 changes: 23 additions & 0 deletions data/acrace/functions/start_c.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ACRACE start
## (if requirements met)


# remove tags
tag @a remove win

# announce
title @a title ["",{"text":"ACHIEVEMENT ","color":"green","bold":true},{"text":"RACE","color":"yellow","bold":true}]
title @a subtitle "Earn as many achievements as you can before the time limit."
# sfx
execute as @a at @s run playsound entity.generic.explode player @s ~ ~ ~
execute as @a at @s run playsound block.note_block.pling player @s ~ ~ ~

# track score
scoreboard players set @a score 0

# world
worldborder set 2000 5
gamemode survival @a[gamemode=!spectator]

# set period
scoreboard players set period internal 1

0 comments on commit c9ae748

Please sign in to comment.