Remove dependency loop and change logger to mc one (#392)

Co-authored-by: Nikolay S. <[email protected]>
This commit is contained in:
RanzuandNikolay S. authored and GitHub committed 2026-06-12 02:16:37 -04:00
1 parent 0721f00542
commit a6e1af5acb
1 file changed
+6 -4
@@ -8,7 +8,8 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.StatCollector;
import com.gtnewhorizon.gtnhlib.GTNHLib;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* A color constant supporting both ARGB and RGB formats, with resource pack override and per-instance caching.
@@ -48,6 +49,7 @@ import com.gtnewhorizon.gtnhlib.GTNHLib;
*/
public class ColorResource {
private static final Logger LOG = LogManager.getLogger(ColorResource.class);
private static final Set<ColorResource> INSTANCES = Collections.newSetFromMap(new WeakHashMap<>());
private final String langKey;
@@ -109,15 +111,15 @@ public class ColorResource {
String value = stripPrefix(StatCollector.translateToLocal(langKey));
try {
if (!argb && value.length() > 6) {
GTNHLib.LOG.warn(
"[ColorResource] Lang key '{}' received ARGB hex '{}' but this color is RGB-only — alpha will be ignored.",
LOG.warn(
"Lang key '{}' received ARGB hex '{}' but this color is RGB-only — alpha will be ignored.",
langKey,
value);
}
long parsed = Long.parseLong(value, 16);
return argb ? (int) parsed : (int) (0xFF000000L | parsed);
} catch (NumberFormatException e) {
GTNHLib.LOG.warn("[ColorResource] Invalid hex '{}' for lang key '{}', using default.", value, langKey);
LOG.warn("Invalid hex '{}' for lang key '{}', using default.", value, langKey);
return defaultColor;
}
}