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 { 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; } }