Skip to content

Commit

Permalink
fix: 修复聊天栏文本换行错误
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSkidder committed Jul 8, 2024
1 parent f9079de commit 7ff5829
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import top.fpsmaster.FPSMaster;
import top.fpsmaster.forge.api.IChatLine;
import top.fpsmaster.features.impl.interfaces.BetterChat;
Expand Down Expand Up @@ -253,4 +255,15 @@ public ITextComponent getChatComponent(int mouseX, int mouseY) {
}
}
}

@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/text/ITextComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;"))
public List<ITextComponent> spilt(ITextComponent chatComponent, int i, FontRenderer fontRenderer, boolean b, boolean b1){
BetterChat module = (BetterChat) FPSMaster.moduleManager.getModule(BetterChat.class);

if (BetterChat.using && module.betterFont.getValue()) {
return GuiUtilRenderComponents.splitText(chatComponent, i, FPSMaster.fontManager.s16, false, false);
} else {
return GuiUtilRenderComponents.splitText(chatComponent, i, mc.fontRenderer, false, false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import top.fpsmaster.FPSMaster;
import top.fpsmaster.forge.api.IChatLine;
import top.fpsmaster.features.impl.interfaces.BetterChat;
Expand Down Expand Up @@ -255,4 +257,15 @@ public IChatComponent getChatComponent(int mouseX, int mouseY) {
}
}
}

@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/IChatComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;"))
public List<IChatComponent> spilt(IChatComponent chatComponent, int i, FontRenderer chatcomponenttext, boolean l, boolean chatcomponenttext2){
BetterChat module = (BetterChat) FPSMaster.moduleManager.getModule(BetterChat.class);

if (BetterChat.using && module.betterFont.getValue()) {
return GuiUtilRenderComponents.splitText(chatComponent, i, FPSMaster.fontManager.s16, false, false);
} else {
return GuiUtilRenderComponents.splitText(chatComponent, i, mc.fontRendererObj, false, false);
}
}
}

0 comments on commit 7ff5829

Please sign in to comment.