1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-06 08:22:59 +00:00

Fix to getPalletteColour

Done as @dan200 specified in #287. Closes #287.
This commit is contained in:
Wojbie
2017-05-28 14:08:15 +02:00
parent 235131c3fb
commit 47f470910e
4 changed files with 24 additions and 24 deletions

View File

@@ -33,7 +33,7 @@ public class FixedWidthFontRenderer
m_textureManager = textureManager;
}
private static void greyscaleify( float[] rgb )
private static void greyscaleify( double[] rgb )
{
Arrays.fill( rgb, ( rgb[0] + rgb[1] + rgb[2] ) / 3.0f );
}
@@ -43,14 +43,14 @@ public class FixedWidthFontRenderer
int column = index % 16;
int row = index / 16;
float[] colour = p.getColour( 15 - color );
double[] colour = p.getColour( 15 - color );
if(greyscale)
{
greyscaleify( colour );
}
float r = colour[0];
float g = colour[1];
float b = colour[2];
float r = (float)colour[0];
float g = (float)colour[1];
float b = (float)colour[2];
renderer.pos( x, y, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT ) / 256.0 ).color( r, g, b, 1.0f ).endVertex();
renderer.pos( x, y + FONT_HEIGHT, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) ((row + 1) * FONT_HEIGHT) / 256.0 ).color( r, g, b, 1.0f ).endVertex();
@@ -62,14 +62,14 @@ public class FixedWidthFontRenderer
private void drawQuad( VertexBuffer renderer, double x, double y, int color, double width, Palette p, boolean greyscale )
{
float[] colour = p.getColour( 15 - color );
double[] colour = p.getColour( 15 - color );
if(greyscale)
{
greyscaleify( colour );
}
float r = colour[0];
float g = colour[1];
float b = colour[2];
float r = (float)colour[0];
float g = (float)colour[1];
float b = (float)colour[2];
renderer.pos( x, y, 0.0 ).color( r, g, b, 1.0f ).endVertex();
renderer.pos( x, y + FONT_HEIGHT, 0.0 ).color( r, g, b, 1.0f ).endVertex();