Jump to content

Recommended Posts

Posted

Hey guys!

 

A couple days ago i've started to look into forge modding with eclipse and everything has been working fine so far.

But now there appeared a problem, i am not able to solve.. even hours of searching forums didn't bring the solution...

 

So i added some recipes and items and i can even craft my own items without any problems.

Then i added a Block (RedBrick), also a recipe for it, but when i tried to craft this Block (RedBrick) ingame, the game crashes when i put the last required item into the crafting table... (i can take the Red Brick from the creative menue and i can place and destroy it...only craftig does not work)

 

So here's my error message:

 

---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!

Time: 19.05.14 14:28
Description: Rendering item

java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:214)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:398)
at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:540)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:269)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:99)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1061)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:944)
at net.minecraft.client.Minecraft.run(Minecraft.java:835)
at net.minecraft.client.main.Main.main(SourceFile:103)
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.ItemStack.getItemDamage(ItemStack.java:214)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:398)

-- 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:540)
at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:269)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:99)

-- Screen render details --
Details:
Screen name: net.minecraft.client.gui.inventory.GuiCrafting
Mouse location: Scaled: (182, 99). Absolute: (365, 281)
Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player46'/321, l='MpServer', x=-23,12, y=105,62, z=153,92]]
Chunk stats: MultiplayerChunkCache: 225, 225
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (80,64,256), Chunk: (at 0,4,0 in 5,16; contains blocks 80,0,256 to 95,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 53190 game time, 12331 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: 114 total; [removed them to shorten the text]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:368)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2382)
at net.minecraft.client.Minecraft.run(Minecraft.java:857)
at net.minecraft.client.main.Main.main(SourceFile:103)
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 8.1 (amd64) version 6.3
Java Version: 1.8.0_05, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 768760736 bytes (733 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 16134 (903504 bytes; 0 MB) allocated, 1648 (92288 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.03 FML v7.2.196.1082 Minecraft Forge 10.12.1.1082 4 mods loaded, 4 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.196.1082} [Forge Mod Loader] (forgeBin-1.7.2-10.12.1.1082.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.1.1082} [Minecraft Forge] (forgeBin-1.7.2-10.12.1.1082.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
testmod{1.0} [TestMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 6800 Series GL version 4.3.12618 Compatibility Profile Context 13.251.0.0, ATI Technologies Inc.
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: 1483 (83048 bytes; 0 MB) allocated, 400 (22400 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Tim\Desktop\TestMod\testmod\eclipse\.\crash-reports\crash-2014-05-19_14.28.50-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

My main class:

package com.shibby.testmod;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;

import com.shibby.testmod.blocks.BlockLamp;
import com.shibby.testmod.blocks.RedBrick;
import com.shibby.testmod.food.FoodCherry;
import com.shibby.testmod.items.Brush;
import com.shibby.testmod.items.ObsidianStick;
import com.shibby.testmod.items.PaintBucket;
import com.shibby.testmod.items.ShibBed;
import com.shibby.testmod.proxy.ProxyCommon;
import com.shibby.testmod.tools.EmeraldSword;
import com.shibby.testmod.tools.ObsidianHammer;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = TestMod.MODID, version = TestMod.VERSION)
public class TestMod
{
public static final String MODID = "testmod";
public static final String VERSION = "1.0";

@Instance(value = MODID)
public static TestMod instance;

    @SidedProxy(clientSide = "com.shibby.testmod.proxy.ProxyClient", serverSide = "com.shibby.testmod.proxy.ProxyCommon")
    public static ProxyCommon proxy;
    
    //-------------------Proxy
    @EventHandler
    public void load(FMLInitializationEvent event)
    {
    	proxy.registerRenderers();
    }
    
    
    
    //----------------REGISTRIERUNG-----------------------------------------------------------------   
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	//Login Message
    	
    	
    	
    	//Rezepte
       	GameRegistry.addShapelessRecipe(new ItemStack(Items.painting, 2), Blocks.wool, Items.book);
       	GameRegistry.addShapedRecipe(new ItemStack(ObsidianHammer), "XXX", " Y ", " Y ", 'X', Blocks.obsidian, 'Y', ObsidianStick); 
       	GameRegistry.addShapedRecipe(new ItemStack(EmeraldSword), " Y ", " Y ", " X ", 'X', ObsidianStick, 'Y', Blocks.emerald_block);
       	GameRegistry.addShapedRecipe(new ItemStack(ObsidianStick, 3), "XXX", "XXX", "XXX", 'X', Blocks.obsidian);
        GameRegistry.addShapelessRecipe(new ItemStack(RedBrick), Blocks.obsidian, Items.book);
       
       	//Blöcke
       	GameRegistry.registerBlock(Lamp, "Shibby's Lampe");
       	GameRegistry.registerBlock(RedBrick, "Roter Pflasterstein");
       
       	//Tools
       	GameRegistry.registerItem(EmeraldSword, "Shibby's Emerald Schwert");
       	GameRegistry.registerItem(ObsidianHammer, "Shibby's Megahammer");
       	
       	//Items
       	GameRegistry.registerItem(ObsidianStick, "Obsidian Stick");
       	GameRegistry.registerItem(ShibBed, "ShibBed");
       	GameRegistry.registerItem(PaintBucket, "Eimer mit roter Farbe");
       	GameRegistry.registerItem(Brush, "Pinsel");
       	
       	//Food
       	GameRegistry.registerItem(Cherry, "Kirschdingsda");
       	
      
        //CreativeTabs Language
    	LanguageRegistry.instance().addStringLocalization("itemGroup.tabTest", "en_us", "Shibby's TestMod Items");
    	LanguageRegistry.instance().addStringLocalization("itemGroup.shibbyTest", "en_us", "Shibby's TestMod Blöcke");
    	
    	//Item Language
    	LanguageRegistry.addName(Lamp, "Shibby's Lampe");
    	LanguageRegistry.addName(ObsidianStick, "Obsidian Stick");
    	LanguageRegistry.addName(ShibBed, "ShibBed");
    	LanguageRegistry.addName(RedBrick, "Roter Pflasterstein");
    	LanguageRegistry.addName(PaintBucket, "Eimer mit roter Farbe");
    	LanguageRegistry.addName(Brush, "Pinsel");
    	
    	//Tool Language
    	LanguageRegistry.addName(EmeraldSword, "Shibby's Emerald Schwert");
    	LanguageRegistry.addName(ObsidianHammer, "Shibby's Megahammer");
    
    	
    	//Food Language
    	LanguageRegistry.addName(Cherry, "Kirschdigsda");
    	
    	
    }
    
    
    
    
//-------------------------------------------Verschiedenes------------------------------------------    
    
    
   
    
    //----------CreativeTabs
    public static CreativeTabs tabItem = new CreativeTabs("tabTest"){
    	public Item getTabIconItem(){
    		return new Item();
    	
    	}
    };
    
    public static CreativeTabs tabBlock = new CreativeTabs("shibbyTest"){
    public Item getTabIconItem(){
    	return new Item();
        }
    
    };
  //----------------------------------------------DINGE ADDEN----------------------------------------  
  //Blöcke adden
    public static final Block Lamp = new BlockLamp(5000, Material.glass);
    public static final Block RedBrick = new RedBrick(5006, Material.rock);
      
  //Tool Material adden
    public static ToolMaterial emeraldm = EnumHelper.addToolMaterial("EmeraldM", 5, 2000, 10.0F, 96.0F, 22); 
    public static ToolMaterial obsidianm = EnumHelper.addToolMaterial("ObsidianM", 20, 2000, 125.0F, 10.0F, 22); 
        
  //Tools adden
    public final static Item EmeraldSword = new EmeraldSword(5001, emeraldm);
    public final static Item ObsidianHammer = new ObsidianHammer(5003, obsidianm);
    
  //Items adden
    public static Item ObsidianStick = new ObsidianStick(5002);
    public static Item ShibBed = new ShibBed(5004);
    public static Item PaintBucket = new PaintBucket(5033);
    public static Item Brush = new Brush(5034);
    
  //Food adden
    public static Item Cherry = new FoodCherry(5005, 16, true);

}

 

 

And the Block (RedBrick) class:

 

package com.shibby.testmod.blocks;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

public class RedBrick extends Block {

public RedBrick(int i, Material rock) {
	super(rock);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setHardness(4f);
	this.setResistance(5f);
	this.setBlockName("RedBrick");
	this.setBlockTextureName("testmod:redbrick");
}

}	

 

 

I would really appreciate your help, since i have no idea how to solve it :(

 

Thanks in advance!!

 

Regards

 

(Please don't blame me if it's an obvious error, i am a bloody beginner :P )

Posted

When you're registering the crafting recipes, the items are not registered. Register the items in a preInit() method, then the crafting recipes. Something like this:

 

public void preInit(FMLPreInitializationEvent event) {
    GameRegistry.registerBlock(BLOCK, "block.testBlock");
    // Other items
    GameRegisrey.addShapelessRecipe(OUTPUT, INPUTS...);
    // Other recipes
}

 

You can register the recipes in the init() method, if you like.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Posted

Hey, thank you for the fast response!

 

It works now without crashes!

 

Here's my new code for anyone else with this problem:

 

@EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	//Blocks
    	GameRegistry.registerBlock(RedBrick, "Roter Pflasterstein");
    	
    	//Blocks Language
    	LanguageRegistry.addName(RedBrick, "Roter Pflasterstein");
           	
    }

@EventHandler
    public void init(FMLInitializationEvent event)
    {
       GameRegistry.addShapelessRecipe(new ItemStack(RedBrick, 2), Blocks.wool, Items.book);
    }

 

 

 

Appreciate your help :)

Thanks again

  • 2 months later...
Posted

i got the same thing but insted i got it when i put in GameRegistry.registerWorldGenerator(eventWorldGen, 0); hear is my worldGen

package net.vampirecraft.mod.worldgen;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import net.vampirecraft.mod.Vampirecraft;

import cpw.mods.fml.common.IWorldGenerator;

 

public class VampirecraftWorldGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId) {

case 0 :

        //Generate our surface world

generateSurface(world, random, chunkX*16, chunkZ*16);

 

case -1 :

        //Generate our surface world

generateNether(world, random, chunkX*16, chunkZ*16);

 

case 1 :

        //Generate our surface world

generateEnd(world, random, chunkX*16, chunkZ*16);

}

 

}

 

private void generateSurface(World world, Random random, int x, int z) {

//this.addOreSpawn(Vampirecraft.oreVampiric, world, random, i=blockXPos, j=blockZpos, maxX, maxZ, maxVeinSize, chancetospawn, minY, maxY);

this.addOreSpawn(Vampirecraft.oreVampiricOre, world,random, x, z, 10, 10, 4+random.nextInt(6), 10, 10, 11);

this.addOreSpawn(Vampirecraft.oreBloodOre, world,random, x, z, 12, 14, 4+random.nextInt(6), 12, 14, 11);

this.addOreSpawn(Vampirecraft.oreSunOre, world,random, x, z, 10, 19, 4+random.nextInt(6), 10, 19, 11);

 

}

 

private void addOreSpawn(Block block, World world, Random random, int blockXpos, int blockZpos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY) {

for(int i = 0; i < chanceToSpawn; i++) {

int posX = blockXpos + random.nextInt(maxX);

int posY = minY + random.nextInt(maxY - minY);

int posZ = blockZpos + random.nextInt(maxZ);

(new WorldGenMinable(block, maxVeinSize)).generate(world, random, posX, posY, posZ);

}

 

}

 

private void generateNether(World world, Random random, int x, int z) {

// TODO Auto-generated method stub

 

}

 

private void generateEnd(World world, Random random, int x, int z) {

// TODO Auto-generated method stub

 

}

 

}

 

 

  • 4 years later...
  • 6 months later...
Posted

1.7.2 is no longer supported on this forum due to its age.

Please update to a modern version of Minecraft to receive support.

Also this thread is old.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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