MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / readMapColors

Method readMapColors

src/main/java/net/optifine/CustomColors.java:1589–1627  ·  view source on GitHub ↗
(Properties props, String fileName, String prefix, String logName)

Source from the content-addressed store, hash-verified

1587 }
1588
1589 private static int[] readMapColors(Properties props, String fileName, String prefix, String logName)
1590 {
1591 int[] aint = new int[MapColor.mapColorArray.length];
1592 Arrays.fill((int[])aint, (int) - 1);
1593 int i = 0;
1594
1595 for (Object o : props.keySet())
1596 {
1597 String s = (String)o;
1598 String s1 = props.getProperty(s);
1599
1600 if (s.startsWith(prefix))
1601 {
1602 String s2 = StrUtils.removePrefix(s, prefix);
1603 int j = getMapColorIndex(s2);
1604 int k = parseColor(s1);
1605
1606 if (j >= 0 && j < aint.length && k >= 0)
1607 {
1608 aint[j] = k;
1609 ++i;
1610 }
1611 else
1612 {
1613 warn("Invalid color: " + s + " = " + s1);
1614 }
1615 }
1616 }
1617
1618 if (i <= 0)
1619 {
1620 return null;
1621 }
1622 else
1623 {
1624 dbg(logName + " colors: " + i);
1625 return aint;
1626 }
1627 }
1628
1629 private static int[] readPotionColors(Properties props, String fileName, String prefix, String logName)
1630 {

Callers 1

readColorPropertiesMethod · 0.95

Calls 8

removePrefixMethod · 0.95
getMapColorIndexMethod · 0.95
parseColorMethod · 0.95
warnMethod · 0.95
dbgMethod · 0.95
startsWithMethod · 0.80
keySetMethod · 0.45
getPropertyMethod · 0.45

Tested by

no test coverage detected