Merge pull request #42 from CovertJaguar/patch-2
Added a function for checking block harvest levels.
This commit is contained in:
commit
849df24f80
1 changed files with 20 additions and 0 deletions
|
@ -422,6 +422,26 @@ public class MinecraftForge
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the block harvest level for a particular tool class.
|
||||
*
|
||||
* @param block The block to check.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to check as able to remove this block.
|
||||
* @see setToolClass for details on tool classes.
|
||||
* @return The harvest level or -1 if no mapping exists.
|
||||
*/
|
||||
public static int getBlockHarvestLevel(Block block, int metadata, String toolClass)
|
||||
{
|
||||
ForgeHooks.initTools();
|
||||
List key = Arrays.asList(block.blockID, metadata, toolClass);
|
||||
Integer harvestLevel = (Integer)ForgeHooks.toolHarvestLevels.get(key);
|
||||
if(harvestLevel == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return harvestLevel;
|
||||
}
|
||||
|
||||
/** Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
|
|
Loading…
Reference in a new issue