Commit Graph

12 Commits

Author SHA1 Message Date
Ludovic Marie 3cfb7b8053 Mods' commands in the chat's command tree (#456)
A mod's commands ran but the chat box parsed against vanilla's tree only,
so `/coords` showed red as unknown and never completed. The game now keeps
the chat's tree as vanilla's plus a literal per running mod's command (every
permission level, optional greedy `args`), rebuilt when mods start, reload
or stop.

Fixes #456

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 06:48:56 +02:00
Ludovic Marie e0b5e25c1a Commands: prune suggestions in the chat only, like the client's tree
Brigadier's getCompletionSuggestions lists every child whatever its
requirement (command_parse compares it at permission 4, 2 and 0); only the
tree the server sends the client is pruned (Commands.sendCommands). The
player's chat now asks client_suggestions, which skips what the player
may not use; guests' ask_server requests keep brigadier's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 00:42:38 +02:00
Ludovic Marie d1495076e6 Commands follow the world's Allow Commands (#372)
The single-player owner was always at permission level 4. Like
IntegratedServer.getProfilePermissions, the owner now gets OWNER (4)
only when the world allows commands, else ALL (0): /gamemode, /give and
friends answer "Unknown or incomplete command" and are not suggested
(the client's tree only holds usable nodes, Commands.sendCommands).
allowCommands is read from level.dat, set by World Options, and worlds
made without the Create New World screen take its default (Creative only).
The server console, the command harness and horizon-ctl `command` keep
the owner's level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:53:24 +02:00
Ludovic Marie 6734879ff7 Pass rustfmt and clippy after merging the parity branches
Formats the overnight parity work, fixes the lints it introduced, and
updates the LAN bot test and mob AI probe for fields added on the other
side of the merges (the bot test also set a field that never existed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 14:11:51 +02:00
Ludovic Marie 1e03d531eb Parse every command exactly as vanilla's Brigadier tree does
Ports vanilla's packrat parser with SNBT and component-predicate grammars, the
entity selector, block state and item parsers, resource-or-inline codec
arguments, and the remaining argument types, suggestion providers and error
cursors. The tree gains compute, data modify compute, place, locate poi,
datapack create, item modifiers and the parse-only commands (dialog, kick,
posteffect, fetchprofile, spectate, publish, waypoint, debug, jfr), with
release-dispatcher permissions. /particle takes the 26.3 option syntax.

The oracle's stand-in server now holds a fresh world's real state (data pack
managers, pack repository, empty storages, clocks, templates, an overworld),
so vanilla answers every input instead of crashing on about 1,100 per level.
The command parse harness matches on 39,685 of 39,685 commands at permission
levels 4, 2 and 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:56:06 +02:00
Ludovic Marie f0d33d3cf8 WIP: command and datapack tweaks
Work in progress on commands, functions and scoreboard handling carried over from the interrupted run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 08:59:08 +02:00
Ludovic Marie b39bf4c879 Add /place template
Place a saved structure template at a position with rotation, mirroring, integrity, seed and strict mode. Templates come from the world's generated structures first, then the vanilla template files. Block entities and saved entities are placed along with the blocks, and the template ids are offered as suggestions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 13:48:40 +02:00
Ludovic Marie 1952d5b927 Add world and entity commands, loot, world border and force loading
New commands: /recipe, /damage (with at, by and from), /rotate (angles or facing), /swing, /playsound and /stopsound (per sound source, with the minimum volume rule), /particle (dust, block and the other particle options), /attribute (get, base set, reset and modifiers on the player; max health, speed and attack damage on mobs), /ride, /spreadplayers (with teams and a height limit), /forceload (force loaded chunks stay generated and simulated), /fillbiome (with a replace filter and biome tags), /worldborder (set, add, center, damage, warning and get, with the shrink and grow animation, the wall that stops the player and border damage, saved in world_border.dat) and /loot (replace, insert, give and spawn from loot tables, killed mobs, mined blocks and fishing). The sound engine learned to play a sound on a chosen sound source and to stop playing sounds by event or source.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 13:40:02 +02:00
Ludovic Marie c048369be8 Complete /execute and add functions, bossbars, items and tick
/execute now has every vanilla subcommand: store (result or success into scores, boss bars and entity, block or storage data with a type and scale), positioned over a heightmap, summon, on (owner, vehicle, controller, passengers, target, attacker), and the if/unless conditions score (all comparisons and matches), blocks, biome, predicate, function, data, items and slots on top of block, entity, loaded and dimension, with the vanilla pass, fail and count messages. Data packs in the world's datapacks folder (folders and zips) provide functions with comments, line continuation and $ macros, function tags including minecraft:load and minecraft:tick, and predicates; /function (with arguments or "with" sources), /return (value, fail and run), /schedule, /reload and /datapack list, enable and disable work against them. Also added: /bossbar with a boss bar overlay and saving, /item replace, fill and override over player, mob, armor stand, item frame and container slots, /random and /teammsg, and /tick rate, freeze, step and sprint on the game clock.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 13:26:35 +02:00
Ludovic Marie d5d87f23a2 Add /data, /tag and NBT summoning
/data now supports get, merge, modify and remove on entities, block entities and command storage, with NBT paths (children, indices, [] and [{...}] matches, root matches), scaling for numeric reads, the append, prepend, insert, set and merge modifiers, and from, string and value sources. Command storage is saved per namespace in data/<namespace>/command_storage.dat. /tag adds, removes and lists entity tags, which selectors' tag=, nbt= and advancements= options now check. /summon accepts a full NBT compound (custom name, tags, health, NoAI, Invulnerable, item contents and so on), and armor stands, item frames, paintings, boats and minecarts can now be selected, teleported and killed like other entities.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 13:01:12 +02:00
Ludovic Marie df14adbfba Format the workspace with rustfmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 00:28:32 +02:00
Ludovic Marie 67f51123e8 Add vanilla font metrics with unifont fallback, languages, styled text and a Brigadier command core
Font: bitmap glyph ascent/oversampling, unihex glyphs rasterized on demand
into a reserved atlas region, bold/italic/underline/strikethrough and
StringSplitter wrapping. Languages layer lang/<code>.json over en_us.
The command module ports Brigadier parsing, suggestions and smart usage
with the vanilla argument types and the 26.3 command tree; game rules
use the 26.3 registry names and saved-data file.

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