Hello, I'm trying to make a mod in forge 1.7.10, and most of my crafting recipes work, but one recipe, in particular, causes the game to crash when I place the items in the appropriate slots in the crafting table. If anyone knows what's wrong I'd be very appreciative, thanks.
java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)
at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)
-- Item being rendered --
Details:
Item Type: null
Item Aux: ~~ERROR~~ NullPointerException: null
Item NBT: null
Item Foil: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
package com.phoenixkahlo.metallurgy.blocks;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
public class BlockManager {
public static final Block FIRE_PIT = new FirePit();
public static void preInit() {
GameRegistry.registerBlock(FIRE_PIT, "FirePit");
}
}
The problematic block:
package com.phoenixkahlo.metallurgy.blocks;
import com.phoenixkahlo.metallurgy.Metallurgy;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
public class FirePit extends Block {
public final String NAME = "fire_pit";
public FirePit() {
super(Material.rock);
setBlockName(Metallurgy.MODID + "_" + NAME);
setHardness(3.5F);
setStepSound(soundTypePiston);
setCreativeTab(CreativeTabs.tabDecorations);
}
}
The problem, according to the crash report, has to do with rendering your item (or your block as an item).
Specifically it's trying to get the item "damage" (could be metadata or tool durability -- probably metadata since it's a block).
Do you set the texture anywhere? Normally that wouldn't cause a crash, just the missing texture icon, but you should have "setBlockTextureName(resourcelocation)" somewhere in the constructor.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
What happens when you try to get the block from the creative tab? Or when you place it? If something breaks there too, it might not be a problem with the crafting init.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
You're adding a recipe for an ItemStack with a nullItem because your recipes are being added before your Items/Blocks are initialised.
This is happening because both your preInit and init methods are handling the same event: FMLInitializationEvent. preInit should be handling FMLPreInitializationEvent.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You're adding a recipe for an ItemStack with a nullItem because your recipes are being added before your Items/Blocks are initialised.
This is happening because both your preInit and init methods are handling the same event: FMLInitializationEvent. preInit should be handling FMLPreInitializationEvent.
Good catch, I looked over the code for ages and didn't notice that. Yep nano1000, there's the answer: preInit should be handling FMLPreInitializationEvent.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
You're adding a recipe for an ItemStack with a nullItem because your recipes are being added before your Items/Blocks are initialised.
This is happening because both your preInit and init methods are handling the same event: FMLInitializationEvent. preInit should be handling FMLPreInitializationEvent.
Hello, I'm trying to make a mod in forge 1.7.10, and most of my crafting recipes work, but one recipe, in particular, causes the game to crash when I place the items in the appropriate slots in the crafting table. If anyone knows what's wrong I'd be very appreciative, thanks.
my crash report:
---- Minecraft Crash Report ----
// My bad.
Time: 11/30/15 10:48 PM
Description: Rendering item
java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)
at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:265)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:419)
-- Item being rendered --
Details:
Item Type: null
Item Aux: ~~ERROR~~ NullPointerException: null
Item NBT: null
Item Foil: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:289)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
-- Screen render details --
Details:
Screen name: net.minecraft.client.gui.inventory.GuiCrafting
Mouse location: Scaled: (206, 86). Absolute: (413, 307)
Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player675'/243, l='MpServer', x=-4.90, y=78.62, z=484.71]]
Chunk stats: MultiplayerChunkCache: 375, 375
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (-79,64,256), Chunk: (at 1,4,0 in -5,16; contains blocks -80,0,256 to -65,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 65941 game time, 10964 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 101 total; [EntityZombie['Zombie'/256, l='MpServer', x=32.41, y=36.14, z=531.74], EntityPig['Pig'/257, l='MpServer', x=-61.47, y=63.00, z=480.59], EntityZombie['Zombie'/260, l='MpServer', x=43.31, y=26.00, z=491.53], EntitySkeleton['Skeleton'/263, l='MpServer', x=-9.41, y=58.00, z=532.50], EntityCreeper['Creeper'/265, l='MpServer', x=-1.63, y=61.00, z=530.03], EntityCow['Cow'/267, l='MpServer', x=-2.84, y=77.00, z=532.03], EntityCow['Cow'/272, l='MpServer', x=-63.34, y=71.00, z=507.63], EntityCow['Cow'/274, l='MpServer', x=-63.09, y=71.00, z=505.84], EntityCreeper['Creeper'/277, l='MpServer', x=47.53, y=56.00, z=472.34], EntityZombie['Zombie'/278, l='MpServer', x=43.31, y=59.00, z=473.69], EntitySkeleton['Skeleton'/279, l='MpServer', x=44.75, y=58.00, z=473.22], EntityZombie['Zombie'/280, l='MpServer', x=37.63, y=58.00, z=467.22], EntityZombie['Zombie'/281, l='MpServer', x=34.39, y=46.08, z=504.31], EntitySheep['Sheep'/282, l='MpServer', x=5.53, y=73.99, z=532.47], EntitySheep['Sheep'/283, l='MpServer', x=4.44, y=73.76, z=532.50], EntitySheep['Sheep'/284, l='MpServer', x=10.74, y=86.00, z=537.50], EntityCow['Cow'/285, l='MpServer', x=-62.19, y=72.00, z=515.53], EntityBat['Bat'/286, l='MpServer', x=43.75, y=28.10, z=523.25], EntityCreeper['Creeper'/287, l='MpServer', x=34.69, y=38.00, z=522.46], EntitySpider['Spider'/288, l='MpServer', x=26.63, y=38.00, z=521.44], EntitySkeleton['Skeleton'/289, l='MpServer', x=53.50, y=48.00, z=492.50], EntityCow['Cow'/290, l='MpServer', x=-66.47, y=70.00, z=504.66], EntityPig['Pig'/291, l='MpServer', x=-77.81, y=63.00, z=477.50], EntityBat['Bat'/292, l='MpServer', x=57.66, y=15.98, z=478.34], EntityBat['Bat'/293, l='MpServer', x=57.78, y=16.04, z=473.44], EntityBat['Bat'/294, l='MpServer', x=62.75, y=20.54, z=473.03], EntitySkeleton['Skeleton'/295, l='MpServer', x=63.14, y=61.00, z=478.71], EntitySkeleton['Skeleton'/296, l='MpServer', x=54.34, y=62.00, z=473.31], EntitySkeleton['Skeleton'/297, l='MpServer', x=53.31, y=62.00, z=473.53], EntityCreeper['Creeper'/298, l='MpServer', x=54.16, y=62.00, z=474.13], EntityCreeper['Creeper'/299, l='MpServer', x=62.52, y=61.00, z=479.69], EntityZombie['Zombie'/300, l='MpServer', x=53.72, y=62.00, z=475.28], EntitySkeleton['Skeleton'/301, l='MpServer', x=55.13, y=62.00, z=477.56], EntitySkeleton['Skeleton'/302, l='MpServer', x=58.97, y=62.00, z=477.91], EntityCreeper['Creeper'/303, l='MpServer', x=52.50, y=52.60, z=470.49], EntityZombie['Zombie'/304, l='MpServer', x=-60.47, y=19.00, z=536.41], EntitySkeleton['Skeleton'/305, l='MpServer', x=44.13, y=16.00, z=536.09], EntitySkeleton['Skeleton'/306, l='MpServer', x=42.78, y=16.00, z=536.22], EntitySkeleton['Skeleton'/307, l='MpServer', x=39.31, y=15.00, z=533.53], EntityZombie['Zombie'/308, l='MpServer', x=39.72, y=37.00, z=534.38], EntityZombie['Zombie'/309, l='MpServer', x=37.53, y=33.00, z=534.31], EntityZombie['Zombie'/310, l='MpServer', x=33.13, y=39.00, z=528.41], EntityZombie['Zombie'/311, l='MpServer', x=33.38, y=35.00, z=533.69], EntityCow['Cow'/312, l='MpServer', x=47.69, y=76.00, z=533.78], EntityZombie['Zombie'/313, l='MpServer', x=-46.31, y=15.00, z=550.16], EntityZombie['Zombie'/314, l='MpServer', x=-46.59, y=22.00, z=545.38], EntityZombie['Zombie'/315, l='MpServer', x=52.49, y=29.00, z=525.51], EntitySkeleton['Skeleton'/316, l='MpServer', x=52.50, y=29.00, z=526.50], EntityZombie['Zombie'/317, l='MpServer', x=50.44, y=28.00, z=525.28], EntitySheep['Sheep'/318, l='MpServer', x=58.66, y=90.00, z=522.50], EntitySheep['Sheep'/319, l='MpServer', x=59.47, y=95.00, z=513.81], EntityCow['Cow'/320, l='MpServer', x=56.34, y=90.08, z=521.54], EntityCow['Cow'/321, l='MpServer', x=61.25, y=92.00, z=522.47], EntitySheep['Sheep'/322, l='MpServer', x=58.44, y=94.00, z=516.34], EntitySheep['Sheep'/323, l='MpServer', x=61.09, y=98.00, z=513.94], EntityBat['Bat'/324, l='MpServer', x=21.06, y=39.42, z=540.06], EntityBat['Bat'/325, l='MpServer', x=26.53, y=40.48, z=548.47], EntityEnderman['Enderman'/327, l='MpServer', x=55.34, y=30.00, z=540.81], EntityZombie['Zombie'/328, l='MpServer', x=51.56, y=31.00, z=529.84], EntitySkeleton['Skeleton'/329, l='MpServer', x=52.50, y=29.00, z=528.50], EntityCow['Cow'/334, l='MpServer', x=64.50, y=96.00, z=522.50], EntityZombie['Zombie'/335, l='MpServer', x=-69.55, y=20.35, z=544.31], EntityChicken['Chicken'/336, l='MpServer', x=-69.53, y=20.00, z=544.41], EntityZombie['Zombie'/337, l='MpServer', x=60.34, y=31.00, z=544.94], EntityZombie['Zombie'/338, l='MpServer', x=51.78, y=35.00, z=558.16], EntityZombie['Zombie'/136, l='MpServer', x=-16.13, y=11.00, z=408.28], EntityPig['Pig'/138, l='MpServer', x=-29.53, y=71.98, z=406.50], EntityPig['Pig'/139, l='MpServer', x=-16.13, y=67.00, z=420.84], EntityCreeper['Creeper'/140, l='MpServer', x=-24.97, y=14.00, z=456.41], EntityCreeper['Creeper'/154, l='MpServer', x=-14.56, y=11.00, z=408.63], EntityPig['Pig'/155, l='MpServer', x=-15.88, y=67.00, z=426.03], EntityPig['Pig'/156, l='MpServer', x=-11.50, y=70.00, z=445.84], EntityCreeper['Creeper'/165, l='MpServer', x=5.47, y=47.00, z=457.07], EntityCreeper['Creeper'/166, l='MpServer', x=9.94, y=48.00, z=454.44], EntityCreeper['Creeper'/167, l='MpServer', x=9.69, y=48.00, z=453.31], EntitySpider['Spider'/168, l='MpServer', x=12.53, y=50.00, z=453.28], EntitySkeleton['Skeleton'/169, l='MpServer', x=7.97, y=49.00, z=452.56], EntitySkeleton['Skeleton'/170, l='MpServer', x=11.34, y=49.00, z=455.22], EntitySkeleton['Skeleton'/178, l='MpServer', x=23.78, y=44.00, z=464.89], EntitySpider['Spider'/179, l='MpServer', x=21.25, y=35.00, z=457.25], EntitySpider['Spider'/180, l='MpServer', x=31.28, y=62.00, z=451.28], EntityCreeper['Creeper'/181, l='MpServer', x=20.00, y=50.00, z=453.53], EntitySpider['Spider'/193, l='MpServer', x=41.90, y=65.00, z=442.64], EntityZombie['Zombie'/194, l='MpServer', x=38.20, y=16.00, z=460.73], EntitySpider['Spider'/195, l='MpServer', x=33.27, y=67.69, z=460.65], EntityCreeper['Creeper'/214, l='MpServer', x=52.97, y=31.00, z=413.44], EntityWitch['Witch'/215, l='MpServer', x=55.05, y=14.00, z=443.78], EntityWitch['Witch'/216, l='MpServer', x=52.13, y=16.00, z=436.47], EntityCreeper['Creeper'/217, l='MpServer', x=53.03, y=42.00, z=452.66], EntityBat['Bat'/225, l='MpServer', x=67.72, y=22.10, z=407.16], EntityCreeper['Creeper'/244, l='MpServer', x=-3.41, y=17.00, z=494.00], EntityBat['Bat'/245, l='MpServer', x=-20.59, y=20.39, z=482.50], EntityClientPlayerMP['Player675'/243, l='MpServer', x=-4.90, y=78.62, z=484.71], EntitySkeleton['Skeleton'/247, l='MpServer', x=-6.47, y=21.00, z=497.50], EntityCreeper['Creeper'/248, l='MpServer', x=6.44, y=44.00, z=469.00], EntityCow['Cow'/249, l='MpServer', x=-8.68, y=103.08, z=517.50], EntityCow['Cow'/250, l='MpServer', x=-1.47, y=102.00, z=520.31], EntityCow['Cow'/251, l='MpServer', x=-0.91, y=97.00, z=527.88], EntitySheep['Sheep'/252, l='MpServer', x=3.19, y=98.00, z=527.69], EntitySkeleton['Skeleton'/254, l='MpServer', x=26.31, y=38.00, z=522.88], EntitySpider['Spider'/255, l='MpServer', x=28.63, y=38.00, z=519.72]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_65, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 733400600 bytes (699 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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: 12, tallocated: 94
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 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
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA metallurgy{1.0.0} [metallurgy] (bin)
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 347.52' Renderer: 'GeForce GTX 970/PCIe/SSE2'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GTX 970/PCIe/SSE2 GL version 4.5.0 NVIDIA 347.52, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
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: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
My main class:
The recipe adder class:
The block manager class:
The problematic block:
The problem, according to the crash report, has to do with rendering your item (or your block as an item).
Specifically it's trying to get the item "damage" (could be metadata or tool durability -- probably metadata since it's a block).
Do you set the texture anywhere? Normally that wouldn't cause a crash, just the missing texture icon, but you should have "setBlockTextureName(resourcelocation)" somewhere in the constructor.
I'm didn't do that because I plan to use a tile entity to give it a custom techne model later, but I did try that and it had no effect
What happens when you try to get the block from the creative tab? Or when you place it? If something breaks there too, it might not be a problem with the crafting init.
You're adding a recipe for an ItemStack with a null Item because your recipes are being added before your Items/Blocks are initialised.
This is happening because both your preInit and init methods are handling the same event: FMLInitializationEvent. preInit should be handling FMLPreInitializationEvent.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Good catch, I looked over the code for ages and didn't notice that. Yep nano1000, there's the answer: preInit should be handling FMLPreInitializationEvent.
Ah, thank you, that'd do it!