AirDef: drones and air defence for a Horizon fork
build / mod (push) Failing after 5m36s
build / game-linux (push) Has been skipped
build / game-macos (push) Has been cancelled
build / game-windows (push) Has been cancelled
build / release (push) Has been cancelled

The mod (airdef-mod/), its generated models and sounds, the fork's patches
over upstream Horizon (horizon-patches/, HORIZON_COMMIT), a cross-platform
build/install/run script (tools/airdef.py), CI that builds and releases on
every push (.gitea/workflows/build.yml) and a setup guide (docs/INSTALL.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 19:16:52 +03:00
commit a6a13003c2
543 changed files with 31555 additions and 0 deletions
@@ -0,0 +1,57 @@
# Модель объекта — falling_block с моделью блока airdef:<prefix>_p<i>_y<j>[facing].
# В Horizon falling_block не виден селекторам (его нельзя ни сдвинуть, ни убить),
# зато он читает Time и Motion и исчезает при Time > 600. Поэтому каждый тик ставится новый
# с Time:599 и скоростью объекта: он живёт один тик и плавно интерполируется.
# Вызывается как логический маркер после движения. Параметры — в data маркера:
# prefix, dy (смещение по высоте), top/step/np (тангаж: верхний угол ×10, шаг ×10, число ступеней).
execute store result score $yaw airdef.tmp run data get entity @s Rotation[0] 10
execute store result score $pit airdef.tmp run data get entity @s Rotation[1] 10
# курс модели = yaw - 180°, 16 секторов по 22.5°: facing (по 90°) + доворот j
scoreboard players add $yaw airdef.tmp 5512
scoreboard players operation $yaw airdef.tmp %= $3600 airdef.tmp
scoreboard players operation $yaw airdef.tmp /= $225 airdef.tmp
scoreboard players operation $f airdef.tmp = $yaw airdef.tmp
scoreboard players operation $f airdef.tmp /= $4 airdef.tmp
execute store result storage airdef:v j int 1 run scoreboard players operation $yaw airdef.tmp %= $4 airdef.tmp
# тангаж: индекс ступени = round((top + pitch) / step)
execute store result score $vtop airdef.tmp run data get entity @s data.top
execute store result score $vstep airdef.tmp run data get entity @s data.step
execute store result score $vnp airdef.tmp run data get entity @s data.np
scoreboard players operation $pit airdef.tmp += $vtop airdef.tmp
scoreboard players operation $h airdef.tmp = $vstep airdef.tmp
scoreboard players operation $h airdef.tmp /= $2 airdef.tmp
scoreboard players operation $pit airdef.tmp += $h airdef.tmp
execute if score $pit airdef.tmp matches ..-1 run scoreboard players set $pit airdef.tmp 0
scoreboard players operation $pit airdef.tmp /= $vstep airdef.tmp
scoreboard players remove $vnp airdef.tmp 1
execute if score $pit airdef.tmp > $vnp airdef.tmp run scoreboard players operation $pit airdef.tmp = $vnp airdef.tmp
execute store result storage airdef:v i int 1 run scoreboard players get $pit airdef.tmp
execute if score $f airdef.tmp matches 0 run data modify storage airdef:v f set value "north"
execute if score $f airdef.tmp matches 1 run data modify storage airdef:v f set value "east"
execute if score $f airdef.tmp matches 2 run data modify storage airdef:v f set value "south"
execute if score $f airdef.tmp matches 3 run data modify storage airdef:v f set value "west"
# скорость = смещение с прошлого тика (×1000), телепорты и первый тик — без скорости
execute store result score $x airdef.tmp run data get entity @s Pos[0] 1000
execute store result score $y airdef.tmp run data get entity @s Pos[1] 1000
execute store result score $z airdef.tmp run data get entity @s Pos[2] 1000
scoreboard players operation $mx airdef.tmp = $x airdef.tmp
scoreboard players operation $mx airdef.tmp -= @s airdef.px
scoreboard players operation $my airdef.tmp = $y airdef.tmp
scoreboard players operation $my airdef.tmp -= @s airdef.py
scoreboard players operation $mz airdef.tmp = $z airdef.tmp
scoreboard players operation $mz airdef.tmp -= @s airdef.pz
execute unless score @s airdef.px matches -2147483648.. run function airdef:visual/still
execute unless score $mx airdef.tmp matches -5000..5000 run function airdef:visual/still
execute unless score $my airdef.tmp matches -5000..5000 run function airdef:visual/still
execute unless score $mz airdef.tmp matches -5000..5000 run function airdef:visual/still
# у земли не опускать: иначе блок «приземлится» и встанет в мир
execute if score $my airdef.tmp matches ..-1 unless block ~ ~-1.5 ~ #minecraft:air run scoreboard players set $my airdef.tmp 0
scoreboard players operation @s airdef.px = $x airdef.tmp
scoreboard players operation @s airdef.py = $y airdef.tmp
scoreboard players operation @s airdef.pz = $z airdef.tmp
execute store result storage airdef:v mx double 0.001 run scoreboard players get $mx airdef.tmp
execute store result storage airdef:v my double 0.001 run scoreboard players get $my airdef.tmp
execute store result storage airdef:v mz double 0.001 run scoreboard players get $mz airdef.tmp
data modify storage airdef:v prefix set from entity @s data.prefix
data modify storage airdef:v dy set from entity @s data.dy
function airdef:visual/summon with storage airdef:v