Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • java.lang.NullPointerException
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
Kuntberger

java.lang.NullPointerException

By Kuntberger, January 11, 2014 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Kuntberger    0

Kuntberger

Kuntberger    0

  • Tree Puncher
  • Kuntberger
  • Members
  • 0
  • 4 posts
Posted January 11, 2014

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");

}

}

 

 

 

  • Quote

Share this post


Link to post
Share on other sites

mardiff    21

mardiff

mardiff    21

  • Creeper Killer
  • mardiff
  • Members
  • 21
  • 158 posts
Posted January 11, 2014

In this line:

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

 

Change blockButterWasser to blockButterWasserID

  • Quote

Share this post


Link to post
Share on other sites

Kuntberger    0

Kuntberger

Kuntberger    0

  • Tree Puncher
  • Kuntberger
  • Members
  • 0
  • 4 posts
Posted January 11, 2014

The error is still there

  • Quote

Share this post


Link to post
Share on other sites

mardiff    21

mardiff

mardiff    21

  • Creeper Killer
  • mardiff
  • Members
  • 21
  • 158 posts
Posted January 11, 2014

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.

  • Quote

Share this post


Link to post
Share on other sites

Kuntberger    0

Kuntberger

Kuntberger    0

  • Tree Puncher
  • Kuntberger
  • Members
  • 0
  • 4 posts
Posted January 11, 2014

Can you write me the code, I get it not

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2093

Draco18s

Draco18s    2093

  • Reality Controller
  • Draco18s
  • Members
  • 2093
  • 14023 posts
Posted January 11, 2014

What mardiff is saying:

 

Capture.png

  • Quote

Share this post


Link to post
Share on other sites

mardiff    21

mardiff

mardiff    21

  • Creeper Killer
  • mardiff
  • Members
  • 21
  • 158 posts
Posted January 11, 2014

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);

 

  • Quote

Share this post


Link to post
Share on other sites

Kuntberger    0

Kuntberger

Kuntberger    0

  • Tree Puncher
  • Kuntberger
  • Members
  • 0
  • 4 posts
Posted January 11, 2014

The error is still there

  • Quote

Share this post


Link to post
Share on other sites

ninjapancakes87    7

ninjapancakes87

ninjapancakes87    7

  • Stone Miner
  • ninjapancakes87
  • Members
  • 7
  • 81 posts
Posted January 11, 2014

While I've never worked with fluids before, and don't have a solution, I wanted to know if you are german.  Wasser = water

  • Quote

Share this post


Link to post
Share on other sites

mardiff    21

mardiff

mardiff    21

  • Creeper Killer
  • mardiff
  • Members
  • 21
  • 158 posts
Posted January 12, 2014

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.

  • Quote

Share this post


Link to post
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.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      Can't see anything on minecraft menu screen except for the bottom left corner

      By DaemonUmbra · Posted 18 minutes ago

      Please don't Necro old threads, if you have an issue make your own.
    • DaemonUmbra
      Forge having problem loading mods

      By DaemonUmbra · Posted 18 minutes ago

      You changed "Game Directory" to your mods folder. The Game Directory is supposed to be the folder that contains the mods folder, .minecraft by default
    • Casual
      1.12.2 crash on game start

      By Casual · Posted 22 minutes ago

      Ok to add on, had to do manual library install due to failed library install thing, also there is never another window It just closes the launcher window and then reopens it with the error.
    • Cosmic_Cookie
      Can't see anything on minecraft menu screen except for the bottom left corner

      By Cosmic_Cookie · Posted 31 minutes ago

      Hey, I have the same problem except my screen is black instead of white and this doesn't work. I know it's years later but maybe someone can help.
    • Cosmic_Cookie
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By Cosmic_Cookie · Posted 44 minutes ago

      Nvm wrong topic
  • Topics

    • florgonn
      4
      Can't see anything on minecraft menu screen except for the bottom left corner

      By florgonn
      Started July 30, 2014

    • SilviaX_92
      3
      Forge having problem loading mods

      By SilviaX_92
      Started 3 hours ago

    • Casual
      1
      1.12.2 crash on game start

      By Casual
      Started 46 minutes ago

    • PulseBeat_02
      14
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By PulseBeat_02
      Started December 13, 2018

    • GeokitFX
      1
      Minecraft Custom mod pack crashing i need help

      By GeokitFX
      Started 1 hour ago

  • Who's Online (See full list)

    • Choonster
    • Casual
    • Vorquel
    • JMAS
    • Epicmoofish
    • creepaaa
    • DaemonUmbra
    • yuusha
    • Darren Hayden
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • java.lang.NullPointerException
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community