Completed levers, added redstone interaction

This commit is contained in:
Chicken Bones committed 2013-06-03 13:30:36 +10:00
1 parent a695de4b9d
commit 283a723e38
8 files changed
+289 -21

No files matched your search

+68 -20
View File
@@ -1,5 +1,7 @@
package codechicken.multipart;
import java.util.Arrays;
public enum PartMap
{
BOTTOM(0),
@@ -9,26 +11,26 @@ public enum PartMap
WEST(4),
EAST(5),
CENTER(6),
CORNER_NNN(7),
CORNER_NPN(8),
CORNER_NNP(9),
CORNER_NPP(10),
CORNER_PNN(11),
CORNER_PPN(12),
CORNER_PNP(13),
CORNER_PPP(14),
EDGE_NYN(15),
EDGE_NYP(16),
EDGE_PYN(17),
EDGE_PYP(18),
EDGE_NNZ(19),
EDGE_PNZ(20),
EDGE_NPZ(21),
EDGE_PPZ(22),
EDGE_XNN(23),
EDGE_XPN(24),
EDGE_XNP(25),
EDGE_XPP(26);
CORNER_NNN(7),//0
CORNER_NPN(8),//1
CORNER_NNP(9),//2
CORNER_NPP(10),//3
CORNER_PNN(11),//4
CORNER_PPN(12),//5
CORNER_PNP(13),//6
CORNER_PPP(14),//7
EDGE_NYN(15),//0
EDGE_NYP(16),//1
EDGE_PYN(17),//2
EDGE_PYP(18),//3
EDGE_NNZ(19),//4
EDGE_PNZ(20),//5
EDGE_NPZ(21),//6
EDGE_PPZ(22),//7
EDGE_XNN(23),//8
EDGE_XPN(24),//9
EDGE_XNP(25),//10
EDGE_XPP(26);//11
public final int i;
public final int mask;
@@ -86,4 +88,50 @@ public enum PartMap
}
throw new IllegalArgumentException("Switch Falloff");
}
private static int[] edgeBetweenMap = new int[]{
-1, -1, 8, 10, 4, 5,
-1, -1, 9, 11, 6, 7,
-1, -1,-1, -1, 0, 2,
-1, -1,-1, -1, 1, 3};
public static int edgeBetween(int s1, int s2)
{
if(s2 < s1)
return edgeBetween(s2, s1);
if((s1&6) == (s2&6))
throw new IllegalArgumentException("Faces "+s1+" and "+s2+" are opposites");
return 15+edgeBetweenMap[s1*6+s2];
}
private static int[] sideRotMap = new int[]{
3,5,2,4,
3,4,2,5,
1,5,0,4,
1,4,0,5,
1,2,0,3,
1,3,0,2};
public static int rotateSide(int s, int r)
{
return sideRotMap[s<<2|r];
}
private static int[] rotSideMap = new int[]{
-1,-1, 2, 0, 3, 1,
-1,-1, 2, 0, 1, 3,
2, 0,-1,-1, 3, 1,
2, 0,-1,-1, 1, 3,
2, 0, 1, 3,-1,-1,
2, 0, 3, 1,-1,-1};
/**
* Reverse of rotateSide
*/
public static int rotationTo(int s1, int s2)
{
if((s1&6) == (s2&6))
throw new IllegalArgumentException("Faces "+s1+" and "+s2+" are opposites");
return rotSideMap[s1*6+s2];
}
}