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

Method readDyeColors

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

Source from the content-addressed store, hash-verified

1448 }
1449
1450 private static float[][] readDyeColors(Properties props, String fileName, String prefix, String logName)
1451 {
1452 EnumDyeColor[] aenumdyecolor = EnumDyeColor.values();
1453 Map<String, EnumDyeColor> map = new HashMap();
1454
1455 for (int i = 0; i < aenumdyecolor.length; ++i)
1456 {
1457 EnumDyeColor enumdyecolor = aenumdyecolor[i];
1458 map.put(enumdyecolor.getName(), enumdyecolor);
1459 }
1460
1461 float[][] afloat1 = new float[aenumdyecolor.length][];
1462 int k = 0;
1463
1464 for (Object e : props.keySet())
1465 {
1466 String s = (String) e;
1467 String s1 = props.getProperty(s);
1468
1469 if (s.startsWith(prefix))
1470 {
1471 String s2 = StrUtils.removePrefix(s, prefix);
1472
1473 if (s2.equals("lightBlue"))
1474 {
1475 s2 = "light_blue";
1476 }
1477
1478 EnumDyeColor enumdyecolor1 = (EnumDyeColor)map.get(s2);
1479 int j = parseColor(s1);
1480
1481 if (enumdyecolor1 != null && j >= 0)
1482 {
1483 float[] afloat = new float[] {(float)(j >> 16 & 255) / 255.0F, (float)(j >> 8 & 255) / 255.0F, (float)(j & 255) / 255.0F};
1484 afloat1[enumdyecolor1.ordinal()] = afloat;
1485 ++k;
1486 }
1487 else
1488 {
1489 warn("Invalid color: " + s + " = " + s1);
1490 }
1491 }
1492 }
1493
1494 if (k <= 0)
1495 {
1496 return (float[][])null;
1497 }
1498 else
1499 {
1500 dbg(logName + " colors: " + k);
1501 return afloat1;
1502 }
1503 }
1504
1505 private static float[] getDyeColors(EnumDyeColor dye, float[][] dyeColors, float[] colors)
1506 {

Callers 1

readColorPropertiesMethod · 0.95

Calls 12

getNameMethod · 0.95
removePrefixMethod · 0.95
parseColorMethod · 0.95
warnMethod · 0.95
dbgMethod · 0.95
valuesMethod · 0.80
startsWithMethod · 0.80
putMethod · 0.65
getMethod · 0.65
keySetMethod · 0.45
getPropertyMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected