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) {
switch (data) {
case 0: return 8;
case 8: return 7;
case 7: return 15;
case 15: return 12;
case 12: return 14;
case 14: return 1;
case 1: return 4;
case 4: return 5;
case 5: return 13;
case 13: return 9;
case 9: return 3;
case 3: return 11;
case 11: return 10;
case 10: return 2;
case 2: return 6;
case 6: return 0;
case ClothColor.ID.WHITE: return ClothColor.ID.LIGHT_GRAY;
case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.GRAY;
case ClothColor.ID.GRAY: return ClothColor.ID.BLACK;
case ClothColor.ID.BLACK: return ClothColor.ID.BROWN;
case ClothColor.ID.BROWN: return ClothColor.ID.RED;
case ClothColor.ID.RED: return ClothColor.ID.ORANGE;
case ClothColor.ID.ORANGE: return ClothColor.ID.YELLOW;
case ClothColor.ID.YELLOW: return ClothColor.ID.LIGHT_GREEN;
case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.DARK_GREEN;
case ClothColor.ID.DARK_GREEN: return ClothColor.ID.CYAN;
case ClothColor.ID.CYAN: return ClothColor.ID.LIGHT_BLUE;
case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.BLUE;
case ClothColor.ID.BLUE: return ClothColor.ID.PURPLE;
case ClothColor.ID.PURPLE: return ClothColor.ID.MAGENTA;
case ClothColor.ID.MAGENTA: return ClothColor.ID.PINK;
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) {
switch (data) {
case 8: return 0;
case 7: return 8;
case 15: return 7;
case 12: return 15;
case 14: return 12;
case 1: return 14;
case 4: return 1;
case 5: return 4;
case 13: return 5;
case 9: return 13;
case 3: return 9;
case 11: return 3;
case 10: return 11;
case 2: return 10;
case 6: return 2;
case 0: return 6;
case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.WHITE;
case ClothColor.ID.GRAY: return ClothColor.ID.LIGHT_GRAY;
case ClothColor.ID.BLACK: return ClothColor.ID.GRAY;
case ClothColor.ID.BROWN: return ClothColor.ID.BLACK;
case ClothColor.ID.RED: return ClothColor.ID.BROWN;
case ClothColor.ID.ORANGE: return ClothColor.ID.RED;
case ClothColor.ID.YELLOW: return ClothColor.ID.ORANGE;
case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.YELLOW;
case ClothColor.ID.DARK_GREEN: return ClothColor.ID.LIGHT_GREEN;
case ClothColor.ID.CYAN: return ClothColor.ID.DARK_GREEN;
case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.CYAN;
case ClothColor.ID.BLUE: return ClothColor.ID.LIGHT_BLUE;
case ClothColor.ID.PURPLE: return ClothColor.ID.BLUE;
case ClothColor.ID.MAGENTA: return ClothColor.ID.PURPLE;
case ClothColor.ID.PINK: return ClothColor.ID.MAGENTA;
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
*/
public enum ClothColor {
WHITE(0, "White", "white"),
ORANGE(1, "Orange", "orange"),
MAGENTA(2, "Magenta", "magenta"),
LIGHT_BLUE(3, "Light blue", "lightblue"),
YELLOW(4, "Yellow", "yellow"),
LIGHT_GREEN(5, "Light green", "lightgreen"),
PINK(6, "Pink", new String[] {"pink", "lightred"}),
GRAY(7, "Gray", new String[] {"grey", "gray"}),
LIGHT_GRAY(8, "Light gray", new String[] {"lightgrey", "lightgray"}),
CYAN(9, "Cyan", new String[] {"cyan", "turquoise"}),
PURPLE(10, "Purple", new String[] {"purple", "violet"}),
BLUE(11, "Blue", "blue"),
BROWN(12, "Brown", new String[] {"brown", "cocoa", "coffee"}),
DARK_GREEN(13, "Dark green", new String[] {"green", "darkgreen", "cactusgreen", "cactigreen"}),
RED(14, "Red", "red"),
BLACK(15, "Black", "black");
WHITE(ID.WHITE, "White", "white"),
ORANGE(ID.ORANGE, "Orange", "orange"),
MAGENTA(ID.MAGENTA, "Magenta", "magenta"),
LIGHT_BLUE(ID.LIGHT_BLUE, "Light blue", "lightblue"),
YELLOW(ID.YELLOW, "Yellow", "yellow"),
LIGHT_GREEN(ID.LIGHT_GREEN, "Light green", "lightgreen"),
PINK(ID.PINK, "Pink", new String[] {"pink", "lightred"}),
GRAY(ID.GRAY, "Gray", new String[] {"grey", "gray"}),
LIGHT_GRAY(ID.LIGHT_GRAY, "Light gray", new String[] {"lightgrey", "lightgray"}),
CYAN(ID.CYAN, "Cyan", new String[] {"cyan", "turquoise"}),
PURPLE(ID.PURPLE, "Purple", new String[] {"purple", "violet"}),
BLUE(ID.BLUE, "Blue", "blue"),
BROWN(ID.BROWN, "Brown", new String[] {"brown", "cocoa", "coffee"}),
DARK_GREEN(ID.DARK_GREEN, "Dark green", new String[] {"green", "darkgreen", "cactusgreen", "cactigreen"}),
RED(ID.RED, "Red", "red"),
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.