Commits
Thinkofname authored cbf3e5bba9e Merge
66 66 | |
67 67 | /** |
68 68 | * Gets the face that this block is attached on |
69 69 | * |
70 70 | * @return BlockFace attached to |
71 71 | */ |
72 72 | public BlockFace getAttachedFace() { |
73 73 | byte data = (byte) (getData() & 0x7); |
74 74 | |
75 75 | switch (data) { |
76 + | case 0x0: |
77 + | return BlockFace.UP; |
78 + | |
76 79 | case 0x1: |
77 80 | return BlockFace.WEST; |
78 81 | |
79 82 | case 0x2: |
80 83 | return BlockFace.EAST; |
81 84 | |
82 85 | case 0x3: |
83 86 | return BlockFace.NORTH; |
84 87 | |
85 88 | case 0x4: |
86 89 | return BlockFace.SOUTH; |
90 + | |
91 + | case 0x5: |
92 + | return BlockFace.DOWN; |
87 93 | } |
88 94 | |
89 95 | return null; |
90 96 | } |
91 97 | |
92 98 | /** |
93 99 | * Sets the direction this button is pointing toward |
94 100 | */ |
95 101 | public void setFacingDirection(BlockFace face) { |
96 102 | byte data = (byte) (getData() & 0x8); |
97 103 | |
98 104 | switch (face) { |
105 + | case DOWN: |
106 + | data |= 0x0; |
107 + | break; |
108 + | |
99 109 | case EAST: |
100 110 | data |= 0x1; |
101 111 | break; |
102 112 | |
103 113 | case WEST: |
104 114 | data |= 0x2; |
105 115 | break; |
106 116 | |
107 117 | case SOUTH: |
108 118 | data |= 0x3; |
109 119 | break; |
110 120 | |
111 121 | case NORTH: |
112 122 | data |= 0x4; |
113 123 | break; |
124 + | |
125 + | case UP: |
126 + | data |= 0x5; |
127 + | break; |
114 128 | } |
115 129 | |
116 130 | setData(data); |
117 131 | } |
118 132 | |
119 133 | |
120 134 | public String toString() { |
121 135 | return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED"; |
122 136 | } |
123 137 | |