Bukkit
1.4.7-R1.0
Main Page
Related Pages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Enumerator
Pages
Bed.java
Go to the documentation of this file.
1
package
org.bukkit.material;
2
3
import
org.bukkit.Material;
4
import
org.bukkit.block.BlockFace;
5
9
public
class
Bed
extends
MaterialData
implements
Directional
{
10
14
public
Bed
() {
15
super(
Material
.
BED_BLOCK
);
16
}
17
23
public
Bed
(
BlockFace
direction) {
24
this
();
25
setFacingDirection
(direction);
26
}
27
28
public
Bed
(
final
int
type) {
29
super(type);
30
}
31
32
public
Bed
(
final
Material
type) {
33
super(type);
34
}
35
36
public
Bed
(
final
int
type,
final
byte data) {
37
super(type, data);
38
}
39
40
public
Bed
(
final
Material
type,
final
byte data) {
41
super(type, data);
42
}
43
49
public
boolean
isHeadOfBed
() {
50
return
(
getData
() & 0x8) == 0x8;
51
}
52
58
public
void
setHeadOfBed
(
boolean
isHeadOfBed
) {
59
setData
((byte) (isHeadOfBed ? (
getData
() | 0x8) : (
getData
() & ~0x8)));
60
}
61
66
public
void
setFacingDirection
(
BlockFace
face) {
67
byte data;
68
69
switch
(face) {
70
case
SOUTH:
71
data = 0x0;
72
break
;
73
74
case
WEST:
75
data = 0x1;
76
break
;
77
78
case
NORTH:
79
data = 0x2;
80
break
;
81
82
case
EAST:
83
default
:
84
data = 0x3;
85
}
86
87
if
(
isHeadOfBed
()) {
88
data |= 0x8;
89
}
90
91
setData
(data);
92
}
93
99
public
BlockFace
getFacing
() {
100
byte data = (byte) (
getData
() & 0x7);
101
102
switch
(data) {
103
case
0x0:
104
return
BlockFace
.
SOUTH
;
105
106
case
0x1:
107
return
BlockFace
.
WEST
;
108
109
case
0x2:
110
return
BlockFace
.
NORTH
;
111
112
case
0x3:
113
default
:
114
return
BlockFace
.
EAST
;
115
}
116
}
117
118
@Override
119
public
String
toString
() {
120
return
(
isHeadOfBed
() ?
"HEAD"
:
"FOOT"
) +
" of "
+ super.toString() +
" facing "
+
getFacing
();
121
}
122
123
@Override
124
public
Bed
clone
() {
125
return
(
Bed
) super.
clone
();
126
}
127
}
org
bukkit
material
Bed.java
Generated on Wed May 22 2013 10:16:35 for Bukkit by
1.8.2