From 6a162a426998f88b5280d8f1a24b9e131921eb5b Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 24 Aug 2012 16:10:18 -0700 Subject: [PATCH] Fixed foundation class Block not taking -1 as a valid data value (used for wildcard matching of the data value). --- .../java/com/sk89q/worldedit/foundation/Block.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/foundation/Block.java b/src/main/java/com/sk89q/worldedit/foundation/Block.java index a155f3198..464ad2173 100644 --- a/src/main/java/com/sk89q/worldedit/foundation/Block.java +++ b/src/main/java/com/sk89q/worldedit/foundation/Block.java @@ -156,8 +156,8 @@ public class Block implements TileEntityBlock { + data + " given)"); } - if (data < 0) { - throw new IllegalArgumentException("Can't have a block data value below 0"); + if (data < -1) { + throw new IllegalArgumentException("Can't have a block data value below -1"); } this.data = (short) data; @@ -176,6 +176,16 @@ public class Block implements TileEntityBlock { 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 public boolean hasNbtData() { return getNbtData() != null;