## Check if we should use a secret name (1 in 80 chance)
execute store result score @s vb.dummy1 run random value 1..80

## Choose random name ID
# Secret
execute if score @s vb.dummy1 matches 80 store result score @s vb.entity.random_name_id run random value 1..32
# Regular
execute unless score @s vb.dummy1 matches 80 store result score @s vb.entity.random_name_id run random value 900001..900180

## Disable villager names setting
execute if score #VB vb.settings.disable_villager_names matches 1 run scoreboard players set @s vb.entity.random_name_id 0

## Set Custom Name (and vb.entity.random_name_gender value)
# Secret (IDs 1-900001)
execute if score @s vb.entity.random_name_id matches 1..900000 run function vb:load_entity/random_names/villager_secret
# Regular (IDs 900000+)
execute if score @s vb.entity.random_name_id matches 900001..900045 run function vb:load_entity/random_names/villager_1
execute if score @s vb.entity.random_name_id matches 900046..900090 run function vb:load_entity/random_names/villager_2
execute if score @s vb.entity.random_name_id matches 900091..900135 run function vb:load_entity/random_names/villager_3
execute if score @s vb.entity.random_name_id matches 900136..900180 run function vb:load_entity/random_names/villager_4