#untwo:proj_sys/collision_check/
#xyzのいずれかが範囲外なら0を返す(当たったら1)

###
scoreboard players set #&collsion.hit_shape.special untwo.temp.0 0
scoreboard players set #&collsion.hit_shape.direction untwo.temp.0 0
scoreboard players operation #&collsion.hit_shape.special.x untwo.temp.0 = #&collsion.decimal.x untwo.temp.0
scoreboard players operation #&collsion.hit_shape.special.y untwo.temp.0 = #&collsion.decimal.y untwo.temp.0
scoreboard players operation #&collsion.hit_shape.special.z untwo.temp.0 = #&collsion.decimal.z untwo.temp.0
execute if block ~ ~ ~ #minecraft:trapdoors[facing=north] run scoreboard players set #&collsion.hit_shape.direction untwo.temp.0 1
execute if block ~ ~ ~ #minecraft:trapdoors[facing=south] run scoreboard players set #&collsion.hit_shape.direction untwo.temp.0 2
execute if block ~ ~ ~ #minecraft:trapdoors[facing=east] run scoreboard players set #&collsion.hit_shape.direction untwo.temp.0 3
execute if block ~ ~ ~ #minecraft:trapdoors[facing=west] run scoreboard players set #&collsion.hit_shape.direction untwo.temp.0 4

execute if block ~ ~ ~ #minecraft:trapdoors[open=true] run scoreboard players set #&collsion.hit_shape.special untwo.temp.0 1
execute if score #&collsion.hit_shape.special untwo.temp.0 matches 0 if block ~ ~ ~ #minecraft:trapdoors[half=top] run function untwo:proj_sys/collision_check/operation/convert.up_down
execute if score #&collsion.hit_shape.special untwo.temp.0 matches 1 if score #&collsion.hit_shape.direction untwo.temp.0 matches 1 run function untwo:proj_sys/collision_check/operation/convert.nouth_south
execute if score #&collsion.hit_shape.special untwo.temp.0 matches 1 if score #&collsion.hit_shape.direction untwo.temp.0 matches 4 run function untwo:proj_sys/collision_check/operation/convert.east_west
execute if score #&collsion.hit_shape.special untwo.temp.0 matches 1 if score #&collsion.hit_shape.direction untwo.temp.0 matches 3..4 run scoreboard players operation #&collsion.hit_shape.special.x untwo.temp.0 >< #&collsion.hit_shape.special.z untwo.temp.0
execute if score #&collsion.hit_shape.special untwo.temp.0 matches 1 run scoreboard players operation #&collsion.hit_shape.special.y untwo.temp.0 >< #&collsion.hit_shape.special.z untwo.temp.0

execute if score #&collsion.hit_shape.special.x untwo.temp.0 matches 0..9999 if score #&collsion.hit_shape.special.y untwo.temp.0 matches 0..5000 if score #&collsion.hit_shape.special.z untwo.temp.0 matches 0..9999 run return 1

return fail