From 6478f23d18b4f0b4585dadec4f6a06894725b880 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 29 Apr 2016 20:29:51 +0200 Subject: [PATCH] added property check to StateMatcher --- src/main/java/main/util/StateMatcher.java | 13 +++++++++---- 1 file 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 { 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; } }