Advertisement
PaleoCrafter

Untitled

May 6th, 2015
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. public static int calcColor(EnumChatFormatting formatting, boolean shadow)
  2.     int index = formatting.getColorIndex();
  3.     int j = (index >> 3 & 1) * 85;
  4.     int r = (index >> 2 & 1) * 170 + j;
  5.     int g = (index >> 1 & 1) * 170 + j;
  6.     int b = (index >> 0 & 1) * 170 + j;
  7.  
  8.     if (formatting == EnumChatFormatting.GOLD)
  9.         r += 85;
  10.  
  11.     if (gameSettings.anaglyph)
  12.     {
  13.         int rAnaglyph = (r * 30 + g * 59 + b * 11) / 100;
  14.         int gAnaglyph = (r * 30 + g * 70) / 100;
  15.         int bAnaglyph = (r * 30 + b * 70) / 100;
  16.  
  17.         r = rAnaglyph;
  18.         g = gAnaglyph;
  19.         b = bAnaglyph;
  20.     }
  21.  
  22.     if (shadow)
  23.     {
  24.         r /= 4;
  25.         g /= 4;
  26.         b /= 4;
  27.     }
  28.  
  29.     return (r & 0xFF) << 16 | (g & 0xFF) << 8 | b & 0xFF;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement