Added some constants com.sk89q.worldedit.blocks.ClothColor.ID.X = ClothColor.X.getID()

This commit is contained in:
TomyLobo 2011-09-28 10:57:30 +02:00
parent 21c6ab894c
commit cbc331da7d
2 changed files with 69 additions and 50 deletions

View File

@ -695,25 +695,25 @@ public final class BlockData {
*/ */
public static int nextClothColor(int data) { public static int nextClothColor(int data) {
switch (data) { switch (data) {
case 0: return 8; case ClothColor.ID.WHITE: return ClothColor.ID.LIGHT_GRAY;
case 8: return 7; case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.GRAY;
case 7: return 15; case ClothColor.ID.GRAY: return ClothColor.ID.BLACK;
case 15: return 12; case ClothColor.ID.BLACK: return ClothColor.ID.BROWN;
case 12: return 14; case ClothColor.ID.BROWN: return ClothColor.ID.RED;
case 14: return 1; case ClothColor.ID.RED: return ClothColor.ID.ORANGE;
case 1: return 4; case ClothColor.ID.ORANGE: return ClothColor.ID.YELLOW;
case 4: return 5; case ClothColor.ID.YELLOW: return ClothColor.ID.LIGHT_GREEN;
case 5: return 13; case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.DARK_GREEN;
case 13: return 9; case ClothColor.ID.DARK_GREEN: return ClothColor.ID.CYAN;
case 9: return 3; case ClothColor.ID.CYAN: return ClothColor.ID.LIGHT_BLUE;
case 3: return 11; case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.BLUE;
case 11: return 10; case ClothColor.ID.BLUE: return ClothColor.ID.PURPLE;
case 10: return 2; case ClothColor.ID.PURPLE: return ClothColor.ID.MAGENTA;
case 2: return 6; case ClothColor.ID.MAGENTA: return ClothColor.ID.PINK;
case 6: return 0; case ClothColor.ID.PINK: return ClothColor.ID.WHITE;
} }
return 0; return ClothColor.ID.WHITE;
} }
/** /**
@ -724,24 +724,24 @@ public final class BlockData {
*/ */
public static int prevClothColor(int data) { public static int prevClothColor(int data) {
switch (data) { switch (data) {
case 8: return 0; case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.WHITE;
case 7: return 8; case ClothColor.ID.GRAY: return ClothColor.ID.LIGHT_GRAY;
case 15: return 7; case ClothColor.ID.BLACK: return ClothColor.ID.GRAY;
case 12: return 15; case ClothColor.ID.BROWN: return ClothColor.ID.BLACK;
case 14: return 12; case ClothColor.ID.RED: return ClothColor.ID.BROWN;
case 1: return 14; case ClothColor.ID.ORANGE: return ClothColor.ID.RED;
case 4: return 1; case ClothColor.ID.YELLOW: return ClothColor.ID.ORANGE;
case 5: return 4; case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.YELLOW;
case 13: return 5; case ClothColor.ID.DARK_GREEN: return ClothColor.ID.LIGHT_GREEN;
case 9: return 13; case ClothColor.ID.CYAN: return ClothColor.ID.DARK_GREEN;
case 3: return 9; case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.CYAN;
case 11: return 3; case ClothColor.ID.BLUE: return ClothColor.ID.LIGHT_BLUE;
case 10: return 11; case ClothColor.ID.PURPLE: return ClothColor.ID.BLUE;
case 2: return 10; case ClothColor.ID.MAGENTA: return ClothColor.ID.PURPLE;
case 6: return 2; case ClothColor.ID.PINK: return ClothColor.ID.MAGENTA;
case 0: return 6; case ClothColor.ID.WHITE: return ClothColor.ID.PINK;
} }
return 0; return ClothColor.ID.WHITE;
} }
} }

View File

@ -29,22 +29,41 @@ import java.util.EnumSet;
* @author sk89q * @author sk89q
*/ */
public enum ClothColor { public enum ClothColor {
WHITE(0, "White", "white"), WHITE(ID.WHITE, "White", "white"),
ORANGE(1, "Orange", "orange"), ORANGE(ID.ORANGE, "Orange", "orange"),
MAGENTA(2, "Magenta", "magenta"), MAGENTA(ID.MAGENTA, "Magenta", "magenta"),
LIGHT_BLUE(3, "Light blue", "lightblue"), LIGHT_BLUE(ID.LIGHT_BLUE, "Light blue", "lightblue"),
YELLOW(4, "Yellow", "yellow"), YELLOW(ID.YELLOW, "Yellow", "yellow"),
LIGHT_GREEN(5, "Light green", "lightgreen"), LIGHT_GREEN(ID.LIGHT_GREEN, "Light green", "lightgreen"),
PINK(6, "Pink", new String[] {"pink", "lightred"}), PINK(ID.PINK, "Pink", new String[] {"pink", "lightred"}),
GRAY(7, "Gray", new String[] {"grey", "gray"}), GRAY(ID.GRAY, "Gray", new String[] {"grey", "gray"}),
LIGHT_GRAY(8, "Light gray", new String[] {"lightgrey", "lightgray"}), LIGHT_GRAY(ID.LIGHT_GRAY, "Light gray", new String[] {"lightgrey", "lightgray"}),
CYAN(9, "Cyan", new String[] {"cyan", "turquoise"}), CYAN(ID.CYAN, "Cyan", new String[] {"cyan", "turquoise"}),
PURPLE(10, "Purple", new String[] {"purple", "violet"}), PURPLE(ID.PURPLE, "Purple", new String[] {"purple", "violet"}),
BLUE(11, "Blue", "blue"), BLUE(ID.BLUE, "Blue", "blue"),
BROWN(12, "Brown", new String[] {"brown", "cocoa", "coffee"}), BROWN(ID.BROWN, "Brown", new String[] {"brown", "cocoa", "coffee"}),
DARK_GREEN(13, "Dark green", new String[] {"green", "darkgreen", "cactusgreen", "cactigreen"}), DARK_GREEN(ID.DARK_GREEN, "Dark green", new String[] {"green", "darkgreen", "cactusgreen", "cactigreen"}),
RED(14, "Red", "red"), RED(ID.RED, "Red", "red"),
BLACK(15, "Black", "black"); BLACK(ID.BLACK, "Black", "black");
public static final class ID {
public static final int WHITE = 0;
public static final int ORANGE = 1;
public static final int MAGENTA = 2;
public static final int LIGHT_BLUE = 3;
public static final int YELLOW = 4;
public static final int LIGHT_GREEN = 5;
public static final int PINK = 6;
public static final int GRAY = 7;
public static final int LIGHT_GRAY = 8;
public static final int CYAN = 9;
public static final int PURPLE = 10;
public static final int BLUE = 11;
public static final int BROWN = 12;
public static final int DARK_GREEN = 13;
public static final int RED = 14;
public static final int BLACK = 15;
}
/** /**
* Stores a map of the IDs for fast access. * Stores a map of the IDs for fast access.