Skip to content

Commit

Permalink
Cleanup & optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
VForiel committed Oct 26, 2023
1 parent eda5b11 commit ffd62f0
Show file tree
Hide file tree
Showing 44 changed files with 575 additions and 601 deletions.
4 changes: 3 additions & 1 deletion GLOBAL/data/global/functions/__load__.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ gamerule fallDamage false
# Common ----------------------------------------------------------------------

scoreboard objectives add data dummy
scoreboard objectives add tmp dummy
scoreboard objectives add input dummy
scoreboard objectives add output dummy
scoreboard objectives add ctx dummy
function lib:constants

# Continuous informations -----------------------------------------------------
Expand Down
54 changes: 26 additions & 28 deletions GLOBAL/data/lib/functions/random_normal/interface.mcfunction
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
scoreboard players operation #x tmp = #mean tmp
scoreboard players operation #delta tmp = #std tmp
scoreboard players operation #delta tmp *= 2 const
scoreboard players set #loop tmp 0
scoreboard players operation #delta ctx = #std input
scoreboard players operation #delta ctx *= 2 const

scoreboard players set #x tmp 0
scoreboard players set #x output 0

execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess tmp run random value -500..500
scoreboard players operation #x tmp += #guess tmp
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx
execute store result score #guess ctx run random value -500..500
scoreboard players operation #x output += #guess ctx

scoreboard players operation #x tmp *= #std tmp
scoreboard players operation #x tmp /= 1000 const
scoreboard players operation #x tmp += #mean tmp
scoreboard players operation #x output *= #std input
scoreboard players operation #x output /= 1000 const
scoreboard players operation #x output += #mean input
14 changes: 7 additions & 7 deletions GLOBAL/data/lib/functions/utils/countdown.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ scoreboard objectives add countdown dummy
execute as @a[scores={countdown=1..}] run title @s times 0 20 20
execute as @a[scores={countdown=1..}] run title @s title {"text":" "}
execute as @a[scores={countdown=1}] run title @s subtitle {"text":" "}
execute as @a[scores={countdown=1..}] run scoreboard players operation @s tmp = @s countdown
execute as @a[scores={countdown=1..}] run scoreboard players operation @s tmp /= 20 const
execute as @a[scores={countdown=1..}] run scoreboard players add @s tmp 1
execute as @a[scores={countdown=2..}] run title @s subtitle {"score":{"name":"@s","objective":"tmp"},"color":"yellow"}
execute as @a[scores={countdown=1..}] run scoreboard players operation @s tmp = @s countdown
execute as @a[scores={countdown=1..}] run scoreboard players operation @s tmp %= 20 const
execute as @a[scores={tmp=0,countdown=1..100}] run playsound minecraft:block.stone_button.click_off master @s ~ ~ ~ 2 1 1
execute as @a[scores={countdown=1..}] run scoreboard players operation @s ctx = @s countdown
execute as @a[scores={countdown=1..}] run scoreboard players operation @s ctx /= 20 const
execute as @a[scores={countdown=1..}] run scoreboard players add @s ctx 1
execute as @a[scores={countdown=2..}] run title @s subtitle {"score":{"name":"@s","objective":"ctx"},"color":"yellow"}
execute as @a[scores={countdown=1..}] run scoreboard players operation @s ctx = @s countdown
execute as @a[scores={countdown=1..}] run scoreboard players operation @s ctx %= 20 const
execute as @a[scores={ctx=0,countdown=1..100}] run playsound minecraft:block.stone_button.click_off master @s ~ ~ ~ 2 1 1
scoreboard players remove @a[scores={countdown=1..}] countdown 1
scoreboard players add @a[scores={countdown=..-1}] countdown 1
28 changes: 14 additions & 14 deletions GLOBAL/data/lobby/functions/compass/main.mcfunction
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

# Count number of compass
execute as @a[team=lobby] store result score @s tmp run clear @s compass 0
execute as @a[team=lobby] store result score @s ctx run clear @s compass 0

# If player dropped his compass -> cycle forward
scoreboard players add @a[team=lobby,scores={lobby.compass.drop_trigger=1..,tmp=0}] lobby.compass.select 1
execute as @a[team=lobby,scores={lobby.compass.drop_trigger=1..,tmp=0}] at @s run playsound minecraft:block.stone_button.click_on master @s ~ ~ ~ 1 2 0
scoreboard players add @a[team=lobby,scores={lobby.compass.drop_trigger=1..,ctx=0}] lobby.compass.select 1
execute as @a[team=lobby,scores={lobby.compass.drop_trigger=1..,ctx=0}] at @s run playsound minecraft:block.stone_button.click_on master @s ~ ~ ~ 1 2 0
scoreboard players reset * lobby.compass.drop_trigger
# If the player swapped it from hands -> cycle backward
scoreboard players remove @a[team=lobby,scores={tmp=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] lobby.compass.select 1
execute as @a[team=lobby,scores={tmp=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] at @s run playsound minecraft:block.stone_button.click_off master @s ~ ~ ~ 1 2 0
clear @a[team=lobby,scores={tmp=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] compass
scoreboard players remove @a[team=lobby,scores={ctx=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] lobby.compass.select 1
execute as @a[team=lobby,scores={ctx=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] at @s run playsound minecraft:block.stone_button.click_off master @s ~ ~ ~ 1 2 0
clear @a[team=lobby,scores={ctx=1},nbt={Inventory:[{Slot:-106b,id:"minecraft:compass"}]}] compass

# Remove compass if duplicated
execute as @a[team=lobby,scores={tmp=2..}] run clear @s compass
execute as @a[team=lobby,scores={ctx=2..}] run clear @s compass

# Recompute number of compass
execute as @a[team=lobby] store result score @s tmp run clear @s compass 0
execute as @a[team=lobby] store result score @s ctx run clear @s compass 0

# Cycle limits
scoreboard players set @a[team=lobby,scores={lobby.compass.select=6..}] lobby.compass.select 0
Expand All @@ -24,19 +24,19 @@ scoreboard players set @a[team=lobby,scores={lobby.compass.select=..-1}] lobby.c
# Give compass ----------------------------------------------------------------

# Jump
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=0}] hotbar.8 with compass{display:{Name:'{"text":"JUMP","color":"dark_purple","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-311,Y:97,Z:19},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=0}] hotbar.8 with compass{display:{Name:'{"text":"JUMP","color":"dark_purple","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-311,Y:97,Z:19},HideFlags:255}

# Magma run
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=1}] hotbar.8 with compass{display:{Name:'{"text":"MAGMA RUN","color":"gold","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-216,Y:100,Z:17},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=1}] hotbar.8 with compass{display:{Name:'{"text":"MAGMA RUN","color":"gold","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-216,Y:100,Z:17},HideFlags:255}

# One in the chamber
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=2}] hotbar.8 with compass{display:{Name:'{"text":"ONE IN THE CHAMBER","color":"red","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-184,Y:97,Z:-97},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=2}] hotbar.8 with compass{display:{Name:'{"text":"ONE IN THE CHAMBER","color":"red","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-184,Y:97,Z:-97},HideFlags:255}

# Prophunt
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=3}] hotbar.8 with compass{display:{Name:'{"text":"PROPHUNT","color":"blue","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:112,Y:82,Z:66},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=3}] hotbar.8 with compass{display:{Name:'{"text":"PROPHUNT","color":"blue","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:112,Y:82,Z:66},HideFlags:255}

# Dropper
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=4}] hotbar.8 with compass{display:{Name:'{"text":"DROPPER","color":"green","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:123,Y:99,Z:9},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=4}] hotbar.8 with compass{display:{Name:'{"text":"DROPPER","color":"green","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:123,Y:99,Z:9},HideFlags:255}

# Wallstreet
item replace entity @a[team=lobby,scores={tmp=0,lobby.compass.select=5}] hotbar.8 with compass{display:{Name:'{"text":"WALLSTREET","color":"yellow","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-115,Y:100,Z:107},HideFlags:255}
item replace entity @a[team=lobby,scores={ctx=0,lobby.compass.select=5}] hotbar.8 with compass{display:{Name:'{"text":"WALLSTREET","color":"yellow","bold":true,"italic":true}',Lore:['{"text":"This compass indicate the minigame location","color":"white","italic":false}','{"text":"Drop item to select the next minigame","color":"white","italic":false}','{"text":"Swap it from hands to select the previous one","color":"white","italic":false}']},LodestoneDimension:"minecraft:overworld",LodestoneTracked:0b,LodestonePos:{X:-115,Y:100,Z:107},HideFlags:255}
4 changes: 2 additions & 2 deletions GLOBAL/data/lobby/functions/horse/cooldown.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scoreboard players add #lobby.horse.cooldown.seconds data 1

item modify entity @s container.7 lobby:horse/cooldown

execute store result score @s tmp run clear @s ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'}} 0
execute if score @s tmp > #lobby.horse.cooldown.seconds data run clear @s ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'}}
execute store result score @s ctx run clear @s ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'}} 0
execute if score @s ctx > #lobby.horse.cooldown.seconds data run clear @s ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'}}

scoreboard players remove @s lobby.horse.cooldown 1
4 changes: 2 additions & 2 deletions GLOBAL/data/lobby/functions/horse/main.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ item replace entity @a[team=lobby,scores={lobby.horse.cooldown=0}] hotbar.7 with

item replace entity @a[team=lobby,scores={lobby.horse.cooldown=1..}] hotbar.7 with minecraft:ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'},CustomModelData:1}

execute as @a[team=lobby] store result score @s tmp run clear @s horse_spawn_egg 0
execute as @a[team=lobby] if score @s tmp matches 2.. run clear @s
execute as @a[team=lobby] store result score @s ctx run clear @s horse_spawn_egg 0
execute as @a[team=lobby] if score @s ctx matches 2.. run clear @s
clear @a[team=lobby,scores={lobby.horse.cooldown=0}] ghast_tear{display:{Name:'{"text":"Spawn horse (cooldown)","color":"red","bold":true,"italic":true}'},HideFlags:255}


Expand Down
16 changes: 8 additions & 8 deletions minigames/data/dropper/functions/jump/set_wool.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Jump Complete

execute as @s store result score @s tmp run random value 0..6
execute at @s[scores={tmp=0}] run setblock ~ 80 ~ black_wool
execute at @s[scores={tmp=1}] run setblock ~ 80 ~ white_wool
execute at @s[scores={tmp=2}] run setblock ~ 80 ~ red_wool
execute at @s[scores={tmp=3}] run setblock ~ 80 ~ lime_wool
execute at @s[scores={tmp=4}] run setblock ~ 80 ~ light_blue_wool
execute at @s[scores={tmp=5}] run setblock ~ 80 ~ magenta_wool
execute at @s[scores={tmp=6}] run setblock ~ 80 ~ yellow_wool
execute as @s store result score @s ctx run random value 0..6
execute at @s[scores={ctx=0}] run setblock ~ 80 ~ black_wool
execute at @s[scores={ctx=1}] run setblock ~ 80 ~ white_wool
execute at @s[scores={ctx=2}] run setblock ~ 80 ~ red_wool
execute at @s[scores={ctx=3}] run setblock ~ 80 ~ lime_wool
execute at @s[scores={ctx=4}] run setblock ~ 80 ~ light_blue_wool
execute at @s[scores={ctx=5}] run setblock ~ 80 ~ magenta_wool
execute at @s[scores={ctx=6}] run setblock ~ 80 ~ yellow_wool
8 changes: 4 additions & 4 deletions minigames/data/dropper/functions/zone/refill-loop.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ summon marker 119 80 -9 {Tags:["dropper.zone.refill"]}

# Random X pos
execute as @e[tag=dropper.zone.refill] store result score @s data run data get entity @s Pos[0] 1
execute as @e[tag=dropper.zone.refill] store result score @s tmp run random value 0..8
execute as @e[tag=dropper.zone.refill] store result entity @s Pos[0] double 1 run scoreboard players operation @s data += @s tmp
execute as @e[tag=dropper.zone.refill] store result score @s ctx run random value 0..8
execute as @e[tag=dropper.zone.refill] store result entity @s Pos[0] double 1 run scoreboard players operation @s data += @s ctx

# Random Z pos
execute as @e[tag=dropper.zone.refill] store result score @s data run data get entity @s Pos[2] 1
execute as @e[tag=dropper.zone.refill] store result score @s tmp run random value 0..8
execute as @e[tag=dropper.zone.refill] store result entity @s Pos[2] double 1 run scoreboard players operation @s data += @s tmp
execute as @e[tag=dropper.zone.refill] store result score @s ctx run random value 0..8
execute as @e[tag=dropper.zone.refill] store result entity @s Pos[2] double 1 run scoreboard players operation @s data += @s ctx

execute at @e[tag=dropper.zone.refill] run setblock ~ ~ ~ water destroy

Expand Down
Loading

0 comments on commit ffd62f0

Please sign in to comment.