Files
horizon-airdef/tools/command_exec_corpus.py
T
Ludovic Marie 0410a222ea WIP: unfinished hud parity work, stopped for the night
Uncommitted changes the agent had in progress when it was stopped; may not
build or pass its harnesses yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 22:24:03 +02:00

340 lines
14 KiB
Python

"""Command scripts for tools/test_command_exec_parity.py.
Each group is a list of operations: `cmd` runs a command as the player and
records its messages and results (`record: false` runs setup silently),
`tick` advances the game and `settle` loads the terrain around the player.
Everything happens high above the terrain (y 200 and up, where both worlds
are air) after the world's entities are removed, so the results do not
depend on world generation.
"""
def cmd(command, record=True):
op = {'op': 'cmd', 'cmd': command}
if not record:
op['record'] = False
return op
def setup(*commands):
return [cmd(c, False) for c in commands]
BASE = (0, 200, 0)
def group_setup():
return [
*setup('/gamerule spawn_mobs false', '/gamerule mob_drops false', '/gamerule entity_drops false',
'/gamerule advance_time false', '/gamerule advance_weather false', '/gamerule spawn_wandering_traders false',
'/gamerule spawn_patrols false', '/gamerule spawn_phantoms false', '/gamerule spawn_wardens false',
'/gamerule show_advancement_messages false', '/gamemode creative', '/tp @s 8.5 230 8.5 0 0'),
{'op': 'settle'},
*setup('/kill @e[type=!player]'),
{'op': 'tick', 'n': 25},
*setup('/kill @e[type=!player]'),
{'op': 'tick', 'n': 25},
*setup('/fill 0 200 0 15 228 15 air', '/time set 1000', '/weather clear', '/difficulty normal', '/clear @s'),
]
def client_commands():
return [
cmd('/version'),
cmd('/spectate'),
cmd('/spectate @s'),
cmd('/gamemode spectator'),
cmd('/spectate'),
cmd('/spectate @s'),
cmd('/spectate @s @s'),
cmd('/gamemode creative'),
cmd('/posteffect list @s'),
cmd('/posteffect remove @s minecraft:blur'),
cmd('/posteffect clear @s'),
cmd('/posteffect add @s minecraft:blur'),
cmd('/posteffect add @s minecraft:blur'),
cmd('/posteffect add @a minecraft:invert'),
cmd('/posteffect list @s'),
cmd('/posteffect remove @s minecraft:blur'),
cmd('/posteffect remove @p minecraft:blur'),
cmd('/posteffect list @p'),
cmd('/posteffect clear @s'),
cmd('/posteffect clear @s'),
cmd('/waypoint list'),
cmd('/waypoint modify @s color red'),
cmd('/waypoint modify @s color dark_aqua'),
cmd('/waypoint modify @s color hex 12ab3f'),
cmd('/waypoint modify @s color hex F0A'),
cmd('/waypoint list'),
cmd('/waypoint modify @s color reset'),
cmd('/waypoint modify @s style set minecraft:bowtie'),
cmd('/waypoint modify @s style reset'),
cmd('/waypoint list'),
cmd('/dialog show @s minecraft:server_links'),
cmd('/dialog show @a minecraft:quick_actions'),
cmd('/dialog show @s {type:"minecraft:notice",title:"Hello"}'),
cmd('/dialog clear @s'),
cmd('/dialog clear @a'),
cmd('/kick @s'),
cmd('/kick @s Go away'),
cmd('/kick Player'),
cmd('/fetchprofile name Notch'),
{'op': 'tick', 'n': 5, 'record': True},
cmd('/fetchprofile id 069a79f4-44e9-4726-a5be-fca90e38aaf5'),
{'op': 'tick', 'n': 5, 'record': True},
cmd('/unpublish'),
cmd('/debug stop'),
cmd('/debug start'),
cmd('/debug start'),
cmd('/debug stop'),
cmd('/debug stop'),
cmd('/jfr stop'),
]
def game_state():
return [
cmd('/gamemode survival'),
cmd('/gamemode survival'),
cmd('/gamemode adventure @s'),
cmd('/gamemode creative @a'),
cmd('/defaultgamemode survival'),
cmd('/defaultgamemode creative'),
cmd('/difficulty'),
cmd('/difficulty hard'),
cmd('/difficulty hard'),
cmd('/difficulty normal'),
cmd('/seed'),
cmd('/time set 1000'),
cmd('/time query daytime'),
cmd('/time set noon'),
cmd('/time set night'),
cmd('/time add 100'),
cmd('/time set 1000'),
cmd('/weather rain'),
cmd('/weather thunder 600'),
cmd('/weather clear 1d'),
cmd('/gamerule keep_inventory'),
cmd('/gamerule keep_inventory true'),
cmd('/gamerule keep_inventory'),
cmd('/gamerule keep_inventory false'),
cmd('/gamerule random_tick_speed 5'),
cmd('/gamerule random_tick_speed'),
cmd('/gamerule random_tick_speed 3'),
cmd('/list'),
cmd('/say Hello world'),
cmd('/me waves'),
cmd('/msg @s secret'),
cmd('/tellraw @s {"text":"raw","color":"gold","bold":true}'),
cmd('/tellraw @s ["a",{"text":"b","italic":true},{"translate":"block.minecraft.stone"}]'),
cmd('/title @s title "Hi"'),
cmd('/title @s subtitle "Sub"'),
cmd('/title @s actionbar "Bar"'),
cmd('/title @s times 10 20 30'),
cmd('/title @s clear'),
cmd('/title @s reset'),
cmd('/help gamemode'),
cmd('/random value 5..5'),
cmd('/random roll 7..7'),
cmd('/tick query'),
cmd('/stopwatch create harness:a'),
cmd('/stopwatch create harness:a'),
cmd('/stopwatch query harness:b'),
]
def player_state():
return [
*setup('/gamemode survival'),
cmd('/experience add @s 10'),
cmd('/experience add @s 3 levels'),
cmd('/experience query @s levels'),
cmd('/experience query @s points'),
cmd('/experience set @s 0 levels'),
cmd('/xp set @s 5 points'),
cmd('/experience query @s points'),
cmd('/effect give @s minecraft:speed 30 1'),
cmd('/effect give @s minecraft:speed 10 0'),
cmd('/effect give @s minecraft:night_vision infinite 0 true'),
cmd('/effect clear @s minecraft:speed'),
cmd('/effect clear @s minecraft:speed'),
cmd('/effect clear @s'),
cmd('/effect clear @s'),
cmd('/give @s minecraft:diamond 3'),
cmd('/give @s minecraft:diamond_sword[minecraft:custom_name="Blade"]'),
cmd('/give @s minecraft:stone 130'),
cmd('/clear @s minecraft:diamond 0'),
cmd('/clear @s minecraft:stone 0'),
cmd('/clear @s minecraft:stone 64'),
cmd('/clear @s minecraft:stone 0'),
cmd('/item replace entity @s weapon.mainhand with minecraft:iron_pickaxe'),
cmd('/enchant @s minecraft:efficiency 3'),
cmd('/enchant @s minecraft:sharpness'),
cmd('/enchant @s minecraft:efficiency 9'),
cmd('/item replace entity @s armor.head with minecraft:golden_helmet'),
cmd('/clear @s minecraft:golden_helmet 0'),
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_count",count:1}'),
cmd('/clear @s'),
cmd('/clear @s'),
cmd('/attribute @s minecraft:max_health get'),
cmd('/attribute @s minecraft:max_health base get'),
cmd('/attribute @s minecraft:max_health base set 30'),
cmd('/attribute @s minecraft:max_health modifier add harness:extra 4 add_value'),
cmd('/attribute @s minecraft:max_health modifier value get harness:extra'),
cmd('/attribute @s minecraft:max_health get'),
cmd('/attribute @s minecraft:max_health modifier remove harness:extra'),
cmd('/attribute @s minecraft:max_health base reset'),
cmd('/spawnpoint @s 8 230 8'),
cmd('/setworldspawn 8 230 8'),
cmd('/tp @s 8.5 230 8.5'),
cmd('/tp @s ~1 ~ ~'),
cmd('/teleport @s 8.5 230 8.5 90 0'),
cmd('/rotate @s 45 10'),
cmd('/damage @s 2'),
cmd('/damage @s 1 minecraft:magic'),
*setup('/gamemode creative'),
]
def world_blocks():
return [
cmd('/setblock 2 205 2 minecraft:stone'),
cmd('/setblock 2 205 2 minecraft:stone'),
cmd('/setblock 2 205 2 minecraft:oak_stairs[facing=east]'),
cmd('/execute if block 2 205 2 minecraft:oak_stairs[facing=east]'),
cmd('/execute if block 2 205 2 minecraft:stone'),
cmd('/execute unless block 2 205 2 minecraft:stone'),
cmd('/fill 0 201 0 4 203 4 minecraft:glass'),
cmd('/fill 0 201 0 4 203 4 minecraft:glass'),
cmd('/fill 0 201 0 4 203 4 minecraft:stone hollow'),
cmd('/fill 0 201 0 4 203 4 minecraft:dirt replace minecraft:stone'),
cmd('/fill 0 201 0 4 203 4 minecraft:air destroy'),
cmd('/execute if blocks 0 201 0 4 203 4 0 210 0 all'),
cmd('/setblock 3 206 3 minecraft:chest'),
cmd('/item replace block 3 206 3 container.0 with minecraft:apple 5'),
cmd('/data get block 3 206 3 Items[0].count'),
cmd('/data merge block 3 206 3 {CustomName:"Box"}'),
cmd('/clone 0 205 0 4 207 4 6 205 6'),
cmd('/clone 0 205 0 4 207 4 6 205 6 masked'),
cmd('/execute if blocks 0 205 0 4 207 4 6 205 6 all'),
cmd('/setblock 3 206 3 minecraft:air'),
cmd('/fill 0 200 0 15 228 15 air'),
cmd('/execute if block 0 300 0 air'),
cmd('/setblock 0 400 0 stone'),
cmd('/worldborder get'),
cmd('/worldborder set 1000'),
cmd('/worldborder set 1000'),
cmd('/worldborder center 10 20'),
cmd('/worldborder center 10 20'),
cmd('/worldborder damage amount 0.5'),
cmd('/worldborder damage buffer 3'),
cmd('/worldborder warning distance 10'),
cmd('/worldborder warning time 20'),
cmd('/worldborder add 100'),
cmd('/worldborder get'),
cmd('/worldborder set 59999968'),
cmd('/worldborder center 0 0'),
]
def entities():
return [
cmd('/summon minecraft:pig 4.5 210 4.5 {NoAI:1b,NoGravity:1b,Tags:["a","h"]}'),
cmd('/summon minecraft:cow 6.5 210 4.5 {NoAI:1b,NoGravity:1b,CustomName:"Daisy",Tags:["h"]}'),
cmd('/summon minecraft:armor_stand 8.5 210 4.5 {NoGravity:1b}'),
cmd('/execute if entity @e[tag=h,type=minecraft:pig]'),
cmd('/execute if entity @e[tag=h,type=minecraft:sheep]'),
cmd('/tag @e[tag=h,type=minecraft:pig] list'),
cmd('/tag @e[tag=h,type=minecraft:cow] add b'),
cmd('/tag @e[tag=h,type=minecraft:cow] add b'),
cmd('/tag @e[tag=b] list'),
cmd('/tag @e[tag=b] remove b'),
cmd('/data get entity @e[tag=h,type=minecraft:pig,limit=1] Tags'),
cmd('/data get entity @e[tag=h,type=minecraft:cow,limit=1] CustomName'),
cmd('/data merge entity @e[tag=h,type=minecraft:pig,limit=1] {Tags:["a","c"]}'),
cmd('/attribute @e[tag=h,type=minecraft:pig,limit=1] minecraft:movement_speed base get'),
cmd('/effect give @e[tag=h] minecraft:glowing 10'),
cmd('/damage @e[tag=h,type=minecraft:cow,limit=1] 1'),
cmd('/ride @s mount @e[tag=h,type=minecraft:pig,limit=1]'),
cmd('/ride @s dismount'),
cmd('/ride @s dismount'),
cmd('/spectate @e[tag=h,type=minecraft:pig,limit=1]'),
cmd('/gamemode spectator'),
cmd('/spectate @e[tag=h,type=minecraft:pig,limit=1]'),
cmd('/spectate'),
cmd('/gamemode creative'),
cmd('/waypoint modify @e[tag=h,type=minecraft:pig,limit=1] color red'),
cmd('/waypoint modify @e[type=minecraft:armor_stand,limit=1] color red'),
cmd('/fetchprofile entity @e[tag=h,type=minecraft:pig,limit=1]'),
cmd('/kill @e[tag=h,type=minecraft:pig]'),
cmd('/kill @e[tag=h,type=minecraft:pig]'),
cmd('/execute as @e[tag=h] run say mob'),
cmd('/execute store result score @s harness_score run data get entity @s SelectedItemSlot'),
cmd('/kill @e[tag=h]'),
*setup('/kill @e[type=minecraft:armor_stand]'),
{'op': 'tick', 'n': 25},
cmd('/execute if entity @e[tag=h]'),
]
def scores():
return [
cmd('/scoreboard objectives add harness dummy'),
cmd('/scoreboard objectives add harness dummy'),
cmd('/scoreboard objectives add harness_h health "Health"'),
cmd('/scoreboard objectives list'),
cmd('/scoreboard players set @s harness 5'),
cmd('/scoreboard players add @s harness 3'),
cmd('/scoreboard players remove @s harness 1'),
cmd('/scoreboard players get @s harness'),
cmd('/scoreboard players set fake harness 9'),
cmd('/scoreboard players operation @s harness += fake harness'),
cmd('/scoreboard players get @s harness'),
cmd('/scoreboard players list'),
cmd('/scoreboard players list @s'),
cmd('/scoreboard players reset fake harness'),
cmd('/scoreboard players get fake harness'),
cmd('/scoreboard objectives setdisplay list harness'),
cmd('/scoreboard objectives setdisplay sidebar harness'),
cmd('/scoreboard objectives modify harness displayname "Shown"'),
cmd('/scoreboard objectives modify harness rendertype hearts'),
cmd('/execute store result score @s harness run scoreboard players get @s harness'),
cmd('/execute if score @s harness matches 15'),
cmd('/team add red_team'),
cmd('/team add red_team'),
cmd('/team modify red_team color red'),
cmd('/team modify red_team prefix "[R] "'),
cmd('/team join red_team @s'),
cmd('/team list'),
cmd('/team list red_team'),
cmd('/waypoint list'),
cmd('/team leave @s'),
cmd('/team remove red_team'),
cmd('/scoreboard objectives remove harness'),
cmd('/scoreboard objectives remove harness_h'),
cmd('/bossbar add harness:bar "Bar"'),
cmd('/bossbar add harness:bar "Bar"'),
cmd('/bossbar set harness:bar value 30'),
cmd('/bossbar set harness:bar max 60'),
cmd('/bossbar set harness:bar color red'),
cmd('/bossbar set harness:bar style notched_10'),
cmd('/bossbar set harness:bar players @s'),
cmd('/bossbar get harness:bar value'),
cmd('/bossbar get harness:bar players'),
cmd('/bossbar list'),
cmd('/bossbar remove harness:bar'),
cmd('/bossbar remove harness:bar'),
]
def groups():
return [
('setup', group_setup()),
('client commands', client_commands()),
('game state', game_state()),
('player state', player_state()),
('blocks and border', world_blocks()),
('entities', entities()),
('scores, teams and bossbars', scores()),
]