Rebuild the logic, RGB color supported now. & Update to 26.2 - #18
Rebuild the logic, RGB color supported now. & Update to 26.2#18APairOfMoons wants to merge 10 commits into
Conversation
The text format is now composed by the mod itself, rather than the game.
|
话说兄弟是国人吗?介意用中文交流不?(笑) |
|
Here is a pre built version available for quick testing: |
|
If you have any unsatisfactory opinions or suggestions for improvement, plese do not hesitate to let me know. ( ̄︶ ̄*)) |
CPTProgrammer
left a comment
There was a problem hiding this comment.
感谢你的贡献!
我简单看了一下,有不少小问题,具体我都有写在评论里。
不过从整体方向来看,我暂时不打算给这个 mod 加这么多功能,所以这个 PR 就不合并了。
再次感谢,你可以保留你的 fork 版本自己使用!
Thanks for your contribution!
I took a quick look and noticed a few minor issues, which I've detailed in the comments. However, looking at the overall direction, I don't plan to add this many features to the mod right now, so I won't be merging this PR.
Thanks again, and feel free to keep your fork and use it for yourself!
| public static final Map<Character, ChatColorFormat> VANILLA_COLOR_FORMATS = Map.ofEntries( | ||
| Map.entry('0', new ChatColorFormat(0, 0, 0, 0)), | ||
| Map.entry('1', new ChatColorFormat(0, 0, 0, 170)), | ||
| Map.entry('2', new ChatColorFormat(0, 0, 170, 0)), | ||
| Map.entry('3', new ChatColorFormat(0, 0, 170, 170)), | ||
| Map.entry('4', new ChatColorFormat(0, 170, 0, 0)), | ||
| Map.entry('5', new ChatColorFormat(0, 170, 0, 170)), | ||
| Map.entry('6', new ChatColorFormat(0, 255, 170, 0)), | ||
| Map.entry('7', new ChatColorFormat(0, 170, 170, 170)), | ||
| Map.entry('8', new ChatColorFormat(0, 85, 85, 85)), | ||
| Map.entry('9', new ChatColorFormat(0, 85, 85, 255)), | ||
| Map.entry('a', new ChatColorFormat(0, 85, 255, 85)), | ||
| Map.entry('b', new ChatColorFormat(0, 85, 255, 255)), | ||
| Map.entry('c', new ChatColorFormat(0, 255, 85, 85)), | ||
| Map.entry('d', new ChatColorFormat(0, 255, 85, 255)), | ||
| Map.entry('e', new ChatColorFormat(0, 255, 255, 85)), | ||
| Map.entry('f', new ChatColorFormat(0, 255, 255, 255)) | ||
| ); |
There was a problem hiding this comment.
不应该硬编码,net.minecraft.util.Formatting (Yarn 映射) 里有这些的数据
This shouldn't be hardcoded. You can find these values in net.minecraft.util.Formatting (yarn mappings).
| public static final Map<Character, ChatFormatting> VANILLA_FONT_FORMATS = Map.ofEntries( | ||
| Map.entry('k', ChatFormatting.OBFUSCATED), | ||
| Map.entry('l', ChatFormatting.BOLD), | ||
| Map.entry('m', ChatFormatting.STRIKETHROUGH), | ||
| Map.entry('n', ChatFormatting.UNDERLINE), | ||
| Map.entry('o', ChatFormatting.ITALIC) | ||
| ); |
There was a problem hiding this comment.
同上,不应该硬编码
Same as above, this shouldn't be hardcoded.
| /* Debug | ||
| sourcePlayer.sendSystemMessage(Component.literal(sourceRawText)); | ||
| sourcePlayer.sendSystemMessage(Component.literal(sourceLiteralText)); | ||
| for (int i : formatsTable.keySet()) { | ||
| ArrayList<ChatFormat> formatsList = formatsTable.get(i); | ||
| sourcePlayer.sendSystemMessage(Component.literal(i + ".")); | ||
| for (ChatFormat format : formatsList) { | ||
| if (format instanceof ChatInsertItemFormat) { | ||
| sourcePlayer.sendSystemMessage(Component.literal(" 物品插入数据")); | ||
| } | ||
| if (format instanceof ChatResetFormat) { | ||
| sourcePlayer.sendSystemMessage(Component.literal(" 清除")); | ||
| } | ||
| if (format instanceof ChatColorFormat colorFormat) { | ||
| sourcePlayer.sendSystemMessage(Component.literal(" 颜色:" + colorFormat.getR() + " " + colorFormat.getG() + " " + colorFormat.getB())); | ||
| } | ||
| if (format instanceof ChatFontFormat fontFormat) { | ||
| sourcePlayer.sendSystemMessage(Component.literal(" 字体").withStyle(fontFormat.getFont())); | ||
| } | ||
| } | ||
| }*/ |
There was a problem hiding this comment.
Debug 代码不应该被提交
Debug code shouldn't be committed.
|
|
||
| if (formatsList.getFirst() instanceof ChatInsertItemFormat insertItem) { | ||
|
|
||
| if (sourceText.getContents() instanceof #if MC_VER <= MC_1_20 LiteralContents #else PlainTextContents #endif plainTextContent) { |
There was a problem hiding this comment.
多版本的预处理被删了,导致构建失败
The multi-version preprocessor got removed here, which breaks the build.
There was a problem hiding this comment.
不应该删除 Dynmap 的 Mixin,毕竟其他 MC 版本还需要兼容的代码。就算要删,也应该直接删除文件,而不是加 .disabled 后缀
The Dynmap Mixin shouldn't be removed, as the code is still needed for compatibility with other Minecraft versions. If it really needs to be removed, the file should be deleted directly rather than renamed with a .disabled suffix.
|
|
||
| # Mod Properties | ||
| mod_version=1.1.1 | ||
| mod_version=1.2.1 |
There was a problem hiding this comment.
一般来说,不应该在 PR 里更新版本号
As a general rule, version numbers shouldn't be bumped in PRs.
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip |
There was a problem hiding this comment.
不应该修改 Gradle wrapper 版本
You shouldn't change the Gradle wrapper version.
The text format is now composed by the mod itself, rather than the game.
Updated to 26.2.
Discard the Dynmap compatibility because it dosn't updated to 26.2. LMAO
RGB color is supported now, use #RRGGBB to apply.
Single '&' don't need to be escaped input now.