summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGiovanni Harting <539@idlegandalf.com>2016-04-29 20:29:51 +0200
committerGiovanni Harting <539@idlegandalf.com>2016-04-29 20:29:51 +0200
commit6478f23d18b4f0b4585dadec4f6a06894725b880 (patch)
tree420a08eb57dec6dc09e078a254a16f5b3079e7d9 /src/main/java
parent893e90ab6c2dc99ff9da70e3397203e90bdb2391 (diff)
added property check to StateMatcher
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/main/util/StateMatcher.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/main/util/StateMatcher.java b/src/main/java/main/util/StateMatcher.java
index 5dc1a2d..b566402 100644
--- a/src/main/java/main/util/StateMatcher.java
+++ b/src/main/java/main/util/StateMatcher.java
@@ -1,21 +1,26 @@
package main.util;
import com.google.common.base.Predicate;
+import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
public class StateMatcher implements Predicate<IBlockState> {
private final IBlockState state;
+ private final IProperty property;
+ private final Comparable value;
- private StateMatcher(IBlockState state) {
+ private StateMatcher(IBlockState state, IProperty property, Comparable value) {
this.state = state;
+ this.property = property;
+ this.value = value;
}
- public static StateMatcher forState(IBlockState state) {
- return new StateMatcher(state);
+ public static StateMatcher forState(IBlockState state, IProperty property, Comparable value) {
+ return new StateMatcher(state, property, value);
}
public boolean apply(IBlockState state) {
- return state != null && state.getBlock() == this.state.getBlock() && state.getMaterial() == this.state.getMaterial();
+ return state != null && state.getBlock() == this.state.getBlock() && state.getValue(property) == value;
}
}