Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

java.lang.NullPointerException


Kuntberger
 Share

Recommended Posts

I get this error by fluid for java.lang.NullPointerException

 

---- Minecraft Crash Report ----

// Hey, that tickles! Hehehe!

 

Time: 11.01.14 22:05

Description: Initializing game

 

java.lang.NullPointerException

at net.minecraftforge.fluids.Fluid.setBlockID(Fluid.java:136)

at amSean.buttermod.buttermod.preInit(buttermod.java:73)

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

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.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

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.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:522)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:183)

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

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

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

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

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

 

 

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

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

 

-- Head --

Stacktrace:

at net.minecraftforge.fluids.Fluid.setBlockID(Fluid.java:136)

at amSean.buttermod.buttermod.preInit(buttermod.java:73)

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

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.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

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.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:522)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:183)

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

 

-- Initialization --

Details:

Stacktrace:

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

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

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

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

 

-- System Details --

Details:

Minecraft Version: 1.6.4

Operating System: Windows 8 (amd64) version 6.2

Java Version: 1.7.0_45, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 730069904 bytes (696 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

Suspicious classes: FML and Forge are installed

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

FML: MCP v8.11 FML v6.4.45.953 Minecraft Forge 9.11.1.953 4 mods loaded, 4 mods active

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

FML{6.4.45.953} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized

Forge{9.11.1.953} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized

buttermod{0.0.1} [Lol xD] (bin) Unloaded->Constructed->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: Intel® HD Graphics 4000 GL version 4.0.0 - Build 10.18.10.3379, Intel

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Pack: Default

Current Language: English (US)

Profiler Position: N/A (disabled)

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

 

 

 

Mod

 

 

 

package amSean.buttermod;

 

import java.util.Random;

 

import amSean.World.buttermodGeneration;

import net.minecraft.block.Block;

import net.minecraft.block.material.MapColor;

import net.minecraft.block.material.Material;

import net.minecraft.block.material.MaterialLiquid;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.biome.BiomeGenJungle;

import net.minecraftforge.common.Configuration;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidRegistry;

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.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid="buttermod", name="Lol xD", version="0.0.1")

@NetworkMod(clientSideRequired=true)

public class buttermod {

 

 

@Instance(value = "buttermod")

        public static buttermod instance;

       

        @SidedProxy(clientSide="amSean.buttermod.client.ClientProxy", serverSide="amSean.buttermod.CommonProxy")

        public static CommonProxy proxy;

       

        public static buttermodGeneration genWorld = new buttermodGeneration();

       

        public BiomeGenBase butternoop;

       

        public static CreativeTabs tabSeanSachen = new CreativeTabs("tabSeanSachen"){

        public ItemStack getIconItemStack(){

        return new ItemStack(EssbareButter, 1, 0);

        }

        };

        //---------------------------------------------------------------------------------------------------------------------------

        public static Block blockButterWasser;

        public static int blockButterWasserID = 342;

       

        public static Fluid fluidbutterWasser;

       

        public static Material materialButterWasser;

        //---------------------------------------------------------------------------------------------------------------------------

        public static Item buttter;

        public int buttterID = 888;

       

        public static Block ButterBlock;

        public int ButterBlockID = 222;

       

        public static Block Buttererz;

        public int ButtererzID = 887;

       

        public static Item EssbareButter;

        public int EssbareButterID = 886;

 

       

        @EventHandler

        public void preInit(FMLPreInitializationEvent event) {

        materialButterWasser = new MaterialLiquid(MapColor.sandColor);

        fluidbutterWasser = new Fluid("ButterWasser").setBlockID(blockButterWasser);

        FluidRegistry.registerFluid(fluidbutterWasser);

        blockButterWasser = new BlockButterWasser(blockButterWasserID, fluidbutterWasser, materialButterWasser).setCreativeTab(tabSeanSachen).setUnlocalizedName("blockButterWasser");

       

        }

       

        @EventHandler

 

        public void load(FMLInitializationEvent event) {

       

        EssbareButter = new ItemEssbareButter(EssbareButterID).setUnlocalizedName("Essbare Butter").setCreativeTab(tabSeanSachen);

        buttter = new ItemButter(buttterID).setUnlocalizedName("Butter").setCreativeTab(tabSeanSachen);

        ButterBlock = new BlockButterBlock(ButterBlockID, Material.cloth).setUnlocalizedName("ButterBlock").setCreativeTab(tabSeanSachen).setHardness(3.0F);

        Buttererz = new BlockButtererz(ButtererzID, Material.rock).setUnlocalizedName("ButterErz").setCreativeTab(tabSeanSachen);

       

       

       

        butternoop = new BiomButterNoop(98);

       

        loadCraftingRecipes();

        loadSmeltingRecipes();

        itemregister();

        Languageu();

       

       

        }

       

       

 

 

 

 

@EventHandler

        public void postInit(FMLPostInitializationEvent event) {

 

GameRegistry.registerWorldGenerator(new ButterGenerator());

       

        }

       

        private void loadConfiguration(Configuration configfile){

        configfile.load();

       

        //http://www.youtube.com/watch?v=NVjX70LzOIE

        }

 

        private void loadCraftingRecipes() {

//NormaleRezepte

GameRegistry.addRecipe(new ItemStack(Block.dirt, 1), "DDD", "DDD", "DDD", 'D', Block.blockDiamond );

GameRegistry.addRecipe(new ItemStack(buttermod.ButterBlock, 1), "DDD", "DDD", "DDD", 'D', buttermod.buttter);

 

//shapelessRecepte

 

 

        }

       

        private void Languageu() {

LanguageRegistry.addName(buttter, "Butter");

LanguageRegistry.addName(ButterBlock, "Butter Block");

LanguageRegistry.addName(Buttererz, "ButterErz");

LanguageRegistry.addName(EssbareButter, "Essbare Butter");

LanguageRegistry.instance().addStringLocalization("itemGroup.tabSeanzeug", "Butter Mod");

 

}

 

private void itemregister() {

GameRegistry.registerItem(buttter, "buttter");

GameRegistry.registerBlock(ButterBlock, "ButterBlock");

GameRegistry.registerBlock(Buttererz, "buttererz");

GameRegistry.addBiome(butternoop);

GameRegistry.registerItem(EssbareButter, "EssbareButter");

GameRegistry.registerBlock(blockButterWasser, "blockButterWasser");

GameRegistry.registerWorldGenerator(new buttermodGeneration());

 

}

private void loadSmeltingRecipes() {

 

GameRegistry.addSmelting(buttter.itemID, new ItemStack(buttermod.EssbareButter), 3.9F);

GameRegistry.addSmelting(Buttererz.blockID, new ItemStack(buttermod.Buttererz), 6.2F);

}

 

}

 

 

 

Fluid

 

 

package amSean.buttermod;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraftforge.fluids.BlockFluidClassic;

import net.minecraftforge.fluids.Fluid;

 

public class BlockButterWasser extends BlockFluidClassic {

 

public BlockButterWasser(int id, Fluid fluid, Material material) {

super(id, fluid, material);

 

}

 

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister iconRegister){

this.blockIcon = iconRegister.registerIcon("Basis:ButterWasser");

}

}

 

 

 

Link to comment
Share on other sites

Sorry that was my bad. Change it back to the way you had it since that method somehow requires a block.... But put the part in your preInit where you define your blockButterWasser in front of your fluidButterWasser. The block ID has not been defined yet for that block when you call the setBlockID method.

If you really want help, give that modder a thank you.

 

Modders LOVE thank yous.

Link to comment
Share on other sites

What mardiff is saying:

 

Capture.png

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

In other words, change this:

materialButterWasser = new MaterialLiquid(MapColor.sandColor);
           fluidbutterWasser = new Fluid("ButterWasser").setBlockID(blockButterWasser);
           FluidRegistry.registerFluid(fluidbutterWasser);
           blockButterWasser = new BlockButterWasser(blockButterWasserID, fluidbutterWasser, materialButterWasser).setCreativeTab(tabSeanSachen).setUnlocalizedName("blockButterWasser");

 

To this:

materialButterWasser = new MaterialLiquid(MapColor.sandColor);
blockButterWasser = new BlockButterWasser(blockButterWasserID, fluidbutterWasser, materialButterWasser).setCreativeTab(tabSeanSachen).setUnlocalizedName("blockButterWasser");
fluidbutterWasser = new Fluid("ButterWasser").setBlockID(blockButterWasser);
FluidRegistry.registerFluid(fluidbutterWasser);

 

If you really want help, give that modder a thank you.

 

Modders LOVE thank yous.

Link to comment
Share on other sites

Well, after realizing that the solution was way easier than I thought, just keep your original code posted here and delete the .SetBlockID part from the fluid declaration. The block understands its fluid, and the fluid doesn't need to know its block.

If you really want help, give that modder a thank you.

 

Modders LOVE thank yous.

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.