Add material data classes for cake, jukeboxes, and diodes. Remove some unneeded ones.
By: Celtic Minstrel <celtic.minstrel.ca@>
This commit is contained in:
61
paper-api/src/main/java/org/bukkit/material/Cake.java
Normal file
61
paper-api/src/main/java/org/bukkit/material/Cake.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class Cake extends MaterialData {
|
||||
|
||||
public Cake(int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Cake(Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Cake(int type, byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Cake(Material type, byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of slices eaten from this cake
|
||||
*
|
||||
* @return The number of slices eaten
|
||||
*/
|
||||
public int getSlicesEaten() {
|
||||
return getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of slices remaining on this cake
|
||||
*
|
||||
* @return The number of slices remaining
|
||||
*/
|
||||
public int getSlicesRemaining() {
|
||||
return 6 - getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of slices eaten from this cake
|
||||
*
|
||||
* @param n The number of slices eaten
|
||||
*/
|
||||
public void setSlicesEaten(int n) {
|
||||
if (n < 6) {
|
||||
setData((byte) n);
|
||||
} // TODO: else destroy the block? Probably not possible though
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of slices remaining on this cake
|
||||
*
|
||||
* @param n The number of slices remaining
|
||||
*/
|
||||
public void setSlicesRemaining(int n) {
|
||||
if (n > 6) n = 6;
|
||||
setData((byte) (6 - n));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user