| 1 | package net.minecraft.item;
|
| 2 |
|
| 3 | import net.minecraft.block.material.MapColor;
|
| 4 | import net.minecraft.util.EnumChatFormatting;
|
| 5 | import net.minecraft.util.IStringSerializable;
|
| 6 |
|
| 7 | public enum EnumDyeColor implements IStringSerializable
|
| 8 | {
|
| 9 | WHITE(0, 15, "white", "white", MapColor.snowColor, EnumChatFormatting.WHITE),
|
| 10 | ORANGE(1, 14, "orange", "orange", MapColor.adobeColor, EnumChatFormatting.GOLD),
|
| 11 | MAGENTA(2, 13, "magenta", "magenta", MapColor.magentaColor, EnumChatFormatting.AQUA),
|
| 12 | LIGHT_BLUE(3, 12, "light_blue", "lightBlue", MapColor.lightBlueColor, EnumChatFormatting.BLUE),
|
| 13 | YELLOW(4, 11, "yellow", "yellow", MapColor.yellowColor, EnumChatFormatting.YELLOW),
|
| 14 | LIME(5, 10, "lime", "lime", MapColor.limeColor, EnumChatFormatting.GREEN),
|
| 15 | PINK(6, 9, "pink", "pink", MapColor.pinkColor, EnumChatFormatting.LIGHT_PURPLE),
|
| 16 | GRAY(7, 8, "gray", "gray", MapColor.grayColor, EnumChatFormatting.DARK_GRAY),
|
| 17 | SILVER(8, 7, "silver", "silver", MapColor.silverColor, EnumChatFormatting.GRAY),
|
| 18 | CYAN(9, 6, "cyan", "cyan", MapColor.cyanColor, EnumChatFormatting.DARK_AQUA),
|
| 19 | PURPLE(10, 5, "purple", "purple", MapColor.purpleColor, EnumChatFormatting.DARK_PURPLE),
|
| 20 | BLUE(11, 4, "blue", "blue", MapColor.blueColor, EnumChatFormatting.DARK_BLUE),
|
| 21 | BROWN(12, 3, "brown", "brown", MapColor.brownColor, EnumChatFormatting.GOLD),
|
| 22 | GREEN(13, 2, "green", "green", MapColor.greenColor, EnumChatFormatting.DARK_GREEN),
|
| 23 | RED(14, 1, "red", "red", MapColor.redColor, EnumChatFormatting.DARK_RED),
|
| 24 | BLACK(15, 0, "black", "black", MapColor.blackColor, EnumChatFormatting.BLACK);
|
| 25 |
|
| 26 | private static final EnumDyeColor[] META_LOOKUP = new EnumDyeColor[values().length];
|
| 27 | private static final EnumDyeColor[] DYE_DMG_LOOKUP = new EnumDyeColor[values().length];
|
| 28 | private final int meta;
|
| 29 | private final int dyeDamage;
|
| 30 | private final String name;
|
| 31 | private final String unlocalizedName;
|
| 32 | private final MapColor mapColor;
|
| 33 | private final EnumChatFormatting chatColor;
|
| 34 |
|
| 35 | private EnumDyeColor(int meta, int dyeDamage, String name, String unlocalizedName, MapColor mapColorIn, EnumChatFormatting chatColor)
|
| 36 | {
|
| 37 | this.meta = meta;
|
| 38 | this.dyeDamage = dyeDamage;
|
| 39 | this.name = name;
|
| 40 | this.unlocalizedName = unlocalizedName;
|
| 41 | this.mapColor = mapColorIn;
|
| 42 | this.chatColor = chatColor;
|
| 43 | }
|
| 44 |
|
| 45 | public int getMetadata()
|
| 46 | {
|
| 47 | return this.meta;
|
| 48 | }
|
| 49 |
|
| 50 | public int getDyeDamage()
|
| 51 | {
|
| 52 | return this.dyeDamage;
|
| 53 | }
|
| 54 |
|
| 55 | public String getUnlocalizedName()
|
| 56 | {
|
| 57 | return this.unlocalizedName;
|
| 58 | }
|
| 59 |
|
| 60 | public MapColor getMapColor()
|
| 61 | {
|
| 62 | return this.mapColor;
|
| 63 | }
|
| 64 |
|
| 65 | public static EnumDyeColor byDyeDamage(int damage)
|
| 66 | {
|
| 67 | if (damage < 0 || damage >= DYE_DMG_LOOKUP.length)
|
| 68 | {
|
| 69 | damage = 0;
|
| 70 | }
|
| 71 |
|
| 72 | return DYE_DMG_LOOKUP[damage];
|
| 73 | }
|
| 74 |
|
| 75 | public static EnumDyeColor byMetadata(int meta)
|
| 76 | {
|
| 77 | if (meta < 0 || meta >= META_LOOKUP.length)
|
| 78 | {
|
| 79 | meta = 0;
|
| 80 | }
|
| 81 |
|
| 82 | return META_LOOKUP[meta];
|
| 83 | }
|
| 84 |
|
| 85 | public String toString()
|
| 86 | {
|
| 87 | return this.unlocalizedName;
|
| 88 | }
|
| 89 |
|
| 90 | public String getName()
|
| 91 | {
|
| 92 | return this.name;
|
| 93 | }
|
| 94 |
|
| 95 | static {
|
| 96 | for (EnumDyeColor enumdyecolor : values())
|
| 97 | {
|
| 98 | META_LOOKUP[enumdyecolor.getMetadata()] = enumdyecolor;
|
| 99 | DYE_DMG_LOOKUP[enumdyecolor.getDyeDamage()] = enumdyecolor;
|
| 100 | }
|
| 101 | }
|
| 102 | }
|
| 103 |
|