Posted April 5, 20169 yr What I'm doing during the FMLInitializationEvent: GameRegistry.addSmelting(BlockInit.tenebraeOre, new ItemStack(ItemInit.tenebraeChunk), 0.5F); What happens when I join a world: java.lang.NullPointerException at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:281) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.compareItemStacks(FurnaceRecipes.java:114) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.getSmeltingResult(FurnaceRecipes.java:100) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmeltingRecipe(FurnaceRecipes.java:88) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmelting(FurnaceRecipes.java:80) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraft.item.crafting.FurnaceRecipes.addSmeltingRecipeForBlock(FurnaceRecipes.java:72) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] at net.minecraftforge.fml.common.registry.GameRegistry.addSmelting(GameRegistry.java:225) ~[forgeSrc-1.9-12.16.0.1832-1.9.jar:?] Any reason for this? I think it has something to do with TenebraeOre not having an Item version but it shouldn't need one, and I can't see any vanilla ore having an item version.
April 5, 20169 yr Vanilla ores do have item versions, that's how you hold them in inventory after breaking them (perhaps with silk-touch). As with most blocks, their items are derived automatically, so they're hard to find in the code. Read down toward the long list of item instances in the Item class, and you''ll see lines such as: registerItemBlock(Blocks.gold_ore); registerItemBlock(Blocks.iron_ore); registerItemBlock(Blocks.coal_ore); I suspect that you've got a cart before a horse somewhere. We need to see more of your code, like where/when are your inits called to populate the fields you're using in the one line you showed us? If you're using a field before you set it, then that would explain your NPE. PS: What does "chunk" mean in your statement? Chunk has a special meaning in Minecraft coding, so I suggest avoiding it. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.