0a116d9523
A pure move, the first slice of splitting the client lib into crates: - horizon-command: the command/ module (Brigadier port, vanilla tree, argument types, selectors), as is. - horizon-client-core: what command needs from the lib, with no other dependency inside it: text, lang, snbt, nbt_path, component, scoreboard, bossbar, gamerules, block_entity_nbt, fastutil_order; plus items moved out of lib modules that sit in the cycle, unchanged: ParticleType (particles.rs), the key display name (keybinds.rs), SOUND_SOURCES (settings.rs), uuid_text/uuid_from_text (save.rs), Registries/RegistryIds and parse_identifier (command/args.rs). horizon-client re-exports every module and item under its old path (`horizon_client::text`, `crate::command::Registries`, `particles::ParticleType`...), so no caller changes. Inside the moved files only paths changed (`crate::snbt` -> `horizon_client_core::snbt` in command, `crate::command::args::parse_identifier` -> `crate::identifier::parse_identifier`...), `sign_side` became pub, lang.rs includes the lang files from horizon-client's assets, and gamerules' test that saves a Level moved to save.rs (it needs the client's save). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
2.0 KiB
Python
42 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare item lore tooltip styles with the pinned vanilla client.
|
|
|
|
Vanilla prints what ``ItemLore.addToTooltip`` adds after ``ComponentUtils.mergeStyles``
|
|
with dark purple italic (VanillaLoreTooltipOracle). Horizon prints what
|
|
``item_tooltip::lore_texts`` gives (examples/probe/lore_tooltip_fixture).
|
|
"""
|
|
try:
|
|
from . import lab, oracle_harness as harness
|
|
except ImportError:
|
|
import lab, oracle_harness as harness
|
|
|
|
# SNBT stacks. A lore line is a text component; italic:0b is an explicit false.
|
|
CASES = [
|
|
'{id:"minecraft:stick",count:1}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"Plain"\']}}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"Gold","color":"gold","italic":0b}\']}}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"A","extra":[{"text":"B","color":"aqua","italic":0b}]}\']}}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"One"\',\'{"text":"Two","bold":1b}\']}}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"Hidden"\'],"minecraft:tooltip_display":{hidden_components:["minecraft:lore"]}}}',
|
|
'{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"Line","underlined":1b,"strikethrough":1b}\']}}',
|
|
]
|
|
|
|
|
|
def cases(build):
|
|
path = build / 'cases.txt'
|
|
path.write_text(''.join(line + '\n' for line in CASES))
|
|
return path, len(CASES)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
harness.differential(
|
|
'lore-tooltip-parity', 'VanillaLoreTooltipOracle', 'lore_tooltip_fixture', cases,
|
|
'Item lore tooltip lines: dark purple italic, child colours, explicit non-italic, and tooltip_display',
|
|
sources=[
|
|
lab.ROOT / 'crates/horizon-client/src/item_tooltip.rs',
|
|
lab.ROOT / 'crates/horizon-client/src/item_data.rs',
|
|
lab.ROOT / 'crates/horizon-client-core/src/text.rs',
|
|
lab.ROOT / 'crates/horizon-client-core/src/component.rs',
|
|
],
|
|
expected_lines=len(CASES))
|