Jump to content

[Solved] Custom Tools aren't working


luxamy

Recommended Posts

Hey everyone, I have a problem with my mod. My tools aren't working, every time I start minecraft it crashes:

 

---- Minecraft Crash Report ----

// Would you like a cupcake?

 

Time: 14.02.13 18:59

Description: Failed to start game

 

cpw.mods.fml.common.LoaderException: java.lang.ExceptionInInitializerError

at cpw.mods.fml.common.LoadController.transition(LoadController.java:117)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:658)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)

at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

at net.minecraft.client.Minecraft.run(Minecraft.java:744)

at java.lang.Thread.run(Thread.java:722)

Caused by: java.lang.ExceptionInInitializerError

at Launcraft.Launcraft.load(Launcraft.java:31)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)

... 5 more

Caused by: java.lang.NullPointerException

at net.minecraft.item.ItemSword.<init>(ItemSword.java:23)

at Launcraft.src.ModItemSword.<init>(ModItemSword.java:12)

at Launcraft.src.ModItems.<clinit>(ModItems.java:22)

... 32 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.4.7

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_10, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 966912208 bytes (922 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active

mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

Launcraft [Launcraft] (minecraft) Unloaded->Constructed->Pre-initialized->Errored

LWJGL: 2.4.2

OpenGL: AMD Radeon HD 7570 GL version 4.2.11476 Compatibility Profile Context, ATI Technologies Inc.

Is Modded: Definitely; Client brand changed to 'forge,fml'

Type: Client (map_client.txt)

Texture Pack: Default

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

 

 

Here I have the ModItemSword File:

 

package Launcraft.src;

 

import net.minecraft.item.ItemSword;

import net.minecraft.item.ItemStack;

import net.minecraft.item.EnumToolMaterial;

import Launcraft.Launcraft;

 

public class ModItemSword extends ItemSword

{

    public ModItemSword(int x, int y, EnumToolMaterial par2EnumToolMaterial)

    {

        super(ModItems.baseId + ModItems.itemCount, par2EnumToolMaterial);

        ModItems.itemCount++;

        this.setCreativeTab(Launcraft.tabLauncraft);

        this.setIconCoord(x, y);

    }

   

    @Override

    public String getTextureFile()

    {

        return "/Launcraft/graphics/Items.png";

    }

}

 

 

 

And here is the ModItems File:

 

package Launcraft.src;

 

import net.minecraft.item.Item;

import cpw.mods.fml.common.registry.LanguageRegistry;

import Launcraft.Launcraft;

import net.minecraftforge.common.EnumHelper;

 

public class ModItems extends Item

{

public static int baseId = ModBlocks.baseId + ModBlocks.blockCount + 1;

public static int itemCount = 0;

 

public static Item ingotCopper = new ModItems(0, 0).setItemName("ingotCopper");

public static Item electrum = new ModItems(1, 0).setItemName("dustElectrum");

public static Item ingotTin = new ModItems(2, 0).setItemName("ingotTin");

public static Item ingotSilver = new ModItems(3, 0).setItemName("ingotSilver");

public static Item ruby = new ModItems(4, 0).setItemName("ruby");

public static Item sapphire = new ModItems(5, 0).setItemName("sapphire");

public static Item amethyst = new ModItems(6, 0).setItemName("amethyst");

public static Item glowingRedstone = new ModItems(7,0).setItemName("glowingRedstone");

//Copper Stuff

public static Item Coppersword = new ModItemSword(77,0,ModEnumMaterial.COPPER).setItemName("Coppersword");

public static Item Coppershovel = new ModItemShovel(93,0,ModEnumMaterial.COPPER).setItemName("Coppershovel");

public static Item Copperpickaxe = new ModItemPickaxe(109,0,ModEnumMaterial.COPPER).setItemName("Copperpickaxe");

public static Item Copperaxe = new ModItemAxe(125,0,ModEnumMaterial.COPPER).setItemName("Copperaxe");

public static Item Copperhoe = new ModItemHoe(141,0,ModEnumMaterial.COPPER).setItemName("Copperhoe");

public static Item Copperhelmet = new ModItems(13,0).setItemName("Copperhelmet");

public static Item Copperchestplate = new ModItems(29,0).setItemName("Copperchestplate");

public static Item Copperleggins = new ModItems(45,0).setItemName("Copperleggins");

public static Item Copperboots = new ModItems(61,0).setItemName("Copperboots");

//Silver Stuff

public static Item Silversword = new ModItemSword(78,0,ModEnumMaterial.SILVER).setItemName("Silversword");

public static Item Silvershovel = new ModItemShovel(94,0,ModEnumMaterial.SILVER).setItemName("Silvershovel");

public static Item Silverpickaxe = new ModItemPickaxe(110,0,ModEnumMaterial.SILVER).setItemName("Silverpickaxe");

public static Item Silveraxe = new ModItemAxe(126,0,ModEnumMaterial.SILVER).setItemName("Silveraxe");

public static Item Silverhoe = new ModItemHoe(142,0,ModEnumMaterial.SILVER).setItemName("Silverhoe");

public static Item Silverhelmet = new ModItems(14,0).setItemName("Silverhelmet");

public static Item Silverchestplate = new ModItems(30,0).setItemName("Silverchestplate");

public static Item Silverleggins = new ModItems(46,0).setItemName("Silverleggins");

public static Item Silverboots = new ModItems(62,0).setItemName("Silverboots");

//Gemstone Stuff

public static Item Gemstonesword = new ModItemSword(79,0,ModEnumMaterial.GEMSTONE).setItemName("Gemstonesword");

public static Item Gemstoneshovel = new ModItemShovel(95,0,ModEnumMaterial.GEMSTONE).setItemName("Gemstoneshovel");

public static Item Gemstonepickaxe = new ModItemPickaxe(111,0,ModEnumMaterial.GEMSTONE).setItemName("Gemstonepickaxe");

public static Item Gemstoneaxe = new ModItemAxe(127,0,ModEnumMaterial.GEMSTONE).setItemName("Gemstoneaxe");

public static Item Gemstonehoe = new ModItemHoe(143,0,ModEnumMaterial.GEMSTONE).setItemName("Gemstonehoe");

public static Item Gemstonehelmet = new ModItems(15,0).setItemName("Gemstonehelmet");

public static Item Gemstonechestplate = new ModItems(31,0).setItemName("Gemstonechestplate");

public static Item Gemstoneleggins = new ModItems(47,0).setItemName("Gemstoneleggins");

public static Item Gemstoneboots = new ModItems(63,0).setItemName("Gemstoneboots");

public static Item Gemstonebow = new ModItems(159,0).setItemName("Gemstonebow");

//spells

public static Item FireBall = new ModItems(16,0).setItemName("FireBall");

public static Item IceBall = new ModItems(17,0).setItemName("IceBall");

public static Item DirtWall = new ModItems(18,0).setItemName("DirtWall");

public static Item Gust = new ModItems(19,0).setItemName("Gust");

public static Item Blink1 = new ModItems(20,0).setItemName("Blink1");

public static Item Evaporate1 = new ModItems(21,0).setItemName("evaporate1");

public static Item Healing1 = new ModItems(22,0).setItemName("Healing1");

public static Item SpellPaper = new ModItems(23,0).setItemName("SpellPaper");

//advanced Spells

public static Item FireStorm = new ModItems(32,0).setItemName("FireStorm");

public static Item IceStorm = new ModItems(33,0).setItemName("IceStorm");

public static Item StoneWall = new ModItems(34,0).setItemName("StoneWall");

public static Item Storm = new ModItems(35,0).setItemName("Storm");

public static Item Blink2 = new ModItems(36,0).setItemName("Blink2");

public static Item Evaporate2 = new ModItems(37,0).setItemName("evaporate2");

public static Item Healing2 = new ModItems(38,0).setItemName("Healing2");

public static Item SpellTome = new ModItems(39,0).setItemName("SpellTome");

//highly advanced Spells

public static Item FireAura = new ModItems(48,0).setItemName("FireAura");

public static Item IceAura = new ModItems(49,0).setItemName("IceAura");

public static Item ObsidianWall = new ModItems(50,0).setItemName("ObsidianWall");

public static Item Tornado = new ModItems(51,0).setItemName("Tornado");

public static Item Blink3 = new ModItems(52,0).setItemName("Blink3");

public static Item Evaporate3 = new ModItems(53,0).setItemName("evaporate3");

public static Item Healing3 = new ModItems(54,0).setItemName("Healing3");

public static Item SpellBook = new ModItems(55,0).setItemName("SpellBook");

 

public static Item MagicBook = new ModItems(8,0).setItemName("MagicBook");

public static Item MagicNugget = new ModItems(9,0).setItemName("MagicNugget");

public static Item ManaOrb = new ModItems(10,0).setItemName("ManaOrb");

 

public ModItems()

{

super(baseId + itemCount);

this.setCreativeTab(Launcraft.tabLauncraft);

itemCount++;

}

 

public ModItems(int x, int y)

{

super(baseId + itemCount);

itemCount++;

this.setIconCoord(x, y);

this.setCreativeTab(Launcraft.tabLauncraft);

}

 

public static void initNames()

{

LanguageRegistry.addName(ingotCopper, "Copper Ingot");

LanguageRegistry.addName(electrum, "Electrum Dust");

LanguageRegistry.addName(ingotTin, "Tin Ingot");

LanguageRegistry.addName(ingotSilver, "Silver Ingot");

LanguageRegistry.addName(ruby, "Ruby");

LanguageRegistry.addName(sapphire, "Sapphire");

LanguageRegistry.addName(amethyst, "Amethyst");

LanguageRegistry.addName(glowingRedstone, "Glowing Redstone");

//Copper Stuff

LanguageRegistry.addName(Coppersword, "Copper Sword");

LanguageRegistry.addName(Coppershovel, "Copper Shovel");

LanguageRegistry.addName(Copperpickaxe, "Copper Pickaxe");

LanguageRegistry.addName(Copperaxe, "Copper Axe");

LanguageRegistry.addName(Copperhoe, "Copper Hoe");

LanguageRegistry.addName(Copperhelmet, "Copper Helmet");

LanguageRegistry.addName(Copperchestplate, "Copper Chestplate");

LanguageRegistry.addName(Copperleggins, "Copper Leggins");

LanguageRegistry.addName(Copperboots, "Copper Boots");

//Silver Stuff

LanguageRegistry.addName(Silversword, "Silver Sword");

LanguageRegistry.addName(Silvershovel, "Silver Shovel");

LanguageRegistry.addName(Silverpickaxe, "Silver Pickaxe");

LanguageRegistry.addName(Silveraxe, "Silver Axe");

LanguageRegistry.addName(Silverhoe, "Silver Hoe");

LanguageRegistry.addName(Silverhelmet, "Silver Helmet");

LanguageRegistry.addName(Silverchestplate, "Silver Chestplate");

LanguageRegistry.addName(Silverleggins, "Silver Leggins");

LanguageRegistry.addName(Silverboots, "Silver Boots");

//Gemstone Stuff

LanguageRegistry.addName(Gemstonesword, "Gemstone Sword");

LanguageRegistry.addName(Gemstoneshovel, "Gemstone Shovel");

LanguageRegistry.addName(Gemstonepickaxe, "Gemstone Pickaxe");

LanguageRegistry.addName(Gemstoneaxe, "Gemstone Axe");

LanguageRegistry.addName(Gemstonehoe, "Gemstone Hoe");

LanguageRegistry.addName(Gemstonehelmet, "Gemstone Helmet");

LanguageRegistry.addName(Gemstonechestplate, "Gemstone Chestplate");

LanguageRegistry.addName(Gemstoneleggins, "Gemstone Leggins");

LanguageRegistry.addName(Gemstoneboots, "Gemstone Boots");

LanguageRegistry.addName(Gemstonebow, "Gemstone Bow");

//Spells Lvl: 1

LanguageRegistry.addName(FireBall, "Fire Ball");

LanguageRegistry.addName(IceBall, "Ice Ball");

LanguageRegistry.addName(DirtWall, "Dirt Wall");

LanguageRegistry.addName(Gust, "Gust");

LanguageRegistry.addName(Blink1, "Blink Lvl: 1");

LanguageRegistry.addName(Evaporate1, "Evaporate Lvl: 1");

LanguageRegistry.addName(Healing1, "Healing Lvl: 1");

LanguageRegistry.addName(SpellPaper, "Spell Paper");

//Spells Lvl: 2

LanguageRegistry.addName(FireStorm, "Fire Storm");

LanguageRegistry.addName(IceStorm, "Ice Storm");

LanguageRegistry.addName(StoneWall, "Stone Wall");

LanguageRegistry.addName(Storm, "Storm");

LanguageRegistry.addName(Blink2, "Blink Lvl: 2");

LanguageRegistry.addName(Evaporate2, "Evaporate Lvl: 2");

LanguageRegistry.addName(Healing2, "Healing Lvl: 2");

LanguageRegistry.addName(SpellTome, "Spell Tome");

//Spells Lvl: 3

LanguageRegistry.addName(FireAura, "Fire Aura");

LanguageRegistry.addName(IceAura, "Ice Aura");

LanguageRegistry.addName(ObsidianWall, "Obsidian Wall");

LanguageRegistry.addName(Tornado, "Tornado");

LanguageRegistry.addName(Blink3, "Blink Lvl: 3");

LanguageRegistry.addName(Evaporate3, "Evaporate Lvl: 3");

LanguageRegistry.addName(Healing3, "Healing Lvl: 3");

LanguageRegistry.addName(SpellBook, "Spell Book");

LanguageRegistry.addName(MagicBook, "Magic Book");

 

LanguageRegistry.addName(MagicNugget, "Magic Nugget");

LanguageRegistry.addName(ManaOrb, "Mana Orb");

}

 

@Override

public String getTextureFile()

{

    return "/Launcraft/gfx/Items.png";

}

}

 

 

I hope someone can help me.

Link to comment
Share on other sites

 

here it is:

 

package Launcraft.src;

 

import net.minecraftforge.common.EnumHelper;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.ItemStack;

 

public class ModEnumMaterial

{

    public static EnumToolMaterial COPPER;

public static EnumToolMaterial SILVER;

public static EnumToolMaterial GEMSTONE;

 

public static EnumArmorMaterial COPPERARMOR;

public static EnumArmorMaterial SILVERARMOR;

public static EnumArmorMaterial GEMSTONEARMOR;

   

    public static void initModEnumMaterial()

    {

COPPER = EnumHelper.addToolMaterial("COPPER", 2, 200, 4.0f, 5, 15);

SILVER = EnumHelper.addToolMaterial("SILVER", 2, 400, 5.0f, 6, 18);

GEMSTONE = EnumHelper.addToolMaterial("GEMSTONE", 2, 1500, 7.0f, 8, 22);

 

COPPERARMOR = EnumHelper.addArmorMaterial("COPPERARMOR", 12, new int[]{2, 5, 4, 1}, 12);

SILVERARMOR = EnumHelper.addArmorMaterial("SILVERARMOR", 18, new int[]{3, 7, 5, 2}, 12);

GEMSTONEARMOR = EnumHelper.addArmorMaterial("GEMSTONEARMOR", 30, new int[]{3, 8, 6, 3}, 25);

    }

}

Link to comment
Share on other sites

Ahh I see, I think you just have to rename 'public static void initModEnumMaterial()' to 'public ModEnumMaterial()' since I think the reason that it crashes is that initModEnumMaterial() not gets called before there's a call to the ModItems class cousing it to not get assigned and couse a null pointer exception. Try it :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.