Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.material.Bed Class Reference
Inheritance diagram for org.bukkit.material.Bed:
org.bukkit.material.MaterialData org.bukkit.material.Directional

Public Member Functions

 Bed ()
 
 Bed (BlockFace direction)
 
 Bed (final int type)
 
 Bed (final Material type)
 
 Bed (final int type, final byte data)
 
 Bed (final Material type, final byte data)
 
boolean isHeadOfBed ()
 
void setHeadOfBed (boolean isHeadOfBed)
 
void setFacingDirection (BlockFace face)
 
BlockFace getFacing ()
 
String toString ()
 
Bed clone ()
 
- Public Member Functions inherited from org.bukkit.material.MaterialData
 MaterialData (final int type)
 
 MaterialData (final Material type)
 
 MaterialData (final int type, final byte data)
 
 MaterialData (final Material type, final byte data)
 
byte getData ()
 
void setData (byte data)
 
Material getItemType ()
 
int getItemTypeId ()
 
ItemStack toItemStack ()
 
ItemStack toItemStack (int amount)
 
String toString ()
 
int hashCode ()
 
boolean equals (Object obj)
 
MaterialData clone ()
 

Detailed Description

Represents a bed.

Definition at line 9 of file Bed.java.

Constructor & Destructor Documentation

org.bukkit.material.Bed.Bed ( )

Default constructor for a bed.

Definition at line 14 of file Bed.java.

14  {
15  super(Material.BED_BLOCK);
16  }
org.bukkit.material.Bed.Bed ( BlockFace  direction)

Instantiate a bed facing in a particular direction.

Parameters
directionthe direction the bed's head is facing

Definition at line 23 of file Bed.java.

References org.bukkit.material.Bed.setFacingDirection().

23  {
24  this();
25  setFacingDirection(direction);
26  }
void setFacingDirection(BlockFace face)
Definition: Bed.java:81
org.bukkit.material.Bed.Bed ( final int  type)
Deprecated:
Magic value

Definition at line 33 of file Bed.java.

33  {
34  super(type);
35  }
org.bukkit.material.Bed.Bed ( final int  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 46 of file Bed.java.

46  {
47  super(type, data);
48  }
org.bukkit.material.Bed.Bed ( final Material  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 55 of file Bed.java.

55  {
56  super(type, data);
57  }

Member Function Documentation

BlockFace org.bukkit.material.Bed.getFacing ( )

Get the direction that this bed's head is facing toward

Returns
the direction the head of the bed is facing

Implements org.bukkit.material.Directional.

Definition at line 114 of file Bed.java.

References org.bukkit.material.MaterialData.getData().

114  {
115  byte data = (byte) (getData() & 0x7);
116 
117  switch (data) {
118  case 0x0:
119  return BlockFace.SOUTH;
120 
121  case 0x1:
122  return BlockFace.WEST;
123 
124  case 0x2:
125  return BlockFace.NORTH;
126 
127  case 0x3:
128  default:
129  return BlockFace.EAST;
130  }
131  }
boolean org.bukkit.material.Bed.isHeadOfBed ( )

Determine if this block represents the head of the bed

Returns
true if this is the head of the bed, false if it is the foot

Definition at line 64 of file Bed.java.

References org.bukkit.material.MaterialData.getData().

Referenced by org.bukkit.material.Bed.setFacingDirection().

64  {
65  return (getData() & 0x8) == 0x8;
66  }
void org.bukkit.material.Bed.setFacingDirection ( BlockFace  face)

Set which direction the head of the bed is facing. Note that this will only affect one of the two blocks the bed is made of.

Implements org.bukkit.material.Directional.

Definition at line 81 of file Bed.java.

References org.bukkit.material.Bed.isHeadOfBed(), and org.bukkit.material.MaterialData.setData().

Referenced by org.bukkit.material.Bed.Bed().

81  {
82  byte data;
83 
84  switch (face) {
85  case SOUTH:
86  data = 0x0;
87  break;
88 
89  case WEST:
90  data = 0x1;
91  break;
92 
93  case NORTH:
94  data = 0x2;
95  break;
96 
97  case EAST:
98  default:
99  data = 0x3;
100  }
101 
102  if (isHeadOfBed()) {
103  data |= 0x8;
104  }
105 
106  setData(data);
107  }
boolean isHeadOfBed()
Definition: Bed.java:64
void org.bukkit.material.Bed.setHeadOfBed ( boolean  isHeadOfBed)

Configure this to be either the head or the foot of the bed

Parameters
isHeadOfBedTrue to make it the head.

Definition at line 73 of file Bed.java.

References org.bukkit.material.MaterialData.getData(), and org.bukkit.material.MaterialData.setData().

73  {
74  setData((byte) (isHeadOfBed ? (getData() | 0x8) : (getData() & ~0x8)));
75  }
boolean isHeadOfBed()
Definition: Bed.java:64

The documentation for this class was generated from the following file: