Skip to content

Commit c2da4d9

Browse files
committed
fix(DrawUtils): prevent stripping non-color formatting codes in chroma and style rendering
1 parent d4868c7 commit c2da4d9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/fix3dll/skyblockaddons/utils/DrawUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
import org.joml.Matrix4f;
3939

4040
import java.util.function.Function;
41+
import java.util.regex.Pattern;
4142

4243
public class DrawUtils {
4344

45+
private static final Pattern COLOR_CODE_PATTERN = Pattern.compile("(?i)§[0-9A-F]");
4446
public static final RenderPipeline CHROMA_STANDARD = RenderPipelines.register(
4547
RenderPipeline.builder(RenderPipelines.MATRICES_PROJECTION_SNIPPET)
4648
.withLocation(SkyblockAddons.resourceLocation("sba_chroma_standard"))
@@ -191,8 +193,7 @@ public static void drawText(GuiGraphics graphics, Component text, float x, float
191193
FormattedCharSequence strippedFcs = null;
192194

193195
if (styleTwo || (isChroma && Feature.CHROMA_MODE.getValue() == ChromaMode.FADE)) {
194-
String strippedText = TextUtils.stripColor(text.getString());
195-
if (strippedText == null) strippedText = "";
196+
String strippedText = COLOR_CODE_PATTERN.matcher(text.getString()).replaceAll("");
196197

197198
if (styleTwo) {
198199
strippedFcs = Language.getInstance().getVisualOrder(FormattedText.of(strippedText));

0 commit comments

Comments
 (0)