Worked on configs

This commit is contained in:
DarkGuardsman 2013-08-14 14:07:32 -04:00
parent 9a0187e032
commit c5c7a4c31d
3 changed files with 23 additions and 20 deletions

View file

@ -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 */
}

View file

@ -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;

View file

@ -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);
}
}
}
}