本帖最后由 Iron-HIM 于 2021-7-2 14:37 编辑
例如这样:
(图为 AdvancedChat Fabric Mod 的实现方式)但是我并未理解AdvancedChat实现该方法的方式。
还请各位大佬指教
https://github.com/DarkKronicle/AdvancedChat
我现在想要在Forge上实现相同功能,发现在原版方法里面有通过设置修改背景颜色深度的代码:
复制代码
求大佬帮助,比如让玩家输入一些特定的字符例如&i修改该消息文本背景颜色为红色或者什么之类的
另外希望能够准确地描述一下该方法的实现方式,万分感谢。
例如这样:

(图为 AdvancedChat Fabric Mod 的实现方式)但是我并未理解AdvancedChat实现该方法的方式。
还请各位大佬指教
https://github.com/DarkKronicle/AdvancedChat
我现在想要在Forge上实现相同功能,发现在原版方法里面有通过设置修改背景颜色深度的代码:
- public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
- this.setListener(this.inputField);
- this.inputField.setFocused2(true);
- fill(matrixStack, 2, this.height - 14, this.width - 2, this.height - 2, this.minecraft.gameSettings.getChatBackgroundColor(Integer.MIN_VALUE));
- this.inputField.render(matrixStack, mouseX, mouseY, partialTicks);
- this.commandSuggestionHelper.drawSuggestionList(matrixStack, mouseX, mouseY);
- Style style = this.minecraft.ingameGUI.getChatGUI().func_238494_b_((double)mouseX, (double)mouseY);
- if (style != null && style.getHoverEvent() != null) {
- this.renderComponentHoverEffect(matrixStack, style, mouseX, mouseY);
- }
- super.render(matrixStack, mouseX, mouseY, partialTicks);
- }
求大佬帮助,比如让玩家输入一些特定的字符例如&i修改该消息文本背景颜色为红色或者什么之类的
另外希望能够准确地描述一下该方法的实现方式,万分感谢。