MCPcopy Create free account
hub / github.com/Teneted/Tenet / setFacingDirection

Method setFacingDirection

src/main/java/org/bukkit/material/Lever.java:90–139  ·  view source on GitHub ↗

Sets the direction this lever is pointing in

(BlockFace face)

Source from the content-addressed store, hash-verified

88 * Sets the direction this lever is pointing in
89 */
90 @Override
91 public void setFacingDirection(BlockFace face) {
92 byte data = (byte) (getData() & 0x8);
93 BlockFace attach = getAttachedFace();
94
95 if (attach == BlockFace.DOWN) {
96 switch (face) {
97 case SOUTH:
98 case NORTH:
99 data |= 0x5;
100 break;
101
102 case EAST:
103 case WEST:
104 data |= 0x6;
105 break;
106 }
107 } else if (attach == BlockFace.UP) {
108 switch (face) {
109 case SOUTH:
110 case NORTH:
111 data |= 0x7;
112 break;
113
114 case EAST:
115 case WEST:
116 data |= 0x0;
117 break;
118 }
119 } else {
120 switch (face) {
121 case EAST:
122 data |= 0x1;
123 break;
124
125 case WEST:
126 data |= 0x2;
127 break;
128
129 case SOUTH:
130 data |= 0x3;
131 break;
132
133 case NORTH:
134 data |= 0x4;
135 break;
136 }
137 }
138 setData(data);
139 }
140
141 @Override
142 public String toString() {

Callers

nothing calls this directly

Calls 3

getAttachedFaceMethod · 0.95
getDataMethod · 0.65
setDataMethod · 0.65

Tested by

no test coverage detected