text:
#> asset_manager:spawner/spawn/single
#
# 再帰的にMobを($SpawnCount)体召喚します
#
# @within function
#   asset_manager:spawner/spawn/
#   asset_manager:spawner/spawn/single

# 座標
    summon marker ~ ~ ~ {Tags:["SpawnMarker"]}
    data modify storage lib: Argument.Bounds set value [[-1d,-1d],[-1d,-1d],[-1d,-1d]]
    execute store result storage lib: Argument.Bounds[][] double 0.0333333333 run scoreboard players get $SpawnRange Temporary
    data modify storage lib: Argument.Bounds[1] set value [0d,3.0d]
    execute as @e[type=marker,tag=SpawnMarker,distance=..0.01] run function lib:spread_entity/
# 召喚
    execute store result storage api: Argument.ID int 1 run scoreboard players get $MobID Temporary
    execute at @e[type=marker,tag=SpawnMarker,distance=..100] align xz positioned ~0.5 ~-1 ~0.5 if block ~ ~ ~ #lib:no_collision if block ~ ~0.9 ~ #lib:no_collision if block ~ ~1.8 ~ #lib:no_collision run particle poof ~ ~ ~ 0.3 0.3 0.3 0 10 normal
    execute at @e[type=marker,tag=SpawnMarker,distance=..100] align xz positioned ~0.5 ~-1 ~0.5 if block ~ ~ ~ #lib:no_collision if block ~ ~0.9 ~ #lib:no_collision if block ~ ~1.8 ~ #lib:no_collision run function api:mob/summon
# リセット
    data remove storage api: Argument.ID
    kill @e[type=marker,tag=SpawnMarker,distance=..100]
# 召喚数を1減らす
    scoreboard players remove $SpawnCount Temporary 1
# まだ召喚する必要があるなら召喚するMobをランダムに選択する
    execute if score $SpawnCount Temporary matches 1.. run function asset_manager:spawner/spawn/choose_mob_id/
# まだ召喚する必要があるなら周囲のEntity数を取得する
    execute if score $SpawnCount Temporary matches 1.. run function asset_manager:spawner/spawn/nearby_entities/get
# まだ召喚する必要があるなら再帰
    execute if score $SpawnCount Temporary matches 1.. if score $NearbyEntities Temporary < $MaxNearbyEntities Temporary run function asset_manager:spawner/spawn/single


text:
#> asset_manager:spawner/spawn/nearby_entities/get
#
# SpawnRangeの範囲内に居る同IDのMobの数を取得する
#
# @within function
#   asset_manager:spawner/spawn/
#   asset_manager:spawner/spawn/single

# キャッシュが存在する場合取得を試みる(失敗した場合は-1のまま)
    scoreboard players set $NearbyEntities Temporary -1
    execute if data storage asset:spawner NearbyEntitiesCache[0] run function asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/

# キャッシュに存在しない場合素直にdistanceを二分探索し取得する
    execute if score $NearbyEntities Temporary matches -1 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/

repo_name: ProjectTSB/TheSkyBlessing

repo_language: mcfunction

mime_type: text/plain


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-24
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-32

execute if score $SpawnRange Temporary matches ..200 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-20
execute if score $SpawnRange Temporary matches 210.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-24


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-16
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-16

execute if score $SpawnRange Temporary matches ..140 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-14
execute if score $SpawnRange Temporary matches 150.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/15-16


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/59-60
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-60

execute if score $SpawnRange Temporary matches 590 as @e[scores={MobID=-2147483648..2147483647},distance=..59] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 600 as @e[scores={MobID=-2147483648..2147483647},distance=..60] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-48
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-48

execute if score $SpawnRange Temporary matches ..460 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-46
execute if score $SpawnRange Temporary matches 470.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/47-48


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-40
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-40

execute if score $SpawnRange Temporary matches ..380 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-38
execute if score $SpawnRange Temporary matches 390.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/39-40


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-12
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-16

execute if score $SpawnRange Temporary matches ..100 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-10
execute if score $SpawnRange Temporary matches 110.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/11-12


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-8
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-16

execute if score $SpawnRange Temporary matches ..40 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-4
execute if score $SpawnRange Temporary matches 50.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-8


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-46
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-48

execute if score $SpawnRange Temporary matches 450 as @e[scores={MobID=-2147483648..2147483647},distance=..45] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 460 as @e[scores={MobID=-2147483648..2147483647},distance=..46] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-42
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-44

execute if score $SpawnRange Temporary matches 410 as @e[scores={MobID=-2147483648..2147483647},distance=..41] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 420 as @e[scores={MobID=-2147483648..2147483647},distance=..42] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-36
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-40

execute if score $SpawnRange Temporary matches ..340 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-34
execute if score $SpawnRange Temporary matches 350.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/35-36


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/15-16
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-16

execute if score $SpawnRange Temporary matches 150 as @e[scores={MobID=-2147483648..2147483647},distance=..15] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 160 as @e[scores={MobID=-2147483648..2147483647},distance=..16] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/31-32
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-32

execute if score $SpawnRange Temporary matches 310 as @e[scores={MobID=-2147483648..2147483647},distance=..31] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 320 as @e[scores={MobID=-2147483648..2147483647},distance=..32] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-28
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-32

execute if score $SpawnRange Temporary matches ..260 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-26
execute if score $SpawnRange Temporary matches 270.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/27-28


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-16
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-32

execute if score $SpawnRange Temporary matches ..80 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-8
execute if score $SpawnRange Temporary matches 90.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-16


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/63-64
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-64

execute if score $SpawnRange Temporary matches 630 as @e[scores={MobID=-2147483648..2147483647},distance=..63] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 640 as @e[scores={MobID=-2147483648..2147483647},distance=..64] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/23-24
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-24

execute if score $SpawnRange Temporary matches 230 as @e[scores={MobID=-2147483648..2147483647},distance=..23] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 240 as @e[scores={MobID=-2147483648..2147483647},distance=..24] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/39-40
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-40

execute if score $SpawnRange Temporary matches 390 as @e[scores={MobID=-2147483648..2147483647},distance=..39] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 400 as @e[scores={MobID=-2147483648..2147483647},distance=..40] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/35-36
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-36

execute if score $SpawnRange Temporary matches 350 as @e[scores={MobID=-2147483648..2147483647},distance=..35] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 360 as @e[scores={MobID=-2147483648..2147483647},distance=..36] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-24
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-24

execute if score $SpawnRange Temporary matches ..220 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-22
execute if score $SpawnRange Temporary matches 230.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/23-24


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/51-52
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-52

execute if score $SpawnRange Temporary matches 510 as @e[scores={MobID=-2147483648..2147483647},distance=..51] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 520 as @e[scores={MobID=-2147483648..2147483647},distance=..52] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-4
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-8

execute if score $SpawnRange Temporary matches ..20 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-2
execute if score $SpawnRange Temporary matches 30.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/3-4


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/19-20
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-20

execute if score $SpawnRange Temporary matches 190 as @e[scores={MobID=-2147483648..2147483647},distance=..19] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 200 as @e[scores={MobID=-2147483648..2147483647},distance=..20] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-32
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-32

execute if score $SpawnRange Temporary matches ..240 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-24
execute if score $SpawnRange Temporary matches 250.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-32


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-50
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-52

execute if score $SpawnRange Temporary matches 490 as @e[scores={MobID=-2147483648..2147483647},distance=..49] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 500 as @e[scores={MobID=-2147483648..2147483647},distance=..50] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-64
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-64

execute if score $SpawnRange Temporary matches ..600 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-60
execute if score $SpawnRange Temporary matches 610.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-64


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-20
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-24

execute if score $SpawnRange Temporary matches ..180 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-18
execute if score $SpawnRange Temporary matches 190.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/19-20


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-62
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-64

execute if score $SpawnRange Temporary matches 610 as @e[scores={MobID=-2147483648..2147483647},distance=..61] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 620 as @e[scores={MobID=-2147483648..2147483647},distance=..62] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-64
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-64

execute if score $SpawnRange Temporary matches ..560 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-56
execute if score $SpawnRange Temporary matches 570.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-64


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-34
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-36

execute if score $SpawnRange Temporary matches 330 as @e[scores={MobID=-2147483648..2147483647},distance=..33] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 340 as @e[scores={MobID=-2147483648..2147483647},distance=..34] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-38
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-40

execute if score $SpawnRange Temporary matches 370 as @e[scores={MobID=-2147483648..2147483647},distance=..37] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 380 as @e[scores={MobID=-2147483648..2147483647},distance=..38] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-56
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-64

execute if score $SpawnRange Temporary matches ..520 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-52
execute if score $SpawnRange Temporary matches 530.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-56


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-22
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/21-24

execute if score $SpawnRange Temporary matches 210 as @e[scores={MobID=-2147483648..2147483647},distance=..21] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 220 as @e[scores={MobID=-2147483648..2147483647},distance=..22] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/43-44
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-44

execute if score $SpawnRange Temporary matches 430 as @e[scores={MobID=-2147483648..2147483647},distance=..43] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 440 as @e[scores={MobID=-2147483648..2147483647},distance=..44] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-64
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-64

execute if score $SpawnRange Temporary matches ..620 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/61-62
execute if score $SpawnRange Temporary matches 630.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/63-64


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-60
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-64

execute if score $SpawnRange Temporary matches ..580 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-58
execute if score $SpawnRange Temporary matches 590.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/59-60


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-54
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-56

execute if score $SpawnRange Temporary matches 530 as @e[scores={MobID=-2147483648..2147483647},distance=..53] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 540 as @e[scores={MobID=-2147483648..2147483647},distance=..54] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/27-28
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-28

execute if score $SpawnRange Temporary matches 270 as @e[scores={MobID=-2147483648..2147483647},distance=..27] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 280 as @e[scores={MobID=-2147483648..2147483647},distance=..28] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-58
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/57-60

execute if score $SpawnRange Temporary matches 570 as @e[scores={MobID=-2147483648..2147483647},distance=..57] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 580 as @e[scores={MobID=-2147483648..2147483647},distance=..58] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-52
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-56

execute if score $SpawnRange Temporary matches ..500 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-50
execute if score $SpawnRange Temporary matches 510.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/51-52


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-48
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-48

execute if score $SpawnRange Temporary matches ..440 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-44
execute if score $SpawnRange Temporary matches 450.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-48


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/3-4
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-4

execute if score $SpawnRange Temporary matches 30 as @e[scores={MobID=-2147483648..2147483647},distance=..3] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 40 as @e[scores={MobID=-2147483648..2147483647},distance=..4] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-32
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/

execute if score $SpawnRange Temporary matches ..160 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-16
execute if score $SpawnRange Temporary matches 170.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-32


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/47-48
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/45-48

execute if score $SpawnRange Temporary matches 470 as @e[scores={MobID=-2147483648..2147483647},distance=..47] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 480 as @e[scores={MobID=-2147483648..2147483647},distance=..48] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-64
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/

execute if score $SpawnRange Temporary matches ..480 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-48
execute if score $SpawnRange Temporary matches 490.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-64


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-2
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-4

execute if score $SpawnRange Temporary matches 10 as @e[scores={MobID=-2147483648..2147483647},distance=..1] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 20 as @e[scores={MobID=-2147483648..2147483647},distance=..2] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-18
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-20

execute if score $SpawnRange Temporary matches 170 as @e[scores={MobID=-2147483648..2147483647},distance=..17] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 180 as @e[scores={MobID=-2147483648..2147483647},distance=..18] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/55-56
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-56

execute if score $SpawnRange Temporary matches 550 as @e[scores={MobID=-2147483648..2147483647},distance=..55] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 560 as @e[scores={MobID=-2147483648..2147483647},distance=..56] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-26
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-28

execute if score $SpawnRange Temporary matches 250 as @e[scores={MobID=-2147483648..2147483647},distance=..25] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 260 as @e[scores={MobID=-2147483648..2147483647},distance=..26] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-48
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-64

execute if score $SpawnRange Temporary matches ..400 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-40
execute if score $SpawnRange Temporary matches 410.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-48


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/7-8
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-8

execute if score $SpawnRange Temporary matches 70 as @e[scores={MobID=-2147483648..2147483647},distance=..7] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 80 as @e[scores={MobID=-2147483648..2147483647},distance=..8] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-16
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-16

execute if score $SpawnRange Temporary matches ..120 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-12
execute if score $SpawnRange Temporary matches 130.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-16


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-56
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/49-56

execute if score $SpawnRange Temporary matches ..540 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/53-54
execute if score $SpawnRange Temporary matches 550.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/55-56


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-32
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/17-32

execute if score $SpawnRange Temporary matches ..280 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-28
execute if score $SpawnRange Temporary matches 290.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-32


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-6
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-8

execute if score $SpawnRange Temporary matches 50 as @e[scores={MobID=-2147483648..2147483647},distance=..5] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 60 as @e[scores={MobID=-2147483648..2147483647},distance=..6] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-14
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/13-16

execute if score $SpawnRange Temporary matches 130 as @e[scores={MobID=-2147483648..2147483647},distance=..13] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 140 as @e[scores={MobID=-2147483648..2147483647},distance=..14] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-40
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-48

execute if score $SpawnRange Temporary matches ..360 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/33-36
execute if score $SpawnRange Temporary matches 370.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/37-40


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-44
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-48

execute if score $SpawnRange Temporary matches ..420 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/41-42
execute if score $SpawnRange Temporary matches 430.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/43-44


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-8
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/1-8

execute if score $SpawnRange Temporary matches ..60 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/5-6
execute if score $SpawnRange Temporary matches 70.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/7-8


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-10
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-12

execute if score $SpawnRange Temporary matches 90 as @e[scores={MobID=-2147483648..2147483647},distance=..9] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 100 as @e[scores={MobID=-2147483648..2147483647},distance=..10] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/11-12
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/9-12

execute if score $SpawnRange Temporary matches 110 as @e[scores={MobID=-2147483648..2147483647},distance=..11] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 120 as @e[scores={MobID=-2147483648..2147483647},distance=..12] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-32
#
# SpawnRangeを二分探索する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/25-32

execute if score $SpawnRange Temporary matches ..300 run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-30
execute if score $SpawnRange Temporary matches 310.. run function asset_manager:spawner/spawn/nearby_entities/get_from_selector/31-32


text:
#> asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-30
#
# SpawnRangeの範囲内のMobIDが一致するEntity数を取得する
#
# @within function asset_manager:spawner/spawn/nearby_entities/get_from_selector/29-32

execute if score $SpawnRange Temporary matches 290 as @e[scores={MobID=-2147483648..2147483647},distance=..29] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
execute if score $SpawnRange Temporary matches 300 as @e[scores={MobID=-2147483648..2147483647},distance=..30] if score @s MobID = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1


text:
#> asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/find
#
# 再帰的にキャッシュを検索する
#
# @within function
#   asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/
#   asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/find

#> KeyID
# @private
    #declare score_holder $KeyID

# キャッシュKeyを取得
    execute store result score $KeyID Temporary run data get storage asset:spawner NearbyEntitiesCache[-1][0]
# 該当するIDの場合はデータを取得し加算して返す
    execute if score $KeyID Temporary = $MobID Temporary store result score $NearbyEntities Temporary run data get storage asset:spawner NearbyEntitiesCache[-1][1]
    execute if score $KeyID Temporary = $MobID Temporary run scoreboard players add $NearbyEntities Temporary 1
    execute if score $KeyID Temporary = $MobID Temporary store result storage asset:spawner NearbyEntitiesCache[-1][1] int 1 run scoreboard players get $NearbyEntities Temporary
    execute if score $KeyID Temporary = $MobID Temporary run scoreboard players remove $NearbyEntities Temporary 1
# リセット
    scoreboard players reset $KeyID Temporary
# 見つかっていない かつ 要素がまだあるなら再帰
    execute if score $NearbyEntities Temporary matches -1 run data modify storage asset:spawner Temp append from storage asset:spawner NearbyEntitiesCache[-1]
    execute if score $NearbyEntities Temporary matches -1 run data remove storage asset:spawner NearbyEntitiesCache[-1]
    execute if score $NearbyEntities Temporary matches -1 if data storage asset:spawner NearbyEntitiesCache[-1] run function asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/find


text:
#> asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/restore
#
#
#
# @within function
#   asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/
#   asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/restore

data modify storage asset:spawner NearbyEntitiesCache append from storage asset:spawner Temp[-1]
data remove storage asset:spawner Temp[-1]
execute if data storage asset:spawner Temp[0] run function asset_manager:spawner/spawn/nearby_entities/try_get_from_cache/restore


text:
#> asset_manager:spawner/spawn/choose_mob_id/subtract_for_each
#
#
#
# @within function asset_manager:spawner/spawn/choose_mob_id/*

#> temp
# @private
    #declare score_holder $Weight

# Weightを取得してTargetWeightを減算
    execute store result score $Weight Temporary run data get storage asset:spawner ClonedSpawnPotentials[-1].Weight
    scoreboard players operation $TargetWeight Temporary -= $Weight Temporary
# リセット
    scoreboard players reset $Weight Temporary
# TargetWeightが0以上なら再帰
    execute if score $TargetWeight Temporary matches 0.. run data remove storage asset:spawner ClonedSpawnPotentials[-1]
    execute if score $TargetWeight Temporary matches 0.. if data storage asset:spawner ClonedSpawnPotentials[-1] run function asset_manager:spawner/spawn/choose_mob_id/subtract_for_each


text:
#> asset_manager:spawner/subtract_hp/check_id_foreach
#
# 再帰的にMobIDが一致しているかチェックする
#
# @within function asset_manager:spawner/subtract_hp/check_id*

#> Temp
# @private
    #declare score_holder $SpawnMobID

# 最後のMobIDを比較し一致する場合はスポナーの体力を減少させる
    execute store result score $SpawnMobID Temporary run data get storage asset:spawner SpawnPotentials[-1].Id
    execute store success storage asset:spawner AlreadyFind byte 1 if score $SpawnMobID Temporary = $TargetMobID Temporary
    execute if data storage asset:spawner {AlreadyFind:true} run function asset_manager:spawner/subtract_hp/subtract
# リセット
    scoreboard players reset $SpawnMobID Temporary
# 最後のMobIDを削除してまだ要素があるかつTargetCandidateが付いてないなら再帰
    data remove storage asset:spawner SpawnPotentials[-1]
    execute unless data storage asset:spawner {AlreadyFind:true} if data storage asset:spawner SpawnPotentials[-1] run function asset_manager:spawner/subtract_hp/check_id_foreach


text:
#> asset_manager:spawner/subtract_hp/check_id
#
# 対象スポナーの召喚するMobのIDをリストを取得して再帰処理に渡す
#
# @within function asset_manager:spawner/subtract_hp/check_already_find

# EntityStorage呼び出し
    function oh_my_dat:please
# MobIDを移す
    data modify storage asset:spawner SpawnPotentials set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.SpawnPotentials
# すべてのIDについてチェックする
    function asset_manager:spawner/subtract_hp/check_id_foreach
# リセット
    data remove storage asset:spawner MobID


text:
#> asset_manager:spawner/subtract_hp/break
#
#
#
# @within function asset_manager:spawner/subtract_hp/subtract

# VFX
    function asset_manager:spawner/subtract_hp/vfx/break
# タグ追加
    tag @s add BreakSpawner
# プレイヤーへの干渉をなくす
    setblock ~ ~ ~ air
    data modify entity @s Item set value {id:"debug_stick",Count:1b,tag:{CustomModelData:4040}}


text:
#> asset_manager:spawner/subtract_hp/subtract
#
# 該当スポナーの体力を減少させる
#
# @within function asset_manager:spawner/subtract_hp/check_id_foreach

# 体力減算
    scoreboard players remove @s SpawnerHP 1
# 体力が無ければ破壊処理
    execute if score @s SpawnerHP matches ..0 at @s run function asset_manager:spawner/subtract_hp/break
# あればVFX
    execute if score @s SpawnerHP matches 1.. at @s run function asset_manager:spawner/subtract_hp/vfx/damage
# Entity -> SpawnerへのVFX
    execute positioned ~ ~1 ~ facing entity @s feet run function asset_manager:spawner/subtract_hp/vfx/line


text:
#> asset_manager:spawner/subtract_hp/check_already_find
#
# 既にスポナーが見つかっているかをチェックする
#
# @within function asset_manager:spawner/subtract_hp/

execute unless data storage asset:spawner {AlreadyFind:true} run function asset_manager:spawner/subtract_hp/check_id


text:
#> asset_manager:spawner/subtract_hp/vfx/damage
#
#
#
# @within function asset_manager:spawner/subtract_hp/subtract

playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 0.7
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 0.7
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 0.7
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.0
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.0
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.0
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.3
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.3
playsound block.end_portal_frame.fill block @a ~ ~ ~ 2 1.3


text:
#> asset_manager:spawner/subtract_hp/vfx/break
#
#
#
# @within function asset_manager:spawner/subtract_hp/break

playsound entity.item.break block @a ~ ~ ~ 0.5 0.5
playsound entity.item.break block @a ~ ~ ~ 0.5 0.7
playsound block.glass.break block @a ~ ~ ~ 0.7 0.8


text:
#> asset_manager:spawner/subtract_hp/vfx/line
#
#
#
# @within function
#   asset_manager:spawner/subtract_hp/subtract
#   asset_manager:spawner/subtract_hp/vfx/line

particle end_rod ~ ~ ~ 0 0 0 0 1 force
execute unless entity @s[distance=..1] positioned ^ ^ ^0.4 run function asset_manager:spawner/subtract_hp/vfx/line


text:
#> asset_manager:spawner/register/set_data
#
# スポナーにデータを埋め込む
#
# @within function asset_manager:spawner/register/

# EntityStorage呼び出し
    function oh_my_dat:please
# スコアボードに入れるもの
    execute store result score @s SpawnerHP run data get storage asset:spawner HP
    execute store result score @s SpawnerCooldown run data get storage asset:spawner Delay
# SpawnPotentialsを正規化しWeightのSumを計算する
    function asset_manager:spawner/register/process_spawn_potentials/
# EntityStorageに保存するもの
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.ID set from storage asset:spawner ID
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.Pos set from entity @s Pos
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.SpawnPotentials set from storage asset:spawner NormalizedSpawnPotentials
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.SpawnCount set from storage asset:spawner SpawnCount
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.SpawnRange set from storage asset:spawner SpawnRange
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.MinSpawnDelay set from storage asset:spawner MinSpawnDelay
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.MaxSpawnDelay set from storage asset:spawner MaxSpawnDelay
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.MaxNearbyEntities set from storage asset:spawner MaxNearbyEntities
    data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.RequiredPlayerRange set from storage asset:spawner RequiredPlayerRange
    execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.SpawnPotentialsWeightSum int 1 run scoreboard players get $SpawnPotentialsWeightSum Temporary
# リセット
    data remove storage asset:spawner NormalizedSpawnPotentials
    tag @s remove SpawnerInit


text:
#> asset_manager:spawner/register/process_spawn_potentials/from_int_list/for_each
#
#
#
# @within function asset_manager:spawner/register/process_spawn_potentials/from_int_list/*

# Weightは1で正規化する
    data modify storage asset:spawner NormalizedSpawnPotentials append value {Id:-1,Weight:1}
    data modify storage asset:spawner NormalizedSpawnPotentials[-1].Id set from storage asset:spawner SpawnPotentials[-1]
# 要素がまだあったら再帰する
    data remove storage asset:spawner SpawnPotentials[-1]
    execute if data storage asset:spawner SpawnPotentials[-1] run function asset_manager:spawner/register/process_spawn_potentials/from_int_list/for_each


text:
#> asset_manager:spawner/register/process_spawn_potentials/from_weighted_list/for_each
#
# 再帰的にSpawnPotentialsのWeightの合計を計算します
#
# @within function asset_manager:spawner/register/process_spawn_potentials/from_weighted_list/*

# Weightを取得して加算
    execute store result score $Weight Temporary run data get storage asset:spawner SpawnPotentials[-1].Weight
    scoreboard players operation $SpawnPotentialsWeightSum Temporary += $Weight Temporary
# リセット
    scoreboard players reset $Weight Temporary
# 要素がまだあったら再帰する
    data remove storage asset:spawner SpawnPotentials[-1]
    execute if data storage asset:spawner SpawnPotentials[-1] run function asset_manager:spawner/register/process_spawn_potentials/from_weighted_list/for_each


text:
#> asset_manager:spawner/tick/4_interval
#
#
#
# @within function core:tick/4_interval

# VFX
    execute at @e[type=snowball,tag=Spawner,tag=!BreakSpawner] run function asset_manager:spawner/tick/particle


text:
#> asset_manager:spawner/tick/is_near_player
#
# プレイヤーが$RequiredPlayerRangeより近くに居るかチェックする
#
# @within function asset_manager:spawner/tick/

#> temp
# @private
    #declare score_holder $SpawnerX
    #declare score_holder $SpawnerY
    #declare score_holder $SpawnerZ
    #declare score_holder $PlayerX
    #declare score_holder $PlayerY
    #declare score_holder $PlayerZ
    #declare score_holder $SquaredDistance

# プレイヤーの座標データ取得
    function api:data_get/pos
    execute store result score $PlayerX Temporary run data get storage api: Pos[0] 10
    execute store result score $PlayerY Temporary run data get storage api: Pos[1] 10
    execute store result score $PlayerZ Temporary run data get storage api: Pos[2] 10
# スポナーの座標データ取得
    execute as @e[type=snowball,tag=this,distance=..0.01] run function oh_my_dat:please
    execute store result score $SpawnerX Temporary run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.Pos[0] 10
    execute store result score $SpawnerY Temporary run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.Pos[1] 10
    execute store result score $SpawnerZ Temporary run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].SpawnerData.Pos[2] 10
# ユークリッド距離の二乗を計算する
    scoreboard players operation $PlayerX Temporary -= $SpawnerX Temporary
    scoreboard players operation $PlayerY Temporary -= $SpawnerY Temporary
    scoreboard players operation $PlayerZ Temporary -= $SpawnerZ Temporary
    scoreboard players operation $PlayerX Temporary *= $PlayerX Temporary
    scoreboard players operation $PlayerY Temporary *= $PlayerY Temporary
    scoreboard players operation $PlayerZ Temporary *= $PlayerZ Temporary
    scoreboard players operation $SquaredDistance Temporary = $PlayerX Temporary
    scoreboard players operation $SquaredDistance Temporary += $PlayerY Temporary
    scoreboard players operation $SquaredDistance Temporary += $PlayerZ Temporary
# プレイヤーにセット
    execute if score $SquaredDistance Temporary <= $RequiredPlayerRange Temporary run tag @e[type=snowball,tag=this,distance=..0.01] add Success
# リセット
    scoreboard players reset $SpawnerX Temporary
    scoreboard players reset $SpawnerY Temporary
    scoreboard players reset $SpawnerZ Temporary
    scoreboard players reset $PlayerX Temporary
    scoreboard players reset $PlayerY Temporary
    scoreboard players reset $PlayerZ Temporary
    scoreboard players reset $SquaredDistance Temporary


text:
#> asset_manager:spawner/tick/particle
#
#
#
# @within function asset_manager:spawner/tick/4_interval

particle reverse_portal ~-0.49 ~-0.39 ~-0.49 ~10000000 ~ ~ 0.000000003 0
particle reverse_portal ~-0.49 ~-0.39 ~-0.49 ~ ~10000000 ~ 0.000000003 0
particle reverse_portal ~-0.49 ~-0.39 ~-0.49 ~ ~ ~10000000 0.000000003 0

particle reverse_portal ~-0.49 ~-0.39 ~0.49 ~10000000 ~ ~ 0.000000003 0
particle reverse_portal ~-0.49 ~-0.39 ~0.49 ~ ~10000000 ~ 0.000000003 0
particle reverse_portal ~-0.49 ~-0.39 ~0.49 ~ ~ ~-10000000 0.000000003 0

particle reverse_portal ~-0.49 ~0.59 ~-0.49 ~10000000 ~ ~ 0.000000003 0
particle reverse_portal ~-0.49 ~0.59 ~-0.49 ~ ~-10000000 ~ 0.000000003 0
particle reverse_portal ~-0.49 ~0.59 ~-0.49 ~ ~ ~10000000 0.000000003 0

particle reverse_portal ~-0.49 ~0.59 ~0.49 ~10000000 ~ ~ 0.000000003 0
particle reverse_portal ~-0.49 ~0.59 ~0.49 ~ ~-10000000 ~ 0.000000003 0
particle reverse_portal ~-0.49 ~0.59 ~0.49 ~ ~ ~-10000000 0.000000003 0

particle reverse_portal ~0.49 ~-0.39 ~-0.49 ~-10000000 ~ ~ 0.000000003 0
particle reverse_portal ~0.49 ~-0.39 ~-0.49 ~ ~10000000 ~ 0.000000003 0
particle reverse_portal ~0.49 ~-0.39 ~-0.49 ~ ~ ~10000000 0.000000003 0

particle reverse_portal ~0.49 ~-0.39 ~0.49 ~-10000000 ~ ~ 0.000000003 0
particle reverse_portal ~0.49 ~-0.39 ~0.49 ~ ~10000000 ~ 0.000000003 0
particle reverse_portal ~0.49 ~-0.39 ~0.49 ~ ~ ~-10000000 0.000000003 0

particle reverse_portal ~0.49 ~0.59 ~-0.49 ~-10000000 ~ ~ 0.000000003 0
particle reverse_portal ~0.49 ~0.59 ~-0.49 ~ ~-10000000 ~ 0.000000003 0
particle reverse_portal ~0.49 ~0.59 ~-0.49 ~ ~ ~10000000 0.000000003 0

particle reverse_portal ~0.49 ~0.59 ~0.49 ~-10000000 ~ ~ 0.000000003 0
particle reverse_portal ~0.49 ~0.59 ~0.49 ~ ~-10000000 ~ 0.000000003 0
particle reverse_portal ~0.49 ~0.59 ~0.49 ~ ~ ~-10000000 0.000000003 0


text:
#> asset_manager:spawner/tick/6_distributed_interval
#
#
#
# @within function core:tick/6_distributed_interval

execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 0 run function #asset:spawner/register/a
execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 1 run function #asset:spawner/register/b
execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 2 run function #asset:spawner/register/c
execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 3 run function #asset:spawner/register/d
execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 4 run function #asset:spawner/register/e
execute if data storage global {IsProduction:1b} if score $DistributeGroup Global matches 5 run function #asset:spawner/register/f


text:
#> asset_manager:common/reset_all_context
#
# すべてのcontextを削除します
#
# @within function core:tick/

data remove storage asset:context New
data remove storage asset:context Old
data remove storage asset:context id
data remove storage asset:context Items
data remove storage asset:context Inventory


text:
#> asset_manager:common/context_id/stash
#
#
#
# @within function
#   api:mob/core/summon
#   asset:*/extends
#   asset:*/super.*
#   api:artifact/*/from_id
#   api:mob/core/summon
#   asset:mob/extends
#   asset:mob/super.*
#   asset_manager:mob/triggers/*/call_super_method
#   asset_manager:artifact/give
#   api:spawner/subtract_hp

# スタックに新しい空間を追加する
    data modify storage asset:context IDStashStack append value {}
# idを退避(Valueに突っ込んでいるのは、idのデータ型が一意に定まらず特定の型のリストとして持てないため)
    data modify storage asset:context IDStashStack[-1].Value set from storage asset:context id
# idを掃除
    data remove storage asset:context id


text:
#> asset_manager:common/context_id/pop
#
#
#
# @within function
#   api:mob/core/summon
#   asset:*/extends
#   asset:*/super.*
#   api:artifact/*/from_id
#   api:mob/core/summon
#   asset:mob/extends
#   asset:mob/super.*
#   asset_manager:mob/triggers/death/manual
#   asset_manager:mob/triggers/*/call_super_method
#   asset_manager:artifact/give
#   api:spawner/subtract_hp

# idを掃除
    data remove storage asset:context id
# idを戻す
    data modify storage asset:context id set from storage asset:context IDStashStack[-1].Value
# スタックの要素を消す
    data remove storage asset:context IDStashStack[-1]


type: generic

type: item

entity: this

color: white

text: 特殊クールダウン:

nbt: SpecialCooldownSecond

nbt: SpecialCooldownDecimal

text: 秒

condition: inverted

text: 特殊クールダウン:

nbt: SpecialCooldownMinutes

text: 分

text: 秒


text: クールダウン:

nbt: LocalCooldownSecond

nbt: LocalCooldownDecimal

text: 秒

text: クールダウン:

nbt: LocalCooldownMinutes

text: 分

text: 秒


text:
#> lib:_index.d
# @private

#> Public
# @public
    #declare storage lib:


text:
#> lib:heal/modifier
#
# ヒールライブラリの引数を実行者の補正値で補正します
#
# @deprecated change to `api:heal/modifier`
# @input
#   as entity
#   storage lib: Argument.Heal : float
#   storage lib: Argument.FixedHeal : boolean
# @output storage lib: Argument.Heal : float
# @api

data modify storage api: Argument.Heal set from storage lib: Argument.Heal
data modify storage api: Argument.FixedHeal set from storage lib: Argument.FixedHeal

function api:heal/modifier


text:
#> lib:heal/reset
#
# lib:healの引数をリセットします
#
# @deprecated change to `api:heal/reset`
# @api

data remove storage lib: Argument.Heal
data remove storage lib: Argument.FixedHeal

function api:heal/reset


text:
#> lib:motion/_index.d
# @private

#> Val
# @within function lib:motion/core/*
    #declare score_holder $VectorMagnitude
    #declare score_holder $KnockbackResist


text:
#> lib:motion/core/knockback_resistance
#
#
#
# @within function lib:motion/core/

#> private
# @private
#declare score_holder $Calc

# 100からノックバック耐性を引いた値を出す
    scoreboard players set $Calc Temporary 100
    scoreboard players operation $Calc Temporary -= $KnockbackResist Temporary
    scoreboard players operation $Calc Temporary >< $KnockbackResist Temporary
# $VectorMagnitudeの数値ととノックバック耐性をかける
    scoreboard players operation $VectorMagnitude Temporary *= $KnockbackResist Temporary
# 100で割る
    scoreboard players operation $VectorMagnitude Temporary /= $100 Const

# 計算用スコアホルダーをリセット
    scoreboard players reset $Calc


text:
#> lib:motion/core/apply
#
#
#
# @within function lib:motion/core/

#> Val
# @private
    #declare score_holder $VectorX
    #declare score_holder $VectorY
    #declare score_holder $VectorZ

# 初期化として視点を自分にあわせる & ^ ^ ^1を取得
    execute in overworld positioned 0.0 0.0 0.0 run tp 0-0-0-0-0 ^ ^ ^1

# 演算処理
    data modify storage lib: Pos set from entity 0-0-0-0-0 Pos
    execute store result score $VectorX Temporary run data get storage lib: Pos[0] 1000
    execute store result score $VectorY Temporary run data get storage lib: Pos[1] 1000
    execute store result score $VectorZ Temporary run data get storage lib: Pos[2] 1000

    scoreboard players operation $VectorX Temporary *= $VectorMagnitude Temporary
    scoreboard players operation $VectorY Temporary *= $VectorMagnitude Temporary
    scoreboard players operation $VectorZ Temporary *= $VectorMagnitude Temporary

# 適用
    execute store result storage lib: Pos[0] double 0.00001 run scoreboard players get $VectorX Temporary
    execute store result storage lib: Pos[1] double 0.00001 run scoreboard players get $VectorY Temporary
    execute store result storage lib: Pos[2] double 0.00001 run scoreboard players get $VectorZ Temporary
    data modify entity @s Motion set from storage lib: Pos

# リセット
    scoreboard players reset $VectorX Temporary
    scoreboard players reset $VectorY Temporary
    scoreboard players reset $VectorZ Temporary
    data remove storage lib: Pos


text:
#> lib:spread_entity/_index.d
# @private

#> for moving player
# @within function lib:spread_entity/core/player/*
#declare tag TargetPlayer


text:
#> lib:spread_entity/core/non-player
#
#
#
# @within function lib:spread_entity/

#> for moving player
# @private
#declare tag SubstituteMarker

# 実行座標を取得する
    summon marker ~ ~ ~ {Tags:["SubstituteMarker"]}
    data modify storage api: Pos set from entity @e[type=marker,tag=SubstituteMarker,distance=..0.001,limit=1] Pos
    kill @e[type=marker,tag=SubstituteMarker,distance=..0.001,limit=1]
# 実行者をTP
    function lib:spread_entity/core/teleport


text:
#> lib:spread_entity/core/teleport
#
#
#
# @within function lib:spread_entity/core/**

#> Pos
# @private
    #declare score_holder $BoundsX-
    #declare score_holder $BoundsX+
    #declare score_holder $BoundsY-
    #declare score_holder $BoundsY+
    #declare score_holder $BoundsZ-
    #declare score_holder $BoundsZ+
    #declare score_holder $PosX
    #declare score_holder $PosY
    #declare score_holder $PosZ
    #declare score_holder $SubX
    #declare score_holder $SubY
    #declare score_holder $SubZ
    #declare score_holder $AddX
    #declare score_holder $AddY
    #declare score_holder $AddZ

# Pos取得
    execute store result score $PosX Temporary run data get storage api: Pos[0] 100
    execute store result score $PosY Temporary run data get storage api: Pos[1] 100
    execute store result score $PosZ Temporary run data get storage api: Pos[2] 100
# 範囲取得
    execute store result score $BoundsX- Temporary run data get storage lib: Argument.Bounds[0][0] 100
    execute store result score $BoundsX+ Temporary run data get storage lib: Argument.Bounds[0][1] 100
    execute store result score $BoundsY- Temporary run data get storage lib: Argument.Bounds[1][0] 100
    execute store result score $BoundsY+ Temporary run data get storage lib: Argument.Bounds[1][1] 100
    execute store result score $BoundsZ- Temporary run data get storage lib: Argument.Bounds[2][0] 100
    execute store result score $BoundsZ+ Temporary run data get storage lib: Argument.Bounds[2][1] 100
# X-
    execute store result score $SubX Temporary run function lib:random/
    scoreboard players operation $SubX Temporary %= $BoundsX- Temporary
    execute unless score $BoundsX- Temporary matches 0 run scoreboard players operation $PosX Temporary -= $SubX Temporary
# X+
    execute store result score $AddX Temporary run function lib:random/
    scoreboard players operation $AddX Temporary %= $BoundsX+ Temporary
    execute unless score $BoundsX+ Temporary matches 0 run scoreboard players operation $PosX Temporary += $AddX Temporary
# Y-
    execute store result score $SubY Temporary run function lib:random/
    scoreboard players operation $SubY Temporary %= $BoundsY- Temporary
    execute unless score $BoundsY- Temporary matches 0 run scoreboard players operation $PosY Temporary -= $SubY Temporary
# Y+
    execute store result score $AddY Temporary run function lib:random/
    scoreboard players operation $AddY Temporary %= $BoundsY+ Temporary
    execute unless score $BoundsY+ Temporary matches 0 run scoreboard players operation $PosY Temporary += $AddY Temporary
# Z-
    execute store result score $SubZ Temporary run function lib:random/
    scoreboard players operation $SubZ Temporary %= $BoundsZ- Temporary
    execute unless score $BoundsZ- Temporary matches 0 run scoreboard players operation $PosZ Temporary -= $SubZ Temporary
# Z+
    execute store result score $AddZ Temporary run function lib:random/
    scoreboard players operation $AddZ Temporary %= $BoundsZ+ Temporary
    execute unless score $BoundsZ+ Temporary matches 0 run scoreboard players operation $PosZ Temporary += $AddZ Temporary
# Posをセット
    data modify storage lib: Pos set value [0d,0d,0d]
    execute store result storage lib: Pos[0] double 0.01 run scoreboard players get $PosX Temporary
    execute store result storage lib: Pos[1] double 0.01 run scoreboard players get $PosY Temporary
    execute store result storage lib: Pos[2] double 0.01 run scoreboard players get $PosZ Temporary
    data modify entity @s Pos set from storage lib: Pos
# リセット
    data remove storage api: Pos
    data remove storage lib: Pos
    data remove storage lib: Argument.Bounds
    scoreboard players reset $BoundsX- Temporary
    scoreboard players reset $BoundsX+ Temporary
    scoreboard players reset $BoundsY- Temporary
    scoreboard players reset $BoundsY+ Temporary
    scoreboard players reset $BoundsZ- Temporary
    scoreboard players reset $BoundsZ+ Temporary
    scoreboard players reset $PosX Temporary
    scoreboard players reset $PosY Temporary
    scoreboard players reset $PosZ Temporary
    scoreboard players reset $SubX Temporary
    scoreboard players reset $SubY Temporary
    scoreboard players reset $SubZ Temporary
    scoreboard players reset $AddX Temporary
    scoreboard players reset $AddY Temporary
    scoreboard players reset $AddZ Temporary


text:
#> lib:spread_entity/core/player/as_substitute_marker
#
#
#
# @within function lib:spread_entity/core/player/

# 身代わりをTPする
    function lib:spread_entity/core/teleport
# プレイヤーをそいつにTPする
    tp @p[tag=TargetPlayer] @s
# んじゃさよなら～
    kill @s


text:
#> lib:array/packing_chest
#
# 配列の後ろから27個を別の配列にSlotを付与して移します。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   操作する配列データ
# @output storage lib:
#   Array: [T] @ ..N
#   要素が最大27個後ろから抜き取られた配列
#   Package: [T] @ ..27
#   Slotが付与された27個以下のリスト
# @public

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    scoreboard players set $Index Temporary 0
# 箱詰め
    function lib:array/core/packing_chest
# リセット
    scoreboard players reset $Index Temporary


text:
#> lib:array/mask_inverted
#
# 対象配列の要素iについてマスク配列の要素iが**falseである場合**はMaskElementに置換した配列を返します。
#
# Array, Masksの要素の数は同一である必要があります。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   対象配列
#   storage lib: Masks: [boolean | { _: { _: boolean } }] @ N
#   マスク配列
#   storage lib: MaskElement: T | null
#   マスク後の要素 / 未指定の場合、マスクされた要素は削除されます。
# @output
#   storage lib: Array: [T] @ ..N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 移行する
    data modify storage lib: CopiedArray set from storage lib: Array
    data modify storage lib: Array set value []

# 再帰的に動かす
    execute if data storage lib: CopiedArray[0] if data storage lib: Masks[0] run function lib:array/core/mask_inverted

# 結果を反転
    function lib:array/reverse

# リセット
    data remove storage lib: Mask
    data remove storage lib: Masks
    data remove storage lib: MaskElement
    data remove storage lib: CopiedArray


text:
#> lib:array/shuffle
#
# 配列の要素をシャッフルします
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   配列データ
# @output
#   storage lib: Array: [T] @ N
#   ランダムな順の配列
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 配列サイズを取得
    execute store result score $ListSize Lib if data storage lib: Array[]
# 初期化
    data modify storage lib: ArrayO set value []
# 再帰的にシャッフル
    function lib:array/core/shuffle
# シャッフル後のデータで上書きする
    data modify storage lib: Array set from storage lib: ArrayO
# リセット
    data remove storage lib: ArrayO


text:
#> lib:array/sort_ascend
#
# 配列の要素を昇順ソートします。
#
# @input
#   storage lib: Array: [int] @ N
#   配列データ
# @output
#   storage lib: Array: [int] @ N
#   昇順にソートされた配列データ
# @public

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 実際ただのエイリアスである。
    function natural_merge_sort:ascend


text:
#> lib:array/picks
#
# 指定された配列の要素を抜き出します。
#
# @input storage lib:
#   T extends any
#   Array: [T] @ N
#   配列データ
#   Picks: [int] @ M
#   抜き取る要素の添字の配列
# @output storage lib:
#   Array: [T] @ (N - M)..
#   要素が抜き取られた配列
#   Elements: [T] @ ..M
#   抜き取られた要素
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    data remove storage lib: Elements
# 添字配列をソートする
    # 配列を入れ替える
        data modify storage lib: ArrayTemp set from storage lib: Array
        data modify storage lib: Array set from storage lib: Picks
    # ソート
        function lib:array/sort_ascend
    # 配列を元に戻す
        data modify storage lib: Picks set from storage lib: Array
        data modify storage lib: Array set from storage lib: ArrayTemp
# 事前処理としてPicks配列に配列のサイズと同じ添字を突っ込む // どうせ内部処理で-1されるので配列サイズと同じで良い
    data modify storage lib: Picks append value -1
    execute store result storage lib: Picks[-1] int 1 if data storage lib: Array[]
# 再帰的に抜き取る
    function lib:array/core/picks
# Cacheを戻す
    function lib:array/revert
# Elementsの順番を反転させる
    # 配列を入れ替える
        data modify storage lib: ArrayTemp set from storage lib: Array
        data modify storage lib: Array set from storage lib: Elements
    # 反転させる
        function lib:array/reverse
    # 配列を元に戻す
        data modify storage lib: Elements set from storage lib: Array
        data modify storage lib: Array set from storage lib: ArrayTemp
# リセット
    data remove storage lib: Picks
    data remove storage lib: ArrayTemp
    scoreboard players reset $Prev Temporary
    scoreboard players reset $Cur Temporary
    scoreboard players reset $ListSize Temporary


text:
#> lib:array/compare
#
# 配列と比較対象配列の各要素について同一であるかを比較し、その結果の配列を返します。
#
# ArrayA, ArrayBの要素の数は同一である必要があります。
#
# @input
#   T extends any
#   storage lib: ArrayA: [T] @ N
#   比較配列A
#   storage lib: ArrayB: [T] @ N
#   比較配列B
# @output
#   storage lib: CompareResult: [{ _: { _: boolean } }] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/compare

# 結果を反転
    function lib:array/reverse
    data modify storage lib: CompareResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    scoreboard players reset $Temp Temporary


text:
#> lib:array/reverse
#
# 配列を反転します。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   反転させる配列データ
# @output
#   storage lib: Array: [T] @ N
#   反転後の配列データ
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 再帰的に反転する
    function lib:array/core/reverse


text:
#> lib:array/merge
#
# 配列の各要素同士を結合します。
#
# ArrayA, ArrayBの要素の数は同一である必要があります。
#
# @input
#   T extends object
#   storage lib: ArrayA: [T] @ N
#   配列A
#   storage lib: ArrayB: [T] @ N
#   配列B
# @output
#   storage lib: MergeResult: [T] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/merge

# 結果を反転
    function lib:array/reverse
    data modify storage lib: MergeResult set from storage lib: Array

# リセット
    data remove storage lib: Array


text:
#> lib:array/sort_descend
#
# 配列の要素を降順ソートします。
#
# @input
#   storage lib: Array: [int] @ N
#   配列データ
# @output
#   storage lib: Array: [int] @ N
#   降順にソートされた配列データ
# @public

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 実際ただのエイリアスである。
    function natural_merge_sort:descend


text:
#> lib:array/compare_single
#
# 配列の各要素について比較対象と同一であるかを比較し、その結果の配列を返します。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   比較配列A
#   storage lib: CompareTarget: T
#   比較配列B
# @output
#   storage lib: CompareResult: [{ _: { _: boolean } }] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 移行する
    data modify storage lib: CopiedArray set from storage lib: Array
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: CopiedArray[0] run function lib:array/core/compare_single

# 結果を反転
    function lib:array/reverse
    data modify storage lib: CompareResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    data remove storage lib: CopiedArray
    data remove storage lib: CompareTarget
    scoreboard players reset $Temp Temporary


text:
#> lib:array/_index.d
# @private

#>
# @within function lib:array/**
    #declare score_holder $Index
    #declare score_holder $ListSize
    #declare score_holder $Argument.Index

#> Picks処理用
# @within function
#   lib:array/picks
#   lib:array/core/picks
    #declare score_holder $Prev
    #declare score_holder $Cur

#> Compare処理用
# @within function lib:array/**compare*
#declare score_holder $Temp

#> sum処理用
# @within function lib:array/**sum
#declare score_holder $isNumeric

#> 算術処理用
# @within function
#   lib:array/**math/*
    #declare score_holder $Sum
    #declare score_holder $Mul
    #declare score_holder $Temp
    #declare score_holder $Temp2


text:
#> lib:array/mask
#
# 対象配列の要素iについてマスク配列の要素iが**trueである場合**はMaskElementに置換した配列を返します。
#
# Array, Masksの要素の数は同一である必要があります。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   対象配列
#   storage lib: Masks: [boolean | { _: { _: boolean } }] @ N
#   マスク配列
#   storage lib: MaskElement: T | null
#   マスク後の要素 / 未指定の場合、マスクされた要素は削除されます。
# @output
#   storage lib: Array: [T] @ ..N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 移行する
    data modify storage lib: CopiedArray set from storage lib: Array
    data modify storage lib: Array set value []

# 再帰的に動かす
    execute if data storage lib: CopiedArray[0] if data storage lib: Masks[0] run function lib:array/core/mask

# 結果を反転
    function lib:array/reverse

# リセット
    data remove storage lib: Mask
    data remove storage lib: Masks
    data remove storage lib: MaskElement
    data remove storage lib: CopiedArray


text:
#> lib:array/move
#
# 配列をキャッシュへ移動します。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   操作する配列データ
#   score $Argument.Index Lib
#   目的の要素のindex
# @output storage lib:
#   Array: [T] @ (N - Index)
#   最後の要素が目的の要素になった配列
#   Cache: [T] @ Index
#   移動されたデータ
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 動かす回数を算出する
    execute store result score $Index Temporary if data storage lib: Array[]
    scoreboard players remove $Index Temporary 1
    scoreboard players operation $Index Temporary -= $Argument.Index Lib
# 再帰的に動かす
    execute if score $Index Temporary matches 1.. run function lib:array/core/move

# リセット
    scoreboard players reset $Index Temporary


text:
#> lib:array/revert
#
# 配列をキャッシュを元に復元します。
#
# @input
#   T extends any
#   storage lib: Array: [T] @ N
#   move後の配列
#   storage lib: Cache: [T] @ M
#   move時に生成される配列
# @output
#   storage lib: Array: [T] @ N + M
#   move前の配列構造
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# Cacheを復元
    execute if data storage lib: Cache[0] run function lib:array/core/revert


text:
#> lib:array/core/packing_chest
#
#
#
# @within function
#   lib:array/core/packing_chest
#   lib:array/packing_chest

# 個人ストレージからの移行
    data modify storage lib: Package append from storage lib: Array[-1]
    data remove storage lib: Array[-1]
# Slotの設定
    execute store result storage lib: Package[-1].Slot byte 1 run scoreboard players get $Index Temporary
# ループ処理
    scoreboard players add $Index Temporary 1
    execute if score $Index Temporary < $27 Const if data storage lib: Array[0] run function lib:array/core/packing_chest


text:
#> lib:array/core/mask_inverted
# @within function lib:array/**mask_inverted

# マスクデータの一般化
    data modify storage lib: Mask set from storage lib: Masks[-1]
    execute if data storage lib: Mask{} run data modify storage lib: Mask set from storage lib: Mask._._
# マスクデータに合わせて値を追加する
    execute if data storage lib: {Mask:false} run data modify storage lib: Array append from storage lib: MaskElement
    execute if data storage lib: {Mask: true} run data modify storage lib: Array append from storage lib: CopiedArray[-1]
# 末尾削除
    data remove storage lib: CopiedArray[-1]
    data remove storage lib: Masks[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: CopiedArray[0] unless data storage lib: Masks[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/mask","color":"white"}]
    execute unless data storage lib: CopiedArray[0] if data storage lib: Masks[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/mask","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: CopiedArray[0] if data storage lib: Masks[0] run function lib:array/core/mask_inverted


text:
#> lib:array/core/shuffle
# @within function lib:array/**

execute store result score $Index Lib run function lib:random/
scoreboard players operation $Index Lib %= $ListSize Lib
execute if score $Index Lib matches 1.. run function lib:array/core/move
data modify storage lib: ArrayO append from storage lib: Array[-1]
data remove storage lib: Array[-1]
data modify storage lib: Array append from storage lib: Cache[]
data remove storage lib: Cache
scoreboard players remove $ListSize Lib 1
execute if score $ListSize Lib matches 1.. run function lib:array/core/shuffle


text:
#> lib:array/core/picks
#
# 配列の要素を再帰的に抜き取る
#
# @within function
#   lib:array/picks
#   lib:array/core/picks

# 前の添字と今の添字を取得する
    execute store result score $Index Temporary run data get storage lib: Picks[-1]
    execute store result score $Cur Temporary run data get storage lib: Picks[-2]
# 前の添字を削除する
    data remove storage lib: Picks[-1]
# 前の添字と今の添字から動かすべき距離を算出する
    scoreboard players operation $Index Temporary -= $Cur Temporary
    scoreboard players remove $Index Temporary 1
# その分だけ動かす
    execute if score $Index Temporary matches 1.. run function lib:array/core/move
# 最後の要素をElementsに移す
    execute if score $Index Temporary matches 0.. run data modify storage lib: Elements append from storage lib: Array[-1]
    execute if score $Index Temporary matches 0.. run data remove storage lib: Array[-1]
# 添字が二つ以上残ってるなら繰り返す
    execute if data storage lib: Picks[-2] run function lib:array/core/picks


text:
#> lib:array/core/compare
# @within function
#   lib:array/**compare

# 比較/結果代入
    data modify storage lib: Array append value {_:{_:-1b}}
    execute store success score $Temp Temporary run data modify storage lib: ArrayA[-1] set from storage lib: ArrayB[-1]
    execute store success storage lib: Array[-1]._._ byte 1 if score $Temp Temporary matches 0
# 末尾削除
    data remove storage lib: ArrayA[-1]
    data remove storage lib: ArrayB[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: ArrayA[0] unless data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/compare","color":"white"}]
    execute unless data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/compare","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/compare


text:
#> lib:array/core/reverse
# @within function lib:array/**

execute store result score $Index Temporary if data storage lib: Array[]
function lib:array/core/move
data modify storage lib: Array set from storage lib: Cache
data remove storage lib: Cache
scoreboard players reset $Index Temporary


text:
#> lib:array/core/merge
# @within function lib:array/**merge

# 結合
    data modify storage lib: Array append from storage lib: ArrayA[-1]
    data modify storage lib: Array[-1] merge from storage lib: ArrayB[-1]
# 末尾削除
    data remove storage lib: ArrayA[-1]
    data remove storage lib: ArrayB[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: ArrayA[0] unless data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/merge","color":"white"}]
    execute unless data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/merge","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/merge


text:
#> lib:array/core/compare_single
# @within function
#   lib:array/**compare_single

# 比較/結果代入
    data modify storage lib: Array append value {_:{_:-1b}}
    execute store success score $Temp Temporary run data modify storage lib: CopiedArray[-1] set from storage lib: CompareTarget
    execute store success storage lib: Array[-1]._._ byte 1 if score $Temp Temporary matches 0
# 末尾削除
    data remove storage lib: CopiedArray[-1]
# 要素がまだあるなら再帰
    execute if data storage lib: CopiedArray[0] run function lib:array/core/compare_single


text:
#> lib:array/core/mask
# @within function lib:array/**mask

# マスクデータの一般化
    data modify storage lib: Mask set from storage lib: Masks[-1]
    execute if data storage lib: Mask{} run data modify storage lib: Mask set from storage lib: Mask._._
# マスクデータに合わせて値を追加する
    execute if data storage lib: {Mask: true} run data modify storage lib: Array append from storage lib: MaskElement
    execute if data storage lib: {Mask:false} run data modify storage lib: Array append from storage lib: CopiedArray[-1]
# 末尾削除
    data remove storage lib: CopiedArray[-1]
    data remove storage lib: Masks[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: CopiedArray[0] unless data storage lib: Masks[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/mask","color":"white"}]
    execute unless data storage lib: CopiedArray[0] if data storage lib: Masks[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/mask","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: CopiedArray[0] if data storage lib: Masks[0] run function lib:array/core/mask


text:
#> lib:array/core/move
# @within function lib:array/**

scoreboard players remove $Index Temporary 1
data modify storage lib: Cache append from storage lib: Array[-1]
data remove storage lib: Array[-1]
execute if score $Index Temporary matches 1.. run function lib:array/core/move


text:
#> lib:array/core/revert
# @within function lib:array/**

data modify storage lib: Array append from storage lib: Cache[-1]
data remove storage lib: Cache[-1]
execute if data storage lib: Cache[0] run function lib:array/core/revert


text:
#> lib:array/core/math/scalar_multiply
# @within function
#   lib:array/math/scalar_multiply
#   lib:array/core/math/scalar_multiply

# 計算/結果代入
    data modify storage lib: Array append value -1d
    execute store result score $Temp Temporary run data get storage lib: CopiedArray[-1] 100
    scoreboard players operation $Temp Temporary *= $Mul Temporary
    execute store result storage lib: Array[-1] double 0.0001 run scoreboard players get $Temp Temporary

# 末尾削除
    data remove storage lib: CopiedArray[-1]
# 要素がまだあるなら再帰
    execute if data storage lib: CopiedArray[0] run function lib:array/core/math/scalar_multiply


text:
#> lib:array/core/math/sub
# @within function
#   lib:array/math/sub
#   lib:array/core/math/sub

# 加算
    data modify storage lib: Array append value -1d
    execute store result score $Temp Temporary run data get storage lib: ArrayA[-1] 1000
    execute store result score $Temp2 Temporary run data get storage lib: ArrayB[-1] 1000
    scoreboard players operation $Temp Temporary -= $Temp2 Temporary
    execute store result storage lib: Array[-1] double 0.001 run scoreboard players get $Temp Temporary
# 末尾削除
    data remove storage lib: ArrayA[-1]
    data remove storage lib: ArrayB[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: ArrayA[0] unless data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/math/sub","color":"white"}]
    execute unless data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/math/sub","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/math/sub


text:
#> lib:array/core/math/add
# @within function
#   lib:array/math/add
#   lib:array/core/math/add

# 加算
    data modify storage lib: Array append value -1d
    execute store result score $Temp Temporary run data get storage lib: ArrayA[-1] 1000
    execute store result score $Temp2 Temporary run data get storage lib: ArrayB[-1] 1000
    scoreboard players operation $Temp Temporary += $Temp2 Temporary
    execute store result storage lib: Array[-1] double 0.001 run scoreboard players get $Temp Temporary
# 末尾削除
    data remove storage lib: ArrayA[-1]
    data remove storage lib: ArrayB[-1]
# 要素の数がずれていないかのチェック
    execute if data storage lib: ArrayA[0] unless data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/math/add","color":"white"}]
    execute unless data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"リストの要素の数が異なります。 / from lib:array/math/add","color":"white"}]
# 要素がまだあるなら再帰
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/math/add


text:
#> lib:array/core/math/sqr
# @within function
#   lib:array/math/sqr
#   lib:array/core/math/sqr

# 計算/結果代入
    data modify storage lib: Array append value -1d
    execute store result score $Temp Temporary run data get storage lib: CopiedArray[-1] 100
    scoreboard players operation $Temp Temporary *= $Temp Temporary
    execute store result storage lib: Array[-1] double 0.0001 run scoreboard players get $Temp Temporary

# 末尾削除
    data remove storage lib: CopiedArray[-1]
# 要素がまだあるなら再帰
    execute if data storage lib: CopiedArray[0] run function lib:array/core/math/sqr


text:
#> lib:array/core/math/sum
# @within function lib:array/**sum

# 取得/計算
    execute store success score $isNumeric Temporary store result score $Temp Temporary run data get storage lib: Array[-1] 100
    execute if score $isNumeric Temporary matches 0 store result score $Temp Temporary run data get storage lib: Array[-1]
    scoreboard players operation $Sum Temporary += $Temp Temporary
# 末尾削除
    data remove storage lib: Array[-1]
# 要素がまだあるなら再帰
    execute if data storage lib: Array[0] run function lib:array/core/math/sum


text:
#> lib:array/session/open
#
#
#
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:true} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが正常に閉じられていません。","color":"white"}]
# 初期化
    data modify storage lib: Array set value []
    data modify storage lib: ArrayA set value []
    data modify storage lib: ArrayB set value []
    data modify storage lib: Cache set value []
    data modify storage lib: Elements set value []
    data modify storage lib: Package set value []
    data modify storage lib: CompareResult set value []
    data modify storage lib: SumResult set value 0
    data modify storage lib: MergeResult set value []
    data modify storage lib: Mul set value 1
    data modify storage lib: AddResult set value []
    data modify storage lib: MulResult set value []
    data modify storage lib: SubResult set value []
    data modify storage lib: SqrResult set value []
# セッションフラグを立てる
    data modify storage lib: ArrayLibSessionOpened set value true


text:
#> lib:array/session/close
#
#
#
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションは既に閉じられています。","color":"white"}]
# リセット
    data remove storage lib: Cache
    data remove storage lib: Array
    data remove storage lib: ArrayA
    data remove storage lib: ArrayB
    data remove storage lib: Elements
    data remove storage lib: Package
    data remove storage lib: CompareResult
    data remove storage lib: SumResult
    data remove storage lib: MergeResult
    data remove storage lib: Mul
    data remove storage lib: AddResult
    data remove storage lib: MulResult
    data remove storage lib: SubResult
    data remove storage lib: SqrResult
# セッションフラグを消す
    data modify storage lib: ArrayLibSessionOpened set value false


text:
#> lib:array/math/scalar_multiply
#
# 配列の各要素を、Mulで乗算した結果を返します。
#
# @input
#   storage lib: Array: [any] @ N
#   配列データ
#   storage lib: Mul: double
#   係数
# @output
#   storage lib: MulResult: [double] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# Mulを取得する
    execute store result score $Mul Temporary run data get storage lib: Mul 100

# 移行する
    data modify storage lib: CopiedArray set from storage lib: Array
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: CopiedArray[0] run function lib:array/core/math/scalar_multiply

# 結果を反転
    function lib:array/reverse
    data modify storage lib: MulResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    data remove storage lib: CopiedArray
    data remove storage lib: Mul
    scoreboard players reset $Mul Temporary
    scoreboard players reset $Temp Temporary


text:
#> lib:array/math/sub
#
# 2つの配列の各要素について、値を減算した結果を返します。
#
# ArrayA, ArrayBの要素の数は同一である必要があります。
#
# @input
#   T extends any
#   storage lib: ArrayA: [Numeric] @ N
#   減算元(左)配列
#   storage lib: ArrayB: [Numeric] @ N
#   減算(右)配列
# @output
#   storage lib: SubResult: [double] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/math/sub

# 結果を反転
    function lib:array/reverse
    data modify storage lib: SubResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    scoreboard players reset $Temp Temporary
    scoreboard players reset $Temp2 Temporary


text:
#> lib:array/math/add
#
# 2つの配列の各要素について、値を加算した結果を返します。
#
# ArrayA, ArrayBの要素の数は同一である必要があります。
#
# @input
#   T extends any
#   storage lib: ArrayA: [Numeric] @ N
#   加算元配列
#   storage lib: ArrayB: [Numeric] @ N
#   加算元配列
# @output
#   storage lib: AddResult: [double] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: ArrayA[0] if data storage lib: ArrayB[0] run function lib:array/core/math/add

# 結果を反転
    function lib:array/reverse
    data modify storage lib: AddResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    scoreboard players reset $Temp Temporary
    scoreboard players reset $Temp2 Temporary


text:
#> lib:array/math/sqr
#
# 配列の各要素を、2乗した結果を返します。
#
# @input
#   storage lib: Array: [any] @ N
#   配列データ
# @output
#   storage lib: SqrResult: [double] @ N
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 移行する
    data modify storage lib: CopiedArray set from storage lib: Array
    data remove storage lib: Array

# 再帰的に動かす
    execute if data storage lib: CopiedArray[0] run function lib:array/core/math/sqr

# 結果を反転
    function lib:array/reverse
    data modify storage lib: SqrResult set from storage lib: Array

# リセット
    data remove storage lib: Array
    data remove storage lib: CopiedArray
    scoreboard players reset $Mul Temporary
    scoreboard players reset $Temp Temporary


text:
#> lib:array/math/sum
#
# 配列の要素の総和を計算します。
#
# 配列の値の型がNumeric型ではない場合は、`data get`で取得されるint値を値として扱います。
# 例えば、`List[String]`をArrayに渡した場合、各文字列の長さの総和を返します。
#
# @input
#   T extends any
#   storage lib: Array: [T]
#   配列データ
# @output
#   storage lib: SumResult: T extends Numeric ? double : int
#   総和
# @api

# セッションチェック
    execute if data storage lib: {ArrayLibSessionOpened:false} run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"lib:array/のセッションが開かれずに利用されています。","color":"white"}]

# 初期化
    scoreboard players set $Sum Temporary 0
# 総和を計算する
    function lib:array/core/math/sum
# 総和をSumResultに突っ込む
    execute if score $isNumeric Temporary matches 0 store result storage lib: SumResult int 1.00 run scoreboard players get $Sum Temporary
    execute if score $isNumeric Temporary matches 1 store result storage lib: SumResult double 0.01 run scoreboard players get $Sum Temporary
# リセット
    scoreboard players reset $Sum Temporary
    scoreboard players reset $Temp Temporary
    scoreboard players reset $isNumeric Temporary


text:
#> lib:random/_index.d
# @private

#> rng
# @within function
#   lib:random/*
#   core:load_once
    #declare score_holder $Random.Base
    #declare score_holder $Random.Carry


text:
#> lib:bit_array_to_integer/_index.d
# @private

#> Temp
# @within function lib:bit_array_to_integer/**
    #declare score_holder $Return.Number
    #declare score_holder $bit


text:
#> lib:bit_array_to_integer/core/main
#
# 初期化して配列を反転させて再帰処理を呼び出すよ
#
# @within function lib:bit_array_to_integer/

# 初期化
    scoreboard players set $Return.Number Lib 0
# セッション開ける
    function lib:array/session/open
# 反転
    data modify storage lib: Array set from storage lib: Argument.BitArray
    function lib:array/reverse
# 再帰的に計算
    function lib:bit_array_to_integer/core/recursive
# リセット
    function lib:array/session/close
    scoreboard players reset $bit Temporary


text:
#> lib:bit_array_to_integer/core/recursive
#
# 再帰的に1ビットずつ加算していく
#
# @within function lib:bit_array_to_integer/core/*

execute store result score $bit Temporary run data get storage lib: Array[-1]
data remove storage lib: Array[-1]
scoreboard players operation $Return.Number Lib += $Return.Number Lib
execute if score $bit Temporary matches 1 run scoreboard players add $Return.Number Lib 1
execute if data storage lib: Array[] run function lib:bit_array_to_integer/core/recursive


text:
#> lib:status_log/tick
#
#
#
# @within function core:tick/

# 位置をどんどん上げてく
    tp @s ~ ~0.01 ~
# 一定tickで削除する
    scoreboard players add @s LogRemoveTime 1
    execute if score @s LogRemoveTime matches 40.. run kill @s


text:
#> lib:status_log/show_mp
#
#
#
# @within function api:mp/fluctuation

#> For Init
# @private
    #declare tag LogAECInit
    #declare tag SummonPosStand

# 設置位置用AEC
    execute anchored eyes positioned ^ ^ ^ run summon armor_stand ~ ~ ~ {Marker:1b,Silent:1b,Small:1b,Invisible:1b,Tags:["SummonPosStand"]}
# 表示位置変更
    data modify storage lib: Argument.Bounds set value [[1d,1d],[0.2d,0.8d],[1d,1d]]
    execute anchored eyes positioned ^ ^ ^ as @e[type=armor_stand,tag=SummonPosStand,distance=..0.001,limit=1] run function lib:spread_entity/
# 描画用AEC
    execute anchored eyes positioned ^ ^ ^ at @e[type=armor_stand,tag=SummonPosStand,distance=..1.5,limit=1] run summon armor_stand ~ ~ ~ {Marker:1b,Silent:1b,Small:1b,Invisible:1b,Tags:["LogAEC", "LogAECInit","Object"],CustomName:'""',CustomNameVisible:1b}
# 表示文字列生成
    loot replace block 10000 0 10000 container.0 loot lib:status_log/mp
# 文字列描画
    execute anchored eyes positioned ^ ^ ^ run data modify entity @e[type=armor_stand,tag=LogAECInit,distance=..1.5,limit=1] CustomName set from block 10000 0 10000 Items[0].tag.display.Name
# タグ削除
    execute anchored eyes positioned ^ ^ ^ run tag @e[type=armor_stand,tag=LogAECInit,distance=..1.5,limit=1] remove LogAECInit
# リセット
    execute anchored eyes positioned ^ ^ ^ run kill @e[type=armor_stand,tag=SummonPosStand,distance=..1.5,limit=1]
    scoreboard players reset $Fluctuation Lib


text:
#> lib:status_log/_index.d
# @private

#> 描画用AEC
# @within
#   lib:status_log/**
#   core:tick/
    #declare tag LogAEC

#> 計算用
# @within lib:status_log/**
    #declare score_holder $Frac
    #declare score_holder $Int
    #declare score_holder $Fluctuation


text:
#> lib:status_log/show_health
#
#
#
# @within function
#   api:damage/core/health_subtract/non-player
#   api:heal/core/non-player
#   lib:score_to_health_wrapper/fluctuation
#   player_manager:vanilla_attack/show_log

#> For Init
# @private
    #declare score_holder $Fluctuation
    #declare tag LogAECInit
    #declare score_holder $isNegative
    #declare tag SummonPosStand

# 負数の場合の処理 // 0未満では無く、0以下なのは0の表記を赤くするため。
    execute store success score $isNegative Temporary if score $Fluctuation Lib matches ..0
    execute if score $isNegative Temporary matches 1 run scoreboard players operation $Fluctuation Lib *= $-1 Const
# 少数部を取り出す
    scoreboard players operation $Frac Temporary = $Fluctuation Lib
    scoreboard players operation $Frac Temporary /= $10 Const
    scoreboard players operation $Frac Temporary %= $10 Const
# 値は100倍されたもの
    scoreboard players operation $Int Temporary = $Fluctuation Lib
    scoreboard players operation $Int Temporary /= $100 Const

# 設置位置用AEC
    execute anchored eyes positioned ^ ^ ^ run summon armor_stand ~ ~ ~ {Marker:1b,Silent:1b,Small:1b,Invisible:1b,Tags:["SummonPosStand"]}
# 表示位置変更
    data modify storage lib: Argument.Bounds set value [[1d,1d],[0.2d,0.8d],[1d,1d]]
    execute anchored eyes positioned ^ ^ ^ as @e[type=armor_stand,tag=SummonPosStand,distance=..0.001,limit=1] run function lib:spread_entity/
# 描画用AEC
    execute anchored eyes positioned ^ ^ ^ at @e[type=armor_stand,tag=SummonPosStand,distance=..1.5,limit=1] run summon armor_stand ~ ~ ~ {Marker:1b,Small:1b,Silent:1b,Invisible:1b,Tags:["LogAEC", "LogAECInit","Object"],CustomName:'""',CustomNameVisible:1b}
# 表示文字列生成
    execute if score $isNegative Temporary matches 0 run loot replace block 10000 0 10000 container.0 loot lib:status_log/heal
    execute if score $isNegative Temporary matches 1 run loot replace block 10000 0 10000 container.0 loot lib:status_log/damage
# 文字列描画
    execute anchored eyes positioned ^ ^ ^ run data modify entity @e[type=armor_stand,tag=LogAECInit,distance=..1.5,limit=1] CustomName set from block 10000 0 10000 Items[0].tag.display.Name
# タグ削除
    execute anchored eyes positioned ^ ^ ^ run tag @e[type=armor_stand,tag=LogAECInit,distance=..1.5,limit=1] remove LogAECInit
# リセット
    execute anchored eyes positioned ^ ^ ^ run kill @e[type=armor_stand,tag=SummonPosStand,distance=..1.5,limit=1]
    scoreboard players reset $Fluctuation Lib
    scoreboard players reset $Frac Temporary
    scoreboard players reset $Int Temporary
    scoreboard players reset $isNegative Temporary


text:
#> lib:damage/modifier_continuation
#
# Argument.Damageを実行者の補正値で補正します
#
# この関数はresetを使用しない状態で二度目のmodifierをかける場合に利用してください。
#
# @deprecated change to `api:damage/modifier_continuation`
# @input
#   as entity
#   storage lib:
#       Argument.Damage : float
#       Argument.AttackType : Enum
#       Argument.ElementType? : Enum
#       Argument.FixedDamage? : boolean
#       └ Argument.BypassModifier? : boolean
# @output storage lib: Argument.Damage : float
# @api

data modify storage api: Argument.Damage set from storage lib: Argument.Damage
data modify storage api: Argument.AttackType set from storage lib: Argument.AttackType
data modify storage api: Argument.ElementType set from storage lib: Argument.ElementType
data modify storage api: Argument.FixedDamage set from storage lib: Argument.FixedDamage
data modify storage api: Argument.BypassModifier set from storage lib: Argument.BypassModifier

function api:damage/modifier_continuation


text:
#> lib:damage/modifier
#
# Argument.Damageを実行者の補正値で補正します
#
# @deprecated change to `api:damage/modifier`
# @input
#   as entity
#   storage lib:
#       Argument.Damage : float
#       Argument.AttackType : Enum
#       Argument.ElementType? : Enum
#       Argument.FixedDamage? : boolean
#       └ Argument.BypassModifier? : boolean
# @output storage lib: Argument.Damage : float
# @api

data modify storage api: Argument.Damage set from storage lib: Argument.Damage
data modify storage api: Argument.AttackType set from storage lib: Argument.AttackType
data modify storage api: Argument.ElementType set from storage lib: Argument.ElementType
data modify storage api: Argument.FixedDamage set from storage lib: Argument.FixedDamage
data modify storage api: Argument.BypassModifier set from storage lib: Argument.BypassModifier

function api:damage/modifier


text:
#> lib:damage/reset
#
# lib:damageの引数及び
#
# @deprecated change to `api:damage/reset`
# @api

data remove storage lib: Argument.Damage
data remove storage lib: Argument.AttackType
data remove storage lib: Argument.ElementType
data remove storage lib: Argument.DeathMessage
data remove storage lib: Argument.FixedDamage
data remove storage lib: Argument.BypassModifier
data remove storage lib: Argument.BypassArmorDefense
data remove storage lib: Argument.BypassToughness
data remove storage lib: Argument.BypassEnchantments
data remove storage lib: Argument.BypassResistance
data remove storage lib: Argument.DisableParticle
data remove storage lib: Argument.ReduceEnchantment

function api:damage/reset


text:
#> lib:integer_to_bit_array/_index.d
# @private

#> Temp
# @within function lib:integer_to_bit_array/**
    #declare score_holder $Argument.Number
    #declare score_holder $i


text:
#> lib:integer_to_bit_array/core/main
#
# 初期化して再帰処理を呼び出すよ
#
# @within function lib:integer_to_bit_array/

data modify storage lib: Return.Array set value []
scoreboard players set $i Temporary 0
function lib:integer_to_bit_array/core/recursive
scoreboard players reset $i Temporary