diff --git a/src/dark/core/DarkMain.java b/src/dark/core/DarkMain.java index d8fbaaa0..820403cb 100644 --- a/src/dark/core/DarkMain.java +++ b/src/dark/core/DarkMain.java @@ -142,8 +142,14 @@ public class DarkMain extends ModPrefab CONFIGURATION.load(); /* BLOCKS */ blockMulti = new BlockMulti(DarkMain.CONFIGURATION.getBlock("MultiBlock", getNextID()).getInt()); - CoreRecipeLoader.battery = new ItemBattery("Battery", ITEM_ID_PREFIX++); - CoreRecipeLoader.wrench = new ItemWrench(ITEM_ID_PREFIX++, DarkMain.CONFIGURATION); + if (CONFIGURATION.get("general", "EnableBattery", true).getBoolean(true)) + { + CoreRecipeLoader.battery = new ItemBattery("Battery", ITEM_ID_PREFIX++); + } + if (CONFIGURATION.get("general", "EnableWrench", true).getBoolean(true)) + { + CoreRecipeLoader.wrench = new ItemWrench(ITEM_ID_PREFIX++, DarkMain.CONFIGURATION); + } if (CONFIGURATION.get("general", "LoadOre", true).getBoolean(true)) { CoreRecipeLoader.blockOre = new BlockOre(getNextID(), CONFIGURATION); @@ -153,10 +159,7 @@ public class DarkMain extends ModPrefab { CoreRecipeLoader.itemMetals = new ItemOreDirv(ITEM_ID_PREFIX++, CONFIGURATION); } - if (CONFIGURATION.hasChanged()) - { - CONFIGURATION.save(); - } + CONFIGURATION.save(); /* CONFIG END */ } diff --git a/src/dark/core/blocks/BlockMachine.java b/src/dark/core/blocks/BlockMachine.java index d44cdcb2..6855e2d7 100644 --- a/src/dark/core/blocks/BlockMachine.java +++ b/src/dark/core/blocks/BlockMachine.java @@ -1,7 +1,5 @@ package dark.core.blocks; -import java.util.Random; - import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; diff --git a/src/dark/core/items/ItemWrench.java b/src/dark/core/items/ItemWrench.java index 2f6c14a8..cbf459ee 100644 --- a/src/dark/core/items/ItemWrench.java +++ b/src/dark/core/items/ItemWrench.java @@ -1,10 +1,6 @@ package dark.core.items; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.core.DarkMain; import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,21 +8,20 @@ import net.minecraft.world.World; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.ForgeDirection; import buildcraft.api.tools.IToolWrench; +import dark.core.DarkMain; public class ItemWrench extends ItemBasic implements IToolWrench { + static boolean damageWrench = false; + public ItemWrench(int id, Configuration config) { super(id, "wrench", config); + damageWrench = config.get("general", "DamageWrench", false).getBoolean(false); this.setMaxStackSize(1); + this.setMaxDamage(500 + config.get("general", "AddedWrenchUses", 500).getInt()); this.setCreativeTab(CreativeTabs.tabTools); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IconRegister iconRegister) - { - this.itemIcon = iconRegister.registerIcon(DarkMain.getInstance().PREFIX + "wrench"); + this.func_111206_d(DarkMain.getInstance().PREFIX + "wrench"); } @Override @@ -75,7 +70,14 @@ public class ItemWrench extends ItemBasic implements IToolWrench @Override public void wrenchUsed(EntityPlayer player, int x, int y, int z) { - // TODO Auto-generated method stub + if(damageWrench && player != null && !player.worldObj.isRemote) + { + ItemStack stack = player.getHeldItem(); + if(stack != null && stack.itemID == this.itemID) + { + stack.damageItem(1, player); + } + } } }