MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / PistonBaseMaterial

Class PistonBaseMaterial

src/main/java/org/bukkit/material/PistonBaseMaterial.java:10–92  ·  view source on GitHub ↗

Material data for the piston base block

Source from the content-addressed store, hash-verified

8 * Material data for the piston base block
9 */
10public class PistonBaseMaterial extends MaterialData implements Directional, Redstone {
11 public PistonBaseMaterial(final int type) {
12 super(type);
13 }
14
15 public PistonBaseMaterial(final Material type) {
16 super(type);
17 }
18
19 public PistonBaseMaterial(final int type, final byte data) {
20 super(type, data);
21 }
22
23 public PistonBaseMaterial(final Material type, final byte data) {
24 super(type, data);
25 }
26
27 public void setFacingDirection(BlockFace face) {
28 byte data = (byte)(getData() & 0x8);
29
30 switch (face) {
31 case UP:
32 data |= 1;
33 break;
34 case EAST:
35 data |= 2;
36 break;
37 case WEST:
38 data |= 3;
39 break;
40 case NORTH:
41 data |= 4;
42 break;
43 case SOUTH:
44 data |= 5;
45 break;
46 }
47 setData(data);
48 }
49
50 public BlockFace getFacing() {
51 byte dir = (byte)(getData() & 7);
52
53 switch (dir) {
54 case 0:
55 return BlockFace.DOWN;
56 case 1:
57 return BlockFace.UP;
58 case 2:
59 return BlockFace.EAST;
60 case 3:
61 return BlockFace.WEST;
62 case 4:
63 return BlockFace.NORTH;
64 case 5:
65 return BlockFace.SOUTH;
66 default:
67 return BlockFace.SELF;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected