Jump to content

[1.10.2] [forge-1.10.2-12.18.1.2048-mdk] java.lang.NullPointerException: Initial


mattyixiriva

Recommended Posts

I'm getting a random crash and can't decipher it...

 

FoxTech.java

 

 

package com.matthewrivas.foxtech;

import com.matthewrivas.foxtech.init.FT_Blocks;
import com.matthewrivas.foxtech.init.FT_Crafting;
import com.matthewrivas.foxtech.init.FT_Items;
import com.matthewrivas.foxtech.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSION)
public class FoxTech
{
//INSTANCE//
@Instance
public static FoxTech instance;

//SIDEDPROXY//
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

    //PRE-INIT//
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    	FT_Items.init();
	FT_Items.register();

	FT_Blocks.init();
	FT_Blocks.register();
    }
    
    //INIT//
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	proxy.init();
    	
    	FT_Crafting.register();
    }
    
    //POST-INIT//
    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    	
    }
    
    
}

 

 

 

Reference.java

 

 

package com.matthewrivas.foxtech;

public class Reference 
{
public static final String MOD_ID = "foxtech";
public static final String NAME = "FoxTech";
public static final String VERSION = "1.0";
public static final String ACCEPTED_VERSION = "[1.10.2]";

public static final String CLIENT_PROXY_CLASS = "com.matthewrivas.foxtech.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.matthewrivas.foxtech.proxy.ServerProxy";


public static enum FoxTechItems
{
//EXAMPLE("example", "ItemExample"),//


private String unlocalizedName;
private String registryName;

FoxTechItems(String unlocalizedName, String registryName)
{
this.unlocalizedName = unlocalizedName;
this.registryName = registryName;
}

public String getUnlocalizedName() 
{
return unlocalizedName;
}

public String getRegistryName() 
{
return registryName;
}
}

public static enum FoxTechBlocks
{
//EXAMPLE("example", "BlockExample"),//
FT_ELECFURN("ft_elecfurn", "BlockFT_ElecFurn");

private String unlocalizedName;
private String registryName;

FoxTechBlocks(String unlocalizedName, String registryName)
{
this.unlocalizedName = unlocalizedName;
this.registryName = registryName;
}

public String getUnlocalizedName() 
{
return unlocalizedName;
}

public String getRegistryName() 
{
return registryName;
}

}
}

 

 

FT_Blocks.java

 

package com.matthewrivas.foxtech.init;

import com.matthewrivas.foxtech.blocks.BlockFT_ElecFurn;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class FT_Blocks 
{
//public static Block example;//
public static Block ft_elecfurn;

public static void init()
{
	//example = new BlockExample();//
	ft_elecfurn = new BlockFT_ElecFurn();
}

public static void register()
{
	//registerBlock(example);//
	registerBlock(ft_elecfurn);
}

private static void registerBlock(Block block)
{
	GameRegistry.register(block);
	ItemBlock item = new ItemBlock(block);
	item.setRegistryName(block.getRegistryName());
	GameRegistry.register(item);
}

public static void registerRenders()
{
	//registerRender(example);//
	registerRender(ft_elecfurn);
}

private static void registerRender(Block block)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
}

 

 

BlockFT_ElecFurn.java

 

 

package com.matthewrivas.foxtech.blocks;

import com.matthewrivas.foxtech.Reference;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class BlockFT_ElecFurn extends Block 
{
public BlockFT_ElecFurn()
{
super(Material.IRON);
setUnlocalizedName(Reference.FoxTechBlocks.FT_ELECFURN.getUnlocalizedName());
setRegistryName(Reference.FoxTechBlocks.FT_ELECFURN.getRegistryName());
setHardness(2.0F);
}
}

 

 

CRASHLOG

 

 

---- Minecraft Crash Report ----
// Would you like a cupcake?

Time: 8/9/16 1:12 AM
Description: Initializing game

java.lang.NullPointerException: Initializing game
at com.matthewrivas.foxtech.blocks.BlockFT_ElecFurn.<init>(BlockFT_ElecFurn.java:13)
at com.matthewrivas.foxtech.init.FT_Blocks.init(FT_Blocks.java:20)
at com.matthewrivas.foxtech.FoxTech.preInit(FoxTech.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


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

-- Head --
Thread: Client thread
Stacktrace:
at com.matthewrivas.foxtech.blocks.BlockFT_ElecFurn.<init>(BlockFT_ElecFurn.java:13)
at com.matthewrivas.foxtech.init.FT_Blocks.init(FT_Blocks.java:20)
at com.matthewrivas.foxtech.FoxTech.preInit(FoxTech.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:607)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.10.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_101, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 817727424 bytes (779 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.32 Powered by Forge 12.18.1.2048 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2048.jar) 
UCH Forge{12.18.1.2048} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2048.jar) 
UCE foxtech{1.0} [§6FoxTech] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 368.81' Renderer: 'GeForce GTX 750/PCIe/SSE2'
Launched Version: 1.10.2
LWJGL: 2.9.4
OpenGL: GeForce GTX 750/PCIe/SSE2 GL version 4.5.0 NVIDIA 368.81, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 2x Intel(R) Pentium(R) CPU G2020 @ 2.90GHz

 

 

 

So...yeah that's what's up.... I have no errors in Eclipse... :I

 

...

width=240 height=240http://i.imgur.com/C2FlJXb.png[/img]

 

 

Hey! o/

Link to comment
Share on other sites

SOLVED!!

I was running the item "public static enum FoxTechItems" when there was no item classes available.

 

public static enum FoxTechItems
{
//EXAMPLE("example", "ItemExample"),//


private String unlocalizedName;
private String registryName;

FoxTechItems(String unlocalizedName, String registryName)
{
this.unlocalizedName = unlocalizedName;
this.registryName = registryName;
}

public String getUnlocalizedName() 
{
return unlocalizedName;
}

public String getRegistryName() 
{
return registryName;
}
}

width=240 height=240http://i.imgur.com/C2FlJXb.png[/img]

 

 

Hey! o/

Link to comment
Share on other sites

Question: why isn't your unlocalized name also the registry name?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Announcements



×
×
  • Create New...

Important Information

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