Skip to content

[Enhancement] 原理图管理优化#5366

Open
Calboot wants to merge 54 commits intoHMCL-dev:mainfrom
Calboot:litematica
Open

[Enhancement] 原理图管理优化#5366
Calboot wants to merge 54 commits intoHMCL-dev:mainfrom
Calboot:litematica

Conversation

@Calboot
Copy link
Contributor

@Calboot Calboot commented Jan 30, 2026

可能会做:

  • forgematica 识别

Resolves #4052 Resolves #4518 Resolves #3957

#3597 应在本 pr 和 #5095 均合并后再关闭

@Calboot Calboot marked this pull request as ready for review February 1, 2026 04:58
@Calboot Calboot changed the title [Feature] 原理图管理优化 [Enhancement] 原理图管理优化 Feb 1, 2026
@3gf8jv4dv
Copy link
Contributor

路径前面可以加个文本,例如 Location: schematics/directory/...

@Calboot
Copy link
Contributor Author

Calboot commented Feb 1, 2026

路径前面可以加个文本,例如 Location: schematics/directory/...

其实我是想做成文件管理器那种形式,一般是没有提示语的

我给路径末尾加个/来提示这是路径

@3gf8jv4dv
Copy link
Contributor

其实我是想做成文件管理器那种形式,一般是没有提示语的

我给路径末尾加个/来提示这是路径

👌

@Calboot Calboot marked this pull request as draft February 1, 2026 12:08
@3gf8jv4dv
Copy link
Contributor

对于 1.16.5 及以上的 LexForge/NeoForge 实例,是否可以引导用户安装 Forgematica 而不是上游。

@Calboot
Copy link
Contributor Author

Calboot commented Feb 2, 2026

对于 1.16.5 及以上的 LexForge/NeoForge 实例,是否可以引导用户安装 Forgematica 而不是上游。

在做

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances the schematic management functionality in HMCL with comprehensive improvements including:

Purpose: Modernize and expand schematic file support, add custom directory configuration, improve UI/UX with better navigation and warnings, and integrate NBT viewing capabilities.

Changes:

  • Added support for multiple schematic formats (Litematic, NBT Structure, Schem/Schematic) beyond just Litematic files
  • Implemented custom Litematica directory detection from configuration files
  • Redesigned SchematicsPage UI with breadcrumb navigation, back button, warning messages for missing/disabled mods, and NBT viewer integration
  • Refactored code to use a common Schematic base class with format-specific implementations

Reviewed changes

Copilot reviewed 28 out of 31 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
Vec3i.java New record class for 3D integer vectors replacing JavaFX Point3D
SchematicType.java Enum for schematic file type detection by extension
Schematic.java Abstract base class for all schematic formats with common functionality
LitematicFile.java Refactored to extend Schematic base class
SchemFile.java New class supporting Schematica and Sponge Schem formats
NBTStructureFile.java New class for vanilla NBT structure files
LitematicaConfig.java Configuration model for reading Litematica custom directory settings
DefaultGameRepository.java Added logic to read custom schematic directory from Litematica config
ModManager.java Extracted supported loaders logic to be reusable
ModAdviser.java Moved schematics from hidden to suggested list for modpack exports
SchematicsPage.java Major UI refactoring with navigation improvements and warning system
NBTFileType.java Added schematic file extensions to NBT file type support
I18N properties Added localization strings for new UI elements across all languages
SchematicTest.java Comprehensive tests for all schematic format loading

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Conflicts:
#	HMCL/src/main/resources/assets/lang/I18N.properties
#	HMCL/src/main/resources/assets/lang/I18N_ar.properties
#	HMCL/src/main/resources/assets/lang/I18N_es.properties
#	HMCL/src/main/resources/assets/lang/I18N_ru.properties
#	HMCL/src/main/resources/assets/lang/I18N_uk.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
@Calboot
Copy link
Contributor Author

Calboot commented Feb 6, 2026

@3gf8jv4dv 为啥要把非完全支持语言的schematics.create_directory schematics.add 都删了啊
schematics.add.title 也没完全添加上去

@3gf8jv4dv
Copy link
Contributor

@3gf8jv4dv 为啥要把非完全支持语言的schematics.create_directory schematics.add 都删了啊
schematics.add.title 也没完全添加上去

因为当时考虑到英文的译文改了,删了的意思是希望重新翻译。

schematics.add.title 是新文本,当时只给简繁英加了。
「没完全添加」是说文言吗?没想好怎么翻合适。

@Calboot
Copy link
Contributor Author

Calboot commented Feb 6, 2026

因为当时考虑到英文的译文改了,删了的意思是希望重新翻译。

schematics.add.title 是新文本,当时只给简繁英加了。 「没完全添加」是说文言吗?没想好怎么翻合适。

哦哦哦,got it

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 32 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java:212

  • updateSupportedLoaders() is called before scanning the mods directory. The logic inside it depends on hasMod("kilt"...) / hasMod("connectormod"...), which won’t work until after addModInfo(...) populates localMods. This can make supportedLoaders incomplete/incorrect.

Consider calling updateSupportedLoaders() after mods have been loaded (or call it twice: once for analyzer-only loader inference, then again after mod metadata is parsed).

    public void refreshMods() throws IOException {
        localModFiles.clear();
        localMods.clear();

        var resolved = getRepository().getResolvedPreservingPatchesVersion(id);
        gameVersion = repository.getGameVersion(resolved).orElse(null);
        analyzer = LibraryAnalyzer.analyze(resolved, gameVersion);

        updateSupportedLoaders();

        boolean supportSubfolders = analyzer.has(LibraryAnalyzer.LibraryType.FORGE)
                || analyzer.has(LibraryAnalyzer.LibraryType.QUILT);

        if (Files.isDirectory(getModsDirectory())) {
            try (DirectoryStream<Path> modsDirectoryStream = Files.newDirectoryStream(getModsDirectory())) {
                for (Path subitem : modsDirectoryStream) {
                    if (supportSubfolders && Files.isDirectory(subitem) && !".connector".equalsIgnoreCase(subitem.getFileName().toString())) {
                        try (DirectoryStream<Path> subitemDirectoryStream = Files.newDirectoryStream(subitem)) {
                            for (Path subsubitem : subitemDirectoryStream) {
                                addModInfo(subsubitem);
                            }
                        }
                    } else {
                        addModInfo(subitem);
                    }
                }
            }
        }
        loaded = true;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

&& GameVersionNumber.asGameVersion(Optional.ofNullable(modManager.getGameVersion())).isAtLeast("1.16.4", "20w45a");
if (litematica == null && !shouldUseForgematica) {
try {
litematica = ModrinthRemoteModRepository.MODS.getModById("litematica");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要在默认线程池中执行网络操作。

而且我觉得这样做可能不太必要,我觉得如果没有检测到用户安装相关模组的话直接隐藏掉这个标签页可能更合适。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

而且我觉得这样做可能不太必要,我觉得如果没有检测到用户安装相关模组的话直接隐藏掉这个标签页可能更合适。

那万一识别错了或者人家只是暂时不想装不就炸了吗,直接用不了。现在如果出错起码还能用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants