Jump to content

Recommended Posts

Posted

I just started recoding my mod to forge, but at the first test install, i got a NullPointerException on login using MultiMC

crash report:

 

 

- Minecraft Version: 1.3.2
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 455069248 bytes (433 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
- JVM Flags: 2 total; -Xmx1024m -Xms512m
- LWJGL: 2.8.3
- OpenGL: Intel(R) G45/G43 Express Chipset GL version 2.1.0 - Build 8.15.10.2555, Intel
- Is Modded: Definitely; 'forge,fml'
- Type: Client
- Texture Pack: Default
- Profiler Position: N/A (disabled)

java.lang.NullPointerException
at cpw.mods.fml.common.FMLModContainer.getName(FMLModContainer.java:105)
at cpw.mods.fml.common.Loader.sortModList(Loader.java:236)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:416)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:192)
at net.minecraft.client.Minecraft.a(Minecraft.java:402)
at net.minecraft.client.Minecraft.run(Minecraft.java:734)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT c6e8f06b ----------

 

 

 

I am using forge #193

 

here is the the source:

 

 

Trapped Cake.java

package nb.cake;

import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.logging.Level;
import net.minecraft.src.Block;
import net.minecraftforge.common.Configuration;
import net.minecraft.src.ItemStack;




@Mod(modid = "trappedcake", name = "Trapped Cakes", version = "0.1")
public class TrappedCake {
    
    public static BlockExplodingCake explodingCake;
    private int id1;
    
    @PreInit
    public void configure(FMLPreInitializationEvent event) {
        event.getModMetadata().version = "0.1";
        Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
        try {
            cfg.load();
            id1 = cfg.getOrCreateBlockIdProperty("explodingCake", 255).getInt(255);
        } catch(Exception e) {
            FMLLog.log(Level.SEVERE, e, "Trapped Cakes could not load it's configuration.");
        } finally {
            cfg.save();
        }
        
    }
    
    @Init
    public void load() {
        explodingCake = new BlockExplodingCake(id1);
        GameRegistry.registerBlock(explodingCake);
        LanguageRegistry.instance().addStringLocalization("explodingCake.name", "Exploding Cake");
        GameRegistry.addShapelessRecipe(new ItemStack(explodingCake, 1), new Object[] {Block.cake, Block.tnt});
        
    }
    
}

BlockExplodingCake.java

package nb.cake;

import net.minecraft.src.BlockCake;
import net.minecraft.src.World;
import net.minecraft.src.EntityPlayer;
import java.util.ArrayList;
import net.minecraft.src.ItemStack;

public class BlockExplodingCake extends BlockCake {
    
    public BlockExplodingCake(int id) {
        super(id, 121);
        setHardness(0.5F);
        setStepSound(soundClothFootstep);
        setBlockName("explodingCake");
        disableStats();
        setRequiresSelfNotify();
    }

    @Override
    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
        //explosion code here
        return true;
    }

    @Override
    public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {
        // explosion code here
    }
    
    @Override
    public void addCreativeItems(ArrayList itemlist) {
        itemlist.add(new ItemStack(this));
    }
    
}

 

 

 

I am not sure where the error is...

Posted

If you ever post errors, post the log files, not just what you get. Sometimes FML doesnt print the "real" crash report.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

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.

Announcements



×
×
  • Create New...

Important Information

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