Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/packer/1.12.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@
"……": "\u22ef\u22ef"
},
"destinationReplacement": {}
},
"rules": {

@mamaruo mamaruo Jun 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

request更特定的语义化的字段名

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

request更特定的语义化的字段名

identifierRules(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

namespaceDiscriminator

"ae2-stuff": "displayName"
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

空格一定转换为下划线吗

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

本来想保留空格,但是Packer的正则不允许有空格,原因可能得问一下 @dovisutu

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

参https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6,有空格的话游戏读取资源包的时候会爆
我印象中这里是真的爆了一次之后加的校验,翻翻提交历史可能还翻得出来

File renamed without changes.
7 changes: 4 additions & 3 deletions src/Packer/Extensions/ContentExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ public static string GetNamespace(this string path)
}


[GeneratedRegex(@"^[a-z0-9_.-]+$", RegexOptions.Singleline)]
internal static partial Regex ValidNamespaceRegex();
[GeneratedRegex(@"^[a-z0-9_.-]+(?:-CFPA-[A-Za-z0-9_.\- ]+)?$", RegexOptions.Singleline)]
internal static partial Regex ValidNamespaceRegex();

/// <summary>
/// 检查命名空间名称是否合法
/// </summary>
/// <remarks>
/// 合法的命名空间名称只包括小写字母、数字、_、.、-
/// 合法的命名空间名称只包括小写字母、数字、_、.、-;
/// 也允许在合法命名空间后追加 -CFPA- 与作者名,作者名可包含大小写英文字母、数字、-、_、. 和空格。
/// </remarks>
/// <param name="namespaceName">待校验的命名空间名称</param>
/// <returns>若合法,返回<see langword="true" /></returns>
Expand Down
Loading