-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bolt
40 lines (32 loc) · 2.21 KB
/
main.bolt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function silica:load:
scoreboard objectives add mc-silica dummy
scoreboard players set #2 mc-silica 2
scoreboard players set #12000 mc-silica 12000
scoreboard players set #16384 mc-silica 16384
function silica:cooldown:
# input; scoreboard mc-silica
# .cooldown Cool-down in 0.1 seconds (600 = 1 minute)
# .cdr Cool-down reduction in 0.1% (1000 = 100%)
execute store result score .realUntil mc-silica store result score .cdUntil mc-silica run time query gametime
scoreboard players operation #cooldown mc-silica = .cooldown mc-silica
scoreboard players operation #cooldown mc-silica *= #2 mc-silica
scoreboard players operation .realUntil mc-silica += #cooldown mc-silica
scoreboard players operation .cdUntil mc-silica /= #2 mc-silica
scoreboard players operation .cdUntil mc-silica += .cooldown mc-silica
scoreboard players operation .cdUntil mc-silica %= #12000 mc-silica
scoreboard players operation #cdr mc-silica = .cdr mc-silica
scoreboard players operation #cdr mc-silica *= #16384 mc-silica
scoreboard players operation .cdUntil mc-silica += #cdr mc-silica
data merge storage mc:silica {display:{color:0}}
execute store result storage mc:silica display.color int 1 run scoreboard players get .cdUntil mc-silica
data merge storage mc:silica {mc-silica:0}
execute store result storage mc:silica mc-silica int 1 run scoreboard players get .realUntil mc-silica
item modify entity @s weapon.mainhand silica:set_cd_until
function silica:clear_cooldown:
execute store result score .gametime mc-silica run time query gametime
for i in range(9):
execute store result score #readCd mc-silica run data get entity @s f'Inventory[{{Slot:{i}b}}].tag.mc-silica'
execute unless score #readCd mc-silica matches 0 if score .gametime mc-silica > #readCd mc-silica run item modify entity @s f'hotbar.{i}' silica:remove_cd
for i in range(27):
execute store result score #readCd mc-silica run data get entity @s f'Inventory[{{Slot:{i+9}b}}].tag.mc-silica'
execute unless score #readCd mc-silica matches 0 if score #readCd mc-silica > .gametime mc-silica run item modify entity @s f'inventory.{i}' silica:remove_cd