Represents a bed.
| 7 | * Represents a bed. |
| 8 | */ |
| 9 | public class Bed extends MaterialData implements Directional { |
| 10 | |
| 11 | /** |
| 12 | * Default constructor for a bed. |
| 13 | */ |
| 14 | public Bed() { |
| 15 | super(Material.BED_BLOCK); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Instantiate a bed facing in a particular direction. |
| 20 | * @param direction the direction the bed's head is facing |
| 21 | */ |
| 22 | public Bed(BlockFace direction) { |
| 23 | this(); |
| 24 | setFacingDirection(direction); |
| 25 | } |
| 26 | |
| 27 | public Bed(final int type) { |
| 28 | super(type); |
| 29 | } |
| 30 | |
| 31 | public Bed(final Material type) { |
| 32 | super(type); |
| 33 | } |
| 34 | |
| 35 | public Bed(final int type, final byte data) { |
| 36 | super(type, data); |
| 37 | } |
| 38 | |
| 39 | public Bed(final Material type, final byte data) { |
| 40 | super(type, data); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Determine if this block represents the head of the bed |
| 45 | * |
| 46 | * @return true if this is the head of the bed, false if it is the foot |
| 47 | */ |
| 48 | public boolean isHeadOfBed() { |
| 49 | return (getData() & 0x8) == 0x8; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Configure this to be either the head or the foot of the bed |
| 54 | * @param isHeadOfBed True to make it the head. |
| 55 | */ |
| 56 | public void setHeadOfBed(boolean isHeadOfBed) { |
| 57 | setData((byte) (isHeadOfBed ? (getData() | 0x8) : (getData() & ~0x8))); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Set which direction the head of the bed is facing. Note that this will |
| 62 | * only affect one of the two blocks the bed is made of. |
| 63 | */ |
| 64 | public void setFacingDirection(BlockFace face) { |
| 65 | byte data; |
| 66 |
nothing calls this directly
no outgoing calls
no test coverage detected