Added special Whitelist Config for Paxels and the Drill

This commit is contained in:
Ellpeck 2015-09-13 16:41:49 +02:00
parent e897fe8c42
commit 5092c1dab7
4 changed files with 33 additions and 6 deletions

View file

@ -29,6 +29,9 @@ public class ConfigValues{
public static String[] oreMagnetExceptions;
public static String[] oreMagnetExtraWhitelist;
public static String[] paxelExtraMiningWhitelist;
public static String[] drillExtraminingWhitelist;
public static void defineConfigValues(Configuration config){
for(ConfigCrafting currConf : craftingConfig){
@ -48,5 +51,7 @@ public class ConfigValues{
mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
oreMagnetExceptions = config.getStringList("Ore Magnet Exceptions", ConfigCategories.MACHINE_VALUES.name, new String[0], "By default, the Ore Magnet pulls up everything that is registered in the OreDictionary as a String that starts with 'ore'. If you want any Ore not to be pulled up by the Magnet, put its ORE DICTIONARY name here.");
oreMagnetExtraWhitelist = config.getStringList("Ore Magnet Extra Whitelist", ConfigCategories.MACHINE_VALUES.name, new String[]{"rftools:dimensionalShardBlock"}, "By default, the Ore Magnet pulls up everything that is registered in the OreDictionary as a String that starts with 'ore'. If you want anything else to be pulled up by the Magnet, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
paxelExtraMiningWhitelist = config.getStringList("AIOT Extra Whitelist", ConfigCategories.TOOL_VALUES.name, new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
drillExtraminingWhitelist = config.getStringList("Drill Extra Whitelist", ConfigCategories.TOOL_VALUES.name, new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
}
}

View file

@ -15,6 +15,7 @@ import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.values.ConfigFloatValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.inventory.GuiHandler;
@ -401,14 +402,24 @@ public class ItemDrill extends ItemEnergy implements INameableItem{
return true;
}
private boolean hasExtraWhitelist(Block block){
String name = Block.blockRegistry.getNameForObject(block);
if(name != null){
for(String list : ConfigValues.drillExtraminingWhitelist){
if(list.equals(name)) return true;
}
}
return false;
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta){
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.0F;
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.0F;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack){
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? ToolMaterial.EMERALD.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 1) : ToolMaterial.EMERALD.getHarvestLevel() >= 1) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 2))));
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? ToolMaterial.EMERALD.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 1) : ToolMaterial.EMERALD.getHarvestLevel() >= 1) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 2) : ToolMaterial.EMERALD.getHarvestLevel() >= 2))));
}
@Override

View file

@ -14,6 +14,7 @@ import com.google.common.collect.Sets;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
@ -50,14 +51,24 @@ public class ItemAllToolAA extends ItemTool implements INameableItem{
this.setMaxDamage(this.getMaxDamage()*4);
}
private boolean hasExtraWhitelist(Block block){
String name = Block.blockRegistry.getNameForObject(block);
if(name != null){
for(String list : ConfigValues.paxelExtraMiningWhitelist){
if(list.equals(name)) return true;
}
}
return false;
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta){
return block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.efficiencyOnProperMaterial : 1.0F;
return this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.efficiencyOnProperMaterial : 1.0F;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack){
return block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
return this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
}
@Override

View file

@ -405,7 +405,7 @@ booklet.actuallyadditions.chapter.treasureChest.text.1=<item>Treasure Chests<r>
booklet.actuallyadditions.chapter.breaker.name=Breakers and Placers
booklet.actuallyadditions.chapter.breaker.text.1=The <item>Breaker<r>... well.. it breaks blocks in front of it. That's about it. It can be oriented in every direction like a Piston.
booklet.actuallyadditions.chapter.breaker.text.2=The <item>Placer<r>... well... it places blocks in front of it. That's about it. It can be oriented in every direction like a Piston.
booklet.actuallyadditions.chapter.breaker.text.3=The <item>Liquid Placer<r> places blocks that correspond to the liquid you put in via a bucket or pipe in via a pipe. Needs <imp>1000mb<r> to place one block.
booklet.actuallyadditions.chapter.breaker.text.4=The <item>Liquid Collector<r> will collect liquid blocks in front of it and convert them to <imp>1000mb<r> of fluid. That's the equivalent of a filled bucket.
booklet.actuallyadditions.chapter.breaker.text.3=The <item>Liquid Placer<r> places blocks that correspond to the liquid you put in via a bucket or pipe in via a pipe. Needs <imp>1000mB<r> to place one block.
booklet.actuallyadditions.chapter.breaker.text.4=The <item>Liquid Collector<r> will collect liquid blocks in front of it and convert them to <imp>1000mB<r> of fluid. That's the equivalent of a filled bucket.
booklet.actuallyadditions.chapter.phantomfaces.name=Phantomfaces