Last active
August 29, 2015 13:56
-
-
Save RainWarrior/9107341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val oreDictList = OreDictionary.getOreNames | |
for { | |
toolType <- ToolType.values | |
autodetectValues = configurationSettings.getAutodetectBlocksList(toolType) | |
if configurationSettings.getAutodetectBlocksToggle(toolType) | |
oreDictEntry <- oreDictList | |
autodetectValue <- autodetectValues | |
if !autodetectValue.isEmpty() && oreDictEntry.startsWith(autodetectValue) | |
itemStacks = OreDictionary.getOres(oreDictEntry) | |
item <- itemStacks | |
if item.getItem.instanceOf[ItemBlock] | |
} { | |
val blockName = Item.itemRegistry.getNameForObject(item.getItem) | |
configurationSettings.addBlockToWhitelist(toolType, new BlockID(blockName, item.getItemDamage)) | |
try { | |
// Some mods raise an exception when calling getDisplayName on blocks. | |
MinerLogger debug s"Adding $blockName/${item.getItemDamage} (${item.getDisplayName}) to block whitelist for $toolType ($autoDetectValue:$oreDictEntry)" | |
} | |
catch { | |
case e: Exception => | |
// Left over from 1.5/1.6 where some mods were throwing exceptions on item.getDisplayName() | |
// I just changed id => mod in 1.7 | |
logger error s"ERROR while looking at block with name $blockName. This is a bug with the respective mod." | |
logger catching e | |
} | |
} | |
configurationSettings.saveConfigs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment