Skip to content

Instantly share code, notes, and snippets.

@izzyaxel
Created September 13, 2016 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izzyaxel/4df235fedc33f0830dfb9877a8097e6f to your computer and use it in GitHub Desktop.
Save izzyaxel/4df235fedc33f0830dfb9877a8097e6f to your computer and use it in GitHub Desktop.
public enum ChromatimancyColors implements IStringSerializable
{
WHITE(0, 0, "white", new float[]{1f, 1f, 1f}, new float[]{255, 255, 255}, 0xffffffff),
BLUE(1, 1, "blue", new float[]{0f, 0f, 1f}, new float[]{0, 0, 255}, 0x0000ffff),
BLACK(2, 2, "black", new float[]{0f, 0f, 0f}, new float[]{0, 0, 0}, 0x000000ff),
GREEN(3, 3, "green", new float[]{0f, 1f, 0f}, new float[]{0, 255, 0}, 0x00ff00ff),
RED(4, 4, "red", new float[]{1f, 0f, 0f}, new float[]{255, 0, 0}, 0xff0000ff);
private final int meta, damage;
private final String unlocalizedName;
private final float[] RGBNormalized;
private final float[] RGB255;
private final int RGBHex;
ChromatimancyColors(int meta, int damage, String unlocalizedName, float[] RGBNormalized, float[] RGB255, int RGBHex)
{
this.meta = meta;
this.damage = damage;
this.unlocalizedName = unlocalizedName;
this.RGBNormalized = RGBNormalized;
this.RGB255 = RGB255;
this.RGBHex = RGBHex;
}
public int getMetadata()
{
return this.meta;
}
public int getDamage()
{
return this.damage;
}
public float[] getRGB255()
{
return this.RGB255;
}
public float getR255()
{
return this.RGB255[0];
}
public float getG255()
{
return this.RGB255[1];
}
public float getB255()
{
return this.RGB255[2];
}
public float[] getRGBNormalized()
{
return this.RGBNormalized;
}
public float getRNormalized()
{
return this.RGBNormalized[0];
}
public float getGNormalized()
{
return this.RGBNormalized[1];
}
public float getBNormalized()
{
return this.RGBNormalized[2];
}
public int getRGBHex()
{
return this.RGBHex;
}
public String getUnlocalizedName()
{
return this.unlocalizedName;
}
public static ChromatimancyColors getByMetadata(int metadata)
{
return values()[metadata];
}
@Override
public String getName()
{
switch(this)
{
case WHITE: return "white";
case BLUE: return "blue";
case BLACK: return "black";
case GREEN: return "green";
case RED: return "red";
default: return "";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment