Iron-HIM
本帖最后由 Iron-HIM 于 2021-7-2 14:37 编辑

例如这样:


(图为 AdvancedChat Fabric Mod 的实现方式)但是我并未理解AdvancedChat实现该方法的方式。
还请各位大佬指教
https://github.com/DarkKronicle/AdvancedChat

我现在想要在Forge上实现相同功能,发现在原版方法里面有通过设置修改背景颜色深度的代码:
  1. public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
  2.       this.setListener(this.inputField);
  3.       this.inputField.setFocused2(true);
  4.       fill(matrixStack, 2, this.height - 14, this.width - 2, this.height - 2, this.minecraft.gameSettings.getChatBackgroundColor(Integer.MIN_VALUE));
  5.       this.inputField.render(matrixStack, mouseX, mouseY, partialTicks);
  6.       this.commandSuggestionHelper.drawSuggestionList(matrixStack, mouseX, mouseY);
  7.       Style style = this.minecraft.ingameGUI.getChatGUI().func_238494_b_((double)mouseX, (double)mouseY);
  8.       if (style != null && style.getHoverEvent() != null) {
  9.          this.renderComponentHoverEffect(matrixStack, style, mouseX, mouseY);
  10.       }

  11.       super.render(matrixStack, mouseX, mouseY, partialTicks);
  12.    }
复制代码

求大佬帮助,比如让玩家输入一些特定的字符例如&i修改该消息文本背景颜色为红色或者什么之类的

另外希望能够准确地描述一下该方法的实现方式,万分感谢。




第一页 上一页 下一页 最后一页