Skip to content

Commit 3c7b4ab

Browse files
committed
fix(DrawUtils): prevent stripping non-color formatting codes in chroma and style rendering
1 parent 7c85a06 commit 3c7b4ab

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
@@ -37,9 +37,11 @@
3737
import org.joml.Matrix4f;
3838

3939
import java.util.function.Function;
40+
import java.util.regex.Pattern;
4041

4142
public class DrawUtils {
4243

44+
private static final Pattern COLOR_CODE_PATTERN = Pattern.compile("(?i)§[0-9A-F]");
4345
public static final RenderPipeline CHROMA_STANDARD = RenderPipelines.register(
4446
RenderPipeline.builder(RenderPipelines.MATRICES_PROJECTION_SNIPPET)
4547
.withLocation(SkyblockAddons.identifier("sba_chroma_standard"))
@@ -187,8 +189,7 @@ public static void drawText(GuiGraphics graphics, Component text, float x, float
187189
FormattedCharSequence strippedFcs = null;
188190

189191
if (styleTwo || (isChroma && Feature.CHROMA_MODE.getValue() == ChromaMode.FADE)) {
190-
String strippedText = TextUtils.stripColor(text.getString());
191-
if (strippedText == null) strippedText = "";
192+
String strippedText = COLOR_CODE_PATTERN.matcher(text.getString()).replaceAll("");
192193

193194
if (styleTwo) {
194195
strippedFcs = Language.getInstance().getVisualOrder(FormattedText.of(strippedText));

0 commit comments

Comments
 (0)