Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
Cake.java
Go to the documentation of this file.
1 package org.bukkit.material;
2 
3 import org.bukkit.Material;
4 
5 public class Cake extends MaterialData {
6  public Cake() {
7  super(Material.CAKE_BLOCK);
8  }
9 
10  public Cake(int type) {
11  super(type);
12  }
13 
14  public Cake(Material type) {
15  super(type);
16  }
17 
18  public Cake(int type, byte data) {
19  super(type, data);
20  }
21 
22  public Cake(Material type, byte data) {
23  super(type, data);
24  }
25 
31  public int getSlicesEaten() {
32  return getData();
33  }
34 
40  public int getSlicesRemaining() {
41  return 6 - getData();
42  }
43 
49  public void setSlicesEaten(int n) {
50  if (n < 6) {
51  setData((byte) n);
52  } // TODO: else destroy the block? Probably not possible though
53  }
54 
60  public void setSlicesRemaining(int n) {
61  if (n > 6) {
62  n = 6;
63  }
64  setData((byte) (6 - n));
65  }
66 
67  @Override
68  public String toString() {
69  return super.toString() + " " + getSlicesEaten() + "/" + getSlicesRemaining() + " slices eaten/remaining";
70  }
71 
72  @Override
73  public Cake clone() {
74  return (Cake) super.clone();
75  }
76 }