Jump to content

Recommended Posts

Posted

When I try to run my mod it crashes, I'm not 100% sure why but apparently it has got to do with registerIcons for my items and blocks. I have removed everything that had anything to do with icons, such as 'registerIcons'.

Here's the crash report:

---- Minecraft Crash Report ----

// You should try our sister game, Minceraft!

 

Time: 3/04/14 9:09 PM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

  at net.minecraft.item.ItemBlock.getSpriteNumber(ItemBlock.java:42)

  at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)

  at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:59)

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

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

  at net.minecraft.client.main.Main.main(Main.java:112)

  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:134)

  at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

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

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

 

-- Head --

Stacktrace:

  at net.minecraft.item.ItemBlock.getSpriteNumber(ItemBlock.java:42)

  at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)

  at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:59)

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

 

-- Initialization --

Details:

Stacktrace:

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

  at net.minecraft.client.main.Main.main(Main.java:112)

  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:134)

  at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

  Minecraft Version: 1.7.2

  Operating System: Windows 7 (x86) version 6.1

  Java Version: 1.7.0_05, Oracle Corporation

  Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

  Memory: 879952984 bytes (839 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)

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

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

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

  FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active

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

  FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized

  Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized

  DartStriker_BioniCraft{1.0.0} [bioniCraft] (bin) Unloaded->Constructed->Pre-initialized

  Launched Version: 1.6

  LWJGL: 2.9.0

  OpenGL: Intel® HD Graphics Family GL version 3.1.0 - Build 8.15.10.2462, Intel

  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)

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

  Anisotropic Filtering: Off (1)

Modify message

 

Posted

If you try to register Icons in your custom ItemBlock class, you will get this crash. ItemBlocks should not register textures, since they use the Block rendering - i.e. whatever icons you register in your block will be used for the item. If you register icons in the ItemBlock, it attempts to register them to the Item sprite sheet, crashing your game when it tries to render because it is expecting the Terrain (block) sprite sheet. At least that's what seems to happen everytime someone registers an Icon.

 

Here is the code from vanilla ItemBlock#registerIcons:

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
// note that Block#getItemIconName() returns null for all blocks except Hoppers
// so only hoppers will register an icon here (according to java-docs)
     String s = Block.blocksList[this.blockID].getItemIconName();

     if (s != null)
     {
         this.field_94588_b = par1IconRegister.registerIcon(s);
     }
}

Posted

Okay I went through all my block classes and none of them have field_150939_a .

And as for the code you gave me, it doesn't seem to work with 1.7.2...

If you read my post, you will see that the code is from vanilla ItemBlock, not Block, and I was not suggesting you use that code, it was merely demonstrating that ItemBlocks do not register icons, with one sole exception. Whether that sole exception is hard-coded other places, such as getting sprite sheets, I am not sure, but if you crash when registering an icon in an ItemBlock class, then it seems quite likely.

 

Did you try removing the registerIcons method from your ItemBlock classes, like I implicitly suggested?

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.