13
0
geforkt von Mirrors/Paper

Added additional BlockFace enum members and fixed Sign class.

By: sunkid <sunkid@iminurnetz.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2011-07-13 14:14:04 -07:00
Ursprung 77399b9d2e
Commit 656403dc86
2 geänderte Dateien mit 89 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -14,6 +14,14 @@ public enum BlockFace {
NORTH_WEST(NORTH, WEST), NORTH_WEST(NORTH, WEST),
SOUTH_EAST(SOUTH, EAST), SOUTH_EAST(SOUTH, EAST),
SOUTH_WEST(SOUTH, WEST), SOUTH_WEST(SOUTH, WEST),
WEST_NORTH_WEST(WEST, NORTH_WEST),
NORTH_NORTH_WEST(NORTH, NORTH_WEST),
NORTH_NORTH_EAST(NORTH, NORTH_EAST),
EAST_NORTH_EAST(EAST, NORTH_EAST),
EAST_SOUTH_EAST(EAST, SOUTH_EAST),
SOUTH_SOUTH_EAST(SOUTH, SOUTH_EAST),
SOUTH_SOUTH_WEST(SOUTH, SOUTH_WEST),
WEST_SOUTH_WEST(WEST, SOUTH_WEST),
SELF(0, 0, 0); SELF(0, 0, 0);
private final int modX; private final int modX;
@ -88,6 +96,30 @@ public enum BlockFace {
case SOUTH_WEST: case SOUTH_WEST:
return BlockFace.NORTH_EAST; return BlockFace.NORTH_EAST;
case WEST_NORTH_WEST:
return BlockFace.EAST_SOUTH_EAST;
case NORTH_NORTH_WEST:
return BlockFace.SOUTH_SOUTH_EAST;
case NORTH_NORTH_EAST:
return BlockFace.SOUTH_SOUTH_WEST;
case EAST_NORTH_EAST:
return BlockFace.WEST_SOUTH_WEST;
case EAST_SOUTH_EAST:
return BlockFace.WEST_NORTH_WEST;
case SOUTH_SOUTH_EAST:
return BlockFace.NORTH_NORTH_WEST;
case SOUTH_SOUTH_WEST:
return BlockFace.NORTH_NORTH_EAST;
case WEST_SOUTH_WEST:
return BlockFace.EAST_NORTH_EAST;
case SELF: case SELF:
return BlockFace.SELF; return BlockFace.SELF;
} }

Datei anzeigen

@ -77,36 +77,52 @@ public class Sign extends MaterialData implements Attachable {
if (!isWallSign()) { if (!isWallSign()) {
switch (data) { switch (data) {
case 0x0: case 0x0:
case 0x1:
return BlockFace.WEST; return BlockFace.WEST;
case 0x1:
return BlockFace.WEST_NORTH_WEST;
case 0x2: case 0x2:
case 0x3:
return BlockFace.NORTH_WEST; return BlockFace.NORTH_WEST;
case 0x3:
return BlockFace.NORTH_NORTH_WEST;
case 0x4: case 0x4:
case 0x5:
return BlockFace.NORTH; return BlockFace.NORTH;
case 0x5:
return BlockFace.NORTH_NORTH_EAST;
case 0x6: case 0x6:
case 0x7:
return BlockFace.NORTH_EAST; return BlockFace.NORTH_EAST;
case 0x7:
return BlockFace.EAST_NORTH_EAST;
case 0x8: case 0x8:
case 0x9:
return BlockFace.EAST; return BlockFace.EAST;
case 0x9:
return BlockFace.EAST_SOUTH_EAST;
case 0xA: case 0xA:
case 0xB:
return BlockFace.SOUTH_EAST; return BlockFace.SOUTH_EAST;
case 0xB:
return BlockFace.SOUTH_SOUTH_EAST;
case 0xC: case 0xC:
case 0xD:
return BlockFace.SOUTH; return BlockFace.SOUTH;
case 0xD:
return BlockFace.SOUTH_SOUTH_WEST;
case 0xE: case 0xE:
case 0xF:
return BlockFace.SOUTH_WEST; return BlockFace.SOUTH_WEST;
case 0xF:
return BlockFace.WEST_SOUTH_WEST;
} }
return null; return null;
@ -139,36 +155,68 @@ public class Sign extends MaterialData implements Attachable {
} else { } else {
switch (face) { switch (face) {
case WEST: case WEST:
data = 0x0;
break;
case WEST_NORTH_WEST:
data = 0x1; data = 0x1;
break; break;
case NORTH_WEST: case NORTH_WEST:
data = 0x2;
break;
case NORTH_NORTH_WEST:
data = 0x3; data = 0x3;
break; break;
case NORTH: case NORTH:
data = 0x4;
break;
case NORTH_NORTH_EAST:
data = 0x5; data = 0x5;
break; break;
case NORTH_EAST: case NORTH_EAST:
data = 0x6;
break;
case EAST_NORTH_EAST:
data = 0x7; data = 0x7;
break; break;
case EAST: case EAST:
data = 0x8;
break;
case EAST_SOUTH_EAST:
data = 0x9; data = 0x9;
break; break;
case SOUTH_EAST: case SOUTH_EAST:
data = 0xA;
break;
case SOUTH_SOUTH_EAST:
data = 0xB; data = 0xB;
break; break;
case SOUTH: case SOUTH:
data = 0xC;
break;
case SOUTH_SOUTH_WEST:
data = 0xD; data = 0xD;
break; break;
case WEST_SOUTH_WEST:
data = 0xF;
break;
case SOUTH_WEST: case SOUTH_WEST:
default: default:
data = 0xF; data = 0xE;
} }
} }