[Bleeding] Add new MaterialData classes for new blocks and update existing blocks with new data

By: Mike Primm <mike@primmhome.com>
This commit is contained in:
Bukkit/Spigot
2012-08-04 21:23:59 -05:00
parent 64ad50197f
commit 5154864bbc
12 changed files with 640 additions and 21 deletions

View File

@@ -38,7 +38,7 @@ public abstract class TexturedMaterial extends MaterialData {
* @return Material of this block
*/
public Material getMaterial() {
int n = (int) getData();
int n = getTextureIndex();
if (n > getTextures().size() - 1) {
n = 0;
}
@@ -54,12 +54,28 @@ public abstract class TexturedMaterial extends MaterialData {
*/
public void setMaterial(Material material) {
if (getTextures().contains(material)) {
setData((byte) getTextures().indexOf(material));
setTextureIndex(getTextures().indexOf(material));
} else {
setData((byte) 0x0);
setTextureIndex(0x0);
}
}
/**
* Get material index from data
* @return index of data in textures list
*/
protected int getTextureIndex() {
return getData(); // Default to using all bits - override for other mappings
}
/**
* Set material index
* @param idx - index of data in textures list
*/
protected void setTextureIndex(int idx) {
setData((byte) idx); // Defult to using all bits - override for other mappings
}
@Override
public String toString() {
return getMaterial() + " " + super.toString();