Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
aed6068
Use HexText API bridge
KAMKEEL Nov 7, 2025
32ccdaa
Update dependencies.gradle
KAMKEEL Nov 7, 2025
1b75316
Update dependencies.gradle
KAMKEEL Nov 7, 2025
275a608
Add HexText token highlight support to batched renderer
KAMKEEL Nov 7, 2025
2cb5f86
Support HexText raw mode highlighting
KAMKEEL Nov 7, 2025
3407365
Update dependencies.gradle
KAMKEEL Nov 7, 2025
fa87841
Decouple HexText renderer calls
KAMKEEL Nov 7, 2025
6ba3efb
Slight Reorganization to IF Statements to compress code
KAMKEEL Nov 7, 2025
6cf8e36
Convert to Curse Maven
KAMKEEL Nov 7, 2025
0611690
Simplify HexText compat bridge usage
KAMKEEL Nov 7, 2025
bc24a54
Merge pull request #18 from KAMKEEL/update-hex-text-compat-system-to-api
KAMKEEL Nov 7, 2025
6c571ab
Overhaul HexText integration
KAMKEEL Nov 7, 2025
275547c
Merge pull request #19 from KAMKEEL/update-angelica-s-hex-text-implem…
KAMKEEL Nov 7, 2025
28d3129
Merge branch 'master' into hextext-compat
KAMKEEL Nov 7, 2025
9f91fab
Gate HexText compat usage on API availability
KAMKEEL Nov 8, 2025
83fc6b3
Merge pull request #20 from KAMKEEL/update-hex-text-dependency-to-lat…
KAMKEEL Nov 8, 2025
5db1f9f
Optimize Imports
KAMKEEL Nov 8, 2025
232def7
Simplify HexText compat initialization
KAMKEEL Nov 8, 2025
cf6f6c5
Merge pull request #21 from KAMKEEL/refactor-hex-text-compat-system
KAMKEEL Nov 8, 2025
8d84f4a
Incomplete
KAMKEEL Nov 8, 2025
de9436d
Simplify HexText load check
KAMKEEL Nov 8, 2025
173d2bd
Merge pull request #22 from KAMKEEL/simplify-hex-text-compat-system
KAMKEEL Nov 8, 2025
e06871b
Most to Init for API
KAMKEEL Nov 8, 2025
38a0229
Merge branch 'master' into hextext-compat
KAMKEEL Nov 8, 2025
fb0f9e9
Fix HexText resolver initialization
KAMKEEL Nov 8, 2025
be695ed
Merge pull request #23 from KAMKEEL/investigate-hex-text-highlighting…
KAMKEEL Nov 8, 2025
b86960a
Remove Jitpack Reference
KAMKEEL Nov 10, 2025
3ad9e32
Merge remote-tracking branch 'upstream/master' into hextext-compat
KAMKEEL Nov 10, 2025
9390523
Merge branch 'master' into hextext-compat
KAMKEEL Nov 18, 2025
202a975
Merge branch 'master' into hextext-compat
KAMKEEL Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ dependencies {
compileOnly(rfg.deobf("curse.maven:xaeros-minimap-263420:5060684"))
compileOnly(rfg.deobf("curse.maven:security-craft-64760:2818228"))

compileOnly(rfg.deobf("curse.maven:hex-text-1379870:7197368")) { transitive = false }
// For Testing Only -- Hex Text
// runtimeOnlyNonPublishable(rfg.deobf("curse.maven:hex-text-1379870:7197368")) { transitive = false }

runtimeOnlyNonPublishable(rfg.deobf("CoreTweaks:CoreTweaks:0.3.3.2"))
// For testing alternative splash screens, can be sourced from https://github.com/MalTeeez/ModernSplash/releases
//runtimeOnly(rfg.deobf(files("dependencies/modernsplash-1.7.10-1.2.2-dev.jar")))
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/gtnewhorizons/angelica/AngelicaMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void preInit(FMLPreInitializationEvent event) {

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
ModStatus.init();
proxy.init(event);
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.gtnewhorizons.angelica.client.font.color;

/**
* Parses formatting markers into a {@link ResolvedText} description that the
* batching font renderer can consume.
*/
public interface AngelicaColorResolver {

ResolvedText resolve(CharSequence text, int start, int end, int baseColor, int baseShadowColor);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.gtnewhorizons.angelica.client.font.color;

import com.gtnewhorizons.angelica.client.font.BatchingFontRenderer;
import com.gtnewhorizons.angelica.compat.hextext.HexTextCompat;
import com.gtnewhorizons.angelica.compat.hextext.HexTextCompat.Bridge;
import com.gtnewhorizons.angelica.compat.hextext.HexTextServices;
import com.gtnewhorizons.angelica.config.FontConfig;

public final class AngelicaColorResolvers {

private AngelicaColorResolvers() {
}

public static AngelicaColorResolver create(BatchingFontRenderer renderer, int[] vanillaPalette) {
AngelicaColorResolver fallback = new DefaultColorResolver(vanillaPalette);
if (!FontConfig.enableHexTextCompat) {
return fallback;
}

return new SwitchingColorResolver(vanillaPalette, fallback);
}

private static final class SwitchingColorResolver implements AngelicaColorResolver {

private final int[] vanillaPalette;
private final AngelicaColorResolver fallback;

private volatile HexTextColorResolver hexResolver;

private SwitchingColorResolver(int[] vanillaPalette, AngelicaColorResolver fallback) {
this.vanillaPalette = vanillaPalette;
this.fallback = fallback;
}

@Override
public ResolvedText resolve(CharSequence text, int start, int end, int baseColor, int baseShadowColor) {
if (!FontConfig.enableHexTextCompat) {
hexResolver = null;
return fallback.resolve(text, start, end, baseColor, baseShadowColor);
}

if (HexTextServices.isSupported()) {
HexTextColorResolver resolver = hexResolver;
if (resolver == null) {
Bridge bridge = HexTextCompat.tryCreateBridge();
if (bridge != null) {
resolver = new HexTextColorResolver(vanillaPalette, bridge);
hexResolver = resolver;
} else {
return fallback.resolve(text, start, end, baseColor, baseShadowColor);
}
}
return resolver.resolve(text, start, end, baseColor, baseShadowColor);
}

hexResolver = null;
return fallback.resolve(text, start, end, baseColor, baseShadowColor);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package com.gtnewhorizons.angelica.client.font.color;

import static com.gtnewhorizons.angelica.client.font.BatchingFontRenderer.FORMATTING_CHAR;

final class DefaultColorResolver implements AngelicaColorResolver {

private final int[] vanillaPalette;

DefaultColorResolver(int[] vanillaPalette) {
this.vanillaPalette = vanillaPalette;
}

@Override
public ResolvedText resolve(CharSequence text, int start, int end, int baseColor, int baseShadowColor) {
ResolvedText.Builder builder = ResolvedText.builder(end - start);
FormattingState state = new FormattingState(baseColor, baseShadowColor);

for (int index = Math.max(0, start); index < Math.min(text.length(), end); index++) {
char chr = text.charAt(index);
if (chr == FORMATTING_CHAR && index + 1 < end) {
char fmtCode = Character.toLowerCase(text.charAt(index + 1));
index++;
applyVanillaFormatting(state, fmtCode);
continue;
}

if (state.random) {
// keep vanilla behaviour; actual replacement happens during rendering
}

builder.append(chr, state.color, state.shadowColor, state.bold, state.italic, state.underline,
state.strikethrough, state.random);
}

return builder.build();
}

private void applyVanillaFormatting(FormattingState state, char fmtCode) {
if (charInRange(fmtCode, '0', '9') || charInRange(fmtCode, 'a', 'f')) {
state.random = false;
state.bold = false;
state.strikethrough = false;
state.underline = false;
state.italic = false;
int colorIdx = charInRange(fmtCode, '0', '9') ? (fmtCode - '0') : (fmtCode - 'a' + 10);
int rgb = vanillaPalette[colorIdx];
state.color = (state.color & 0xFF000000) | (rgb & 0x00FFFFFF);
int shadowRgb = vanillaPalette[colorIdx + 16];
state.shadowColor = (state.shadowColor & 0xFF000000) | (shadowRgb & 0x00FFFFFF);
} else if (fmtCode == 'k') {
state.random = true;
} else if (fmtCode == 'l') {
state.bold = true;
} else if (fmtCode == 'm') {
state.strikethrough = true;
} else if (fmtCode == 'n') {
state.underline = true;
} else if (fmtCode == 'o') {
state.italic = true;
} else if (fmtCode == 'r') {
state.reset();
}
}

private static boolean charInRange(char what, char fromInclusive, char toInclusive) {
return what >= fromInclusive && what <= toInclusive;
}

private static final class FormattingState {
final int baseColor;
final int baseShadowColor;
int color;
int shadowColor;
boolean italic;
boolean random;
boolean bold;
boolean strikethrough;
boolean underline;

FormattingState(int baseColor, int baseShadowColor) {
this.baseColor = baseColor;
this.baseShadowColor = baseShadowColor;
this.color = baseColor;
this.shadowColor = baseShadowColor;
}

void reset() {
color = baseColor;
shadowColor = baseShadowColor;
italic = false;
random = false;
bold = false;
strikethrough = false;
underline = false;
}
}
}
Loading