Give Harvest Tools the proper toolclass callback

This commit is contained in:
Bernhard Bonigl committed 2014-11-01 23:02:22 +01:00
1 parent c58bec5c78
commit 990a55aca5
1 file changed
+14
@@ -19,6 +19,9 @@ import net.minecraftforge.common.ForgeHooks;
import tconstruct.tools.TinkerTools;
import tconstruct.util.config.PHConstruct;
import java.util.HashSet;
import java.util.Set;
/* Base class for tools that should be harvesting blocks */
public abstract class HarvestTool extends ToolCore
@@ -118,6 +121,17 @@ public abstract class HarvestTool extends ToolCore
protected abstract String getHarvestType ();
@Override
public Set<String> getToolClasses(ItemStack stack) {
Set<String> set = new HashSet<String>();
if(stack != null && stack.getItem() instanceof HarvestTool) {
set.add(((HarvestTool) stack.getItem()).getHarvestType());
}
return set;
}
public boolean isEffective (Block block, int meta)
{
if(this.getHarvestType().equals(block.getHarvestTool(meta)))