Skip to content

Commit

Permalink
Spawners reset on_game_load now have their delay randomizes between 1…
Browse files Browse the repository at this point in the history
…-40s (Noxitu's math)
  • Loading branch information
Frustrated-Programmer committed Dec 18, 2024
1 parent 19d68e0 commit 9950b36
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generate a random #(1-25)
# If # < 10, set spawner's delay to #
# If # >= 10, generate TWO #(10-40).
# Save the lowest of those TWO #
# With that new # set spawner's Delay to the #

# Generate a number between 0-24
scoreboard players set $dungeon do2.utility.randomNumberRange 25
function do2:random_gen/generate_random_number
# Add 1 so it's 1-25
scoreboard players add $dungeon do2.utility.randomNum
execute store result storage do2:mobs spawner int 1 run scoreboard players get $dungeon do2.utility.randomNum
# If it's < 10 set the delay to the number
execute unless score $dungeon do2.utility.randomNum matches 10.. run data modify block ~ ~ ~ Delay set from storage do2:mobs spawner
execute unless score $dungeon do2.utility.randomNum matches 10.. run return 0

# If it's > 10
scoreboard objectives add do2.tests.findSmallestNumber dummy
# Generate a number between 0-30
scoreboard players set $dungeon do2.utility.randomNumberRange 31
function do2:random_gen/generate_random_number
# Add 10 so it's 10-40
scoreboard players add $dungeon do2.utility.randomNum 10
# Store the number
execute store result score $dungeon do2.tests.findSmallestNumber run scoreboard players get $dungeon do2.utility.randomNum
# Do it all again
function do2:random_gen/generate_random_number
scoreboard players add $dungeon do2.utility.randomNum 10
# Compare sizes.
execute unless score $dungeon do2.tests.findSmallestNumber < $dungeon do2.utility.randomNum store result score $dungeon do2.tests.findSmallestNumber run scoreboard players get $dungeon do2.utility.randomNum
execute store result storage do2:mobs spawner int 1 run scoreboard players get $dungeon do2.tests.findSmallestNumber
data modify block ~ ~ ~ Delay set from storage do2:mobs spawner
scoreboard objectives remove do2.tests.findSmallestNumber

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

data modify block -487 34 1981 Delay set value -1s
data modify block -485 38 1964 Delay set value -1s
data modify block -500 35 1977 Delay set value -1s
execute positioned -487 34 1981 run function do2:reset_dungeon/reset_single_spawner
execute positioned -485 38 1964 run function do2:reset_dungeon/reset_single_spawner
execute positioned -500 35 1977 run function do2:reset_dungeon/reset_single_spawner
4 changes: 2 additions & 2 deletions Brilliance Datapack/data/do2/functions/version.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DATAPACK VERSION NUMBER: 0.13.12
# DATAPACK VERSION NUMBER: 0.13.14

tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.13.12§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]
tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.13.14§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]

0 comments on commit 9950b36

Please sign in to comment.