Skip to content

Commit

Permalink
Give Harvest Tools the proper toolclass callback
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Nov 1, 2014
1 parent c58bec5 commit 990a55a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/tconstruct/library/tools/HarvestTool.java
Expand Up @@ -19,6 +19,9 @@
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
Expand Down Expand Up @@ -118,6 +121,17 @@ public String[] getTraits ()

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)))
Expand Down

1 comment on commit 990a55a

@TherminatorX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit, I like it.

Please sign in to comment.