blob: 3105a13065034ad5675e63a61b7472a840dc99ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
package org.bukkit.material;
import org.bukkit.block.BlockFace;
import org.bukkit.Material;
/**
* MaterialData for torches
*/
public class Torch extends SimpleAttachableMaterialData {
public Torch() {
super(Material.TORCH);
}
public Torch(final int type) {
super(type);
}
public Torch(final Material type) {
super(type);
}
public Torch(final int type, final byte data) {
super(type, data);
}
public Torch(final Material type, final byte data) {
super(type, data);
}
/**
* Gets the face that this block is attached on
*
* @return BlockFace attached to
*/
public BlockFace getAttachedFace() {
byte data = getData();
switch (data) {
case 0x1:
return BlockFace.NORTH;
case 0x2:
return BlockFace.SOUTH;
case 0x3:
return BlockFace.EAST;
case 0x4:
return BlockFace.WEST;
case 0x5:
return BlockFace.DOWN;
}
return null;
}
public void setFacingDirection(BlockFace face) {
byte data;
switch (face) {
case SOUTH:
data = 0x1;
break;
case NORTH:
data = 0x2;
break;
case WEST:
data = 0x3;
break;
case EAST:
data = 0x4;
break;
case UP:
default:
data = 0x5;
}
setData(data);
}
}
|