-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor how random numbers are generated. Much more streamlined
- Loading branch information
1 parent
5b27bfa
commit 57e9635
Showing
17 changed files
with
71 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
Brilliance Datapack/data/do2/functions/dungeon_setup/decide_day_or_night.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Whether it's DAY or NIGHT. | ||
time set noon | ||
function do2:random_gen/gen_random_percentage | ||
execute if score @e[type=marker,tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum < $dungeon do2.config.nightTimeChance run time set night | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 100 | ||
function do2:random_gen/generate_random_number | ||
execute if score $dungeon do2.utility.randomNum < $dungeon do2.config.nightTimeChance run time set night | ||
|
||
# - Start Log - | ||
execute unless score @e[type=marker,tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum < $dungeon do2.config.nightTimeChance as @a[scores={do2.logs.dungeon_setup=1..}] run tellraw @s ["",{"text":"§f[§9B§f]: Time of day randomly set to: §eDAY §r("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§fChance of Night Time: "},{"score":{"name":"$dungeon","objective":"do2.config.nightTimeChance"},"color":"aqua"},{"text":"§b%\n§fRandomly Generated Number: "},{"color":"aqua","score":{"name":"@e[type=marker,tag=RandomGenerator_RESULT,limit=1]","objective":"do2.utility.randomNum"}}]}},{"text":")"}] | ||
execute if score @e[type=marker,tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum < $dungeon do2.config.nightTimeChance as @a[scores={do2.logs.dungeon_setup=1..}] run tellraw @s ["",{"text":"§f[§9B§f]: Time of day randomly set to: §8NIGHT §r("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§fChance of Night Time: "},{"score":{"name":"$dungeon","objective":"do2.config.nightTimeChance"},"color":"aqua"},{"text":"§b%\n§fRandomly Generated Number: "},{"color":"aqua","score":{"name":"@e[type=marker,tag=RandomGenerator_RESULT,limit=1]","objective":"do2.utility.randomNum"}}]}},{"text":")"}] | ||
execute unless score $dungeon do2.utility.randomNum < $dungeon do2.config.nightTimeChance as @a[scores={do2.logs.dungeon_setup=1..}] run tellraw @s ["",{"text":"§f[§9B§f]: Time of day randomly set to: §eDAY §r("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§fChance of Night Time: "},{"score":{"name":"$dungeon","objective":"do2.config.nightTimeChance"},"color":"aqua"},{"text":"§b%\n§fRandomly Generated Number: "},{"color":"aqua","score":{"name":"$dungeon","objective":"do2.utility.randomNum"}}]}},{"text":")"}] | ||
execute if score $dungeon do2.utility.randomNum < $dungeon do2.config.nightTimeChance as @a[scores={do2.logs.dungeon_setup=1..}] run tellraw @s ["",{"text":"§f[§9B§f]: Time of day randomly set to: §8NIGHT §r("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§fChance of Night Time: "},{"score":{"name":"$dungeon","objective":"do2.config.nightTimeChance"},"color":"aqua"},{"text":"§b%\n§fRandomly Generated Number: "},{"color":"aqua","score":{"name":"$dungeon","objective":"do2.utility.randomNum"}}]}},{"text":")"}] | ||
# - End Log - |
29 changes: 29 additions & 0 deletions
29
Brilliance Datapack/data/do2/functions/mob_spawning/fish_counts/determine_variant.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Preset 256 | ||
scoreboard players set $num do2.utility.fishVariant 256 | ||
|
||
# Determine pattern color | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 16 | ||
function do2:random_gen/generate_random_number | ||
scoreboard players operation $dungeon do2.utility.fishVariant += $dungeon do2.utility.randomNum | ||
scoreboard players operation $dungeon do2.utility.fishVariant *= $num do2.utility.fishVariant | ||
|
||
# Determine base color | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 16 | ||
function do2:random_gen/generate_random_number | ||
scoreboard players operation $dungeon do2.utility.fishVariant += $dungeon do2.utility.randomNum | ||
scoreboard players operation $dungeon do2.utility.fishVariant *= $num do2.utility.fishVariant | ||
|
||
# Add fish pattern | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 6 | ||
function do2:random_gen/generate_random_number | ||
scoreboard players operation $dungeon do2.utility.fishVariant += $dungeon do2.utility.randomNum | ||
scoreboard players operation $dungeon do2.utility.fishVariant *= $num do2.utility.fishVariant | ||
|
||
# Add fish Size | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 2 | ||
function do2:random_gen/generate_random_number | ||
scoreboard players operation $dungeon do2.utility.fishVariant += $dungeon do2.utility.randomNum | ||
|
||
|
||
|
||
|
21 changes: 0 additions & 21 deletions
21
...k/data/do2/functions/mob_spawning/fish_counts/determine_variant/add_base_color.mcfunction
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...pack/data/do2/functions/mob_spawning/fish_counts/determine_variant/add_pattern.mcfunction
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
...ata/do2/functions/mob_spawning/fish_counts/determine_variant/add_pattern_color.mcfunction
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...atapack/data/do2/functions/mob_spawning/fish_counts/determine_variant/add_size.mcfunction
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...ata/do2/functions/mob_spawning/fish_counts/determine_variant/determine_variant.mcfunction
This file was deleted.
Oops, something went wrong.
74 changes: 26 additions & 48 deletions
74
...nce Datapack/data/do2/functions/mob_spawning/fish_counts/summon_common_variant.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,27 @@ | ||
scoreboard players set @e[type=marker,tag=RandomGenerator_RESULT] do2.utility.randomNum 0 | ||
tag @e[tag=RandomGenerator_Using] remove RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_0] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_1] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_2] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_3] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_4] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_5] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_6] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_7] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_8] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_9] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_10] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_11] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_12] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_13] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_14] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_15] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_16] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_17] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_18] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_19] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_20] add RandomGenerator_Using | ||
tag @e[tag=RandomGenerator_21] add RandomGenerator_Using | ||
scoreboard players operation @e[type=marker,tag=RandomGenerator_RESULT] do2.utility.randomNum += @e[type=marker,tag=RandomGenerator_Using,limit=1,sort=random] do2.utility.randomNum | ||
|
||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 0 run summon minecraft:tropical_fish ~ ~ ~ {Variant:65536,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 1 run summon minecraft:tropical_fish ~ ~ ~ {Variant:459008,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 2 run summon minecraft:tropical_fish ~ ~ ~ {Variant:917504,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 3 run summon minecraft:tropical_fish ~ ~ ~ {Variant:918273,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 4 run summon minecraft:tropical_fish ~ ~ ~ {Variant:918529,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 5 run summon minecraft:tropical_fish ~ ~ ~ {Variant:16778497,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 6 run summon minecraft:tropical_fish ~ ~ ~ {Variant:50660352,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 7 run summon minecraft:tropical_fish ~ ~ ~ {Variant:50726144,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 8 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67108865,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 9 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67110144,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 10 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67371009,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 11 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67699456,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 12 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67764993,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 13 run summon minecraft:tropical_fish ~ ~ ~ {Variant:101253888,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 14 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117441025,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 15 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117441793,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 16 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117506305,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 17 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117899265,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 18 run summon minecraft:tropical_fish ~ ~ ~ {Variant:118161664,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 19 run summon minecraft:tropical_fish ~ ~ ~ {Variant:185008129,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 20 run summon minecraft:tropical_fish ~ ~ ~ {Variant:234882305,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 21 run summon minecraft:tropical_fish ~ ~ ~ {Variant:235340288,Tags:["do2.manually_spawned"]} | ||
execute if score @e[tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 22.. run function do2:mob_spawning/fish_counts/summon_common_variant | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 22 | ||
function do2:random_gen/generate_random_number | ||
|
||
execute if score $dungeon do2.utility.randomNum matches 0 run summon minecraft:tropical_fish ~ ~ ~ {Variant:65536,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 1 run summon minecraft:tropical_fish ~ ~ ~ {Variant:459008,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 2 run summon minecraft:tropical_fish ~ ~ ~ {Variant:917504,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 3 run summon minecraft:tropical_fish ~ ~ ~ {Variant:918273,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 4 run summon minecraft:tropical_fish ~ ~ ~ {Variant:918529,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 5 run summon minecraft:tropical_fish ~ ~ ~ {Variant:16778497,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 6 run summon minecraft:tropical_fish ~ ~ ~ {Variant:50660352,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 7 run summon minecraft:tropical_fish ~ ~ ~ {Variant:50726144,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 8 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67108865,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 9 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67110144,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 10 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67371009,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 11 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67699456,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 12 run summon minecraft:tropical_fish ~ ~ ~ {Variant:67764993,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 13 run summon minecraft:tropical_fish ~ ~ ~ {Variant:101253888,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 14 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117441025,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 15 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117441793,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 16 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117506305,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 17 run summon minecraft:tropical_fish ~ ~ ~ {Variant:117899265,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 18 run summon minecraft:tropical_fish ~ ~ ~ {Variant:118161664,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 19 run summon minecraft:tropical_fish ~ ~ ~ {Variant:185008129,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 20 run summon minecraft:tropical_fish ~ ~ ~ {Variant:234882305,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 21 run summon minecraft:tropical_fish ~ ~ ~ {Variant:235340288,Tags:["do2.manually_spawned"]} | ||
execute if score $dungeon do2.utility.randomNum matches 22.. run function do2:mob_spawning/fish_counts/summon_common_variant |
7 changes: 4 additions & 3 deletions
7
Brilliance Datapack/data/do2/functions/mob_spawning/fish_counts/summon_fish.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
function do2:random_gen/get_random_num | ||
execute if score @e[type=marker,tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches ..8 run function do2:mob_spawning/fish_counts/summon_common_variant | ||
execute if score @e[type=marker,tag=RandomGenerator_RESULT,limit=1] do2.utility.randomNum matches 9.. run function do2:mob_spawning/fish_counts/summon_random_variant | ||
scoreboard players set $dungeon do2.utility.randomNumberRange 10 | ||
function do2:random_gen/generate_random_number | ||
execute if score $dungeon do2.utility.randomNum matches ..8 run function do2:mob_spawning/fish_counts/summon_common_variant | ||
execute if score $dungeon do2.utility.randomNum matches 9.. run function do2:mob_spawning/fish_counts/summon_random_variant |
2 changes: 1 addition & 1 deletion
2
...nce Datapack/data/do2/functions/mob_spawning/fish_counts/summon_random_variant.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
summon minecraft:tropical_fish ~ ~ ~ {Variant:235340288,Tags:["determine_variant","do2.manually_spawned"]} | ||
function do2:mob_spawning/fish_counts/determine_variant/determine_variant | ||
function do2:mob_spawning/fish_counts//determine_variant | ||
execute store result entity @e[type=minecraft:tropical_fish,tag=determine_variant,limit=1] Variant double 1 run scoreboard players get $dungeon do2.utility.fishVariant | ||
tag @e[type=minecraft:tropical_fish,tag=determine_variant] remove determine_variant |
Oops, something went wrong.