Skip to content

Rebuild the logic, RGB color supported now. & Update to 26.2 - #18

Closed
APairOfMoons wants to merge 10 commits into
CPTProgrammer:devfrom
KaituoDev:kaituo
Closed

Rebuild the logic, RGB color supported now. & Update to 26.2#18
APairOfMoons wants to merge 10 commits into
CPTProgrammer:devfrom
KaituoDev:kaituo

Conversation

@APairOfMoons

Copy link
Copy Markdown

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.

APairOfMoons and others added 3 commits June 30, 2026 23:06
@APairOfMoons

Copy link
Copy Markdown
Author

话说兄弟是国人吗?介意用中文交流不?(笑)

@APairOfMoons

Copy link
Copy Markdown
Author

Here is a pre built version available for quick testing:
chat-plus-1.2.1-mc26.2.zip

@APairOfMoons

Copy link
Copy Markdown
Author

If you have any unsatisfactory opinions or suggestions for improvement, plese do not hesitate to let me know. ( ̄︶ ̄*))

@CPTProgrammer CPTProgrammer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

感谢你的贡献!

我简单看了一下,有不少小问题,具体我都有写在评论里。
不过从整体方向来看,我暂时不打算给这个 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!

Comment on lines +60 to +77
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))
);

@CPTProgrammer CPTProgrammer Jul 5, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

不应该硬编码,net.minecraft.util.Formatting (Yarn 映射) 里有这些的数据


This shouldn't be hardcoded. You can find these values in net.minecraft.util.Formatting (yarn mappings).

Comment on lines +44 to +50
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)
);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

同上,不应该硬编码


Same as above, this shouldn't be hardcoded.

Comment on lines +41 to +61
/* 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()));
}
}
}*/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

多版本的预处理被删了,导致构建失败


The multi-version preprocessor got removed here, which breaks the build.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

不应该删除 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.

Comment thread gradle.properties

# Mod Properties
mod_version=1.1.1
mod_version=1.2.1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

一般来说,不应该在 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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

不应该修改 Gradle wrapper 版本


You shouldn't change the Gradle wrapper version.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants