Fixed foundation class Block not taking -1 as a valid data value (used for wildcard matching of the data value).

Dieser Commit ist enthalten in:
sk89q 2012-08-24 16:10:18 -07:00
Ursprung cfa1400c26
Commit 6a162a4269

Datei anzeigen

@ -156,8 +156,8 @@ public class Block implements TileEntityBlock {
+ data + " given)"); + data + " given)");
} }
if (data < 0) { if (data < -1) {
throw new IllegalArgumentException("Can't have a block data value below 0"); throw new IllegalArgumentException("Can't have a block data value below -1");
} }
this.data = (short) data; this.data = (short) data;
@ -176,6 +176,16 @@ public class Block implements TileEntityBlock {
setData(data); setData(data);
} }
/**
* Returns whether the data value is -1, indicating that this block is to be
* used as a wildcard matching block.
*
* @return true if the data value is -1
*/
public boolean hasWildcardData() {
return getData() == -1;
}
@Override @Override
public boolean hasNbtData() { public boolean hasNbtData() {
return getNbtData() != null; return getNbtData() != null;