Jump to content

[SOLVED] Problems with Fluid.


SirTheori

Recommended Posts

Hello,

 

I am currently working on a mod for Minecraft 1.7.2 using Forge, and I have ran into a problem.

 

The problem is that Minecraft crashes on loading after adding a fluid. Any help is much appreciated.

I am also implementing Buildcraft, Forestry and IC2 APIs but haven't used any of them yet.

 

Crash Log:

 

 

---- Minecraft Crash Report ----

// This doesn't make any sense!

 

Time: 2014-04-15 23:01

Description: Initializing game

 

java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:420)

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

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

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

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

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

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

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

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

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

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

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

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

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)

Caused by: java.lang.NullPointerException

at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119)

at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177)

at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27)

at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28)

at net.theori.tmech.blocks.BlockLiquidPower.<init>(BlockLiquidPower.java:21)

at net.theori.tmech.TheoreticMechanics.<clinit>(TheoreticMechanics.java:33)

... 35 more

 

 

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

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

 

-- Head --

Stacktrace:

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:420)

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

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

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

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

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

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

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

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

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

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

 

-- Initialization --

Details:

Stacktrace:

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

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

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 7 (amd64) version 6.1

Java Version: 1.7.0_51, Oracle Corporation

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

Memory: 666118416 bytes (635 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: 0, tallocated: 0

FML: MCP v9.01-pre FML v7.2.156.1056 Minecraft Forge 10.12.0.1056 12 mods loaded, 12 mods active

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

FML{7.2.156.1056} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1056.jar) Unloaded->Constructed

Forge{10.12.0.1056} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1056.jar) Unloaded->Constructed

BuildCraft|Core{5.0.4} [buildCraft] (buildcraft-5.0.4-dev.jar) Unloaded->Constructed

IC2{2.1.459-experimental} [industrialCraft 2] (industrialcraft-2-2.1.459-experimental-dev.jar) Unloaded->Constructed

Forestry{2.4.0.0-711} [Forestry for Minecraft] (forestry-2.4.0.0-711-dev.jar) Unloaded->Constructed

tmech{0.1.0-dev1} [Theoretic Mechanics] (bin) Unloaded

BuildCraft|Builders{5.0.4} [bC Builders] (buildcraft-5.0.4-dev.jar) Unloaded

BuildCraft|Energy{5.0.4} [bC Energy] (buildcraft-5.0.4-dev.jar) Unloaded

BuildCraft|Factory{5.0.4} [bC Factory] (buildcraft-5.0.4-dev.jar) Unloaded

BuildCraft|Transport{5.0.4} [bC Transport] (buildcraft-5.0.4-dev.jar) Unloaded

BuildCraft|Silicon{5.0.4} [bC Silicon] (buildcraft-5.0.4-dev.jar) Unloaded

Launched Version: 1.6

LWJGL: 2.9.0

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

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: ~~ERROR~~ NullPointerException: null

Anisotropic Filtering: Off (1)

 

 

 

Base Mod class:

 

 

package net.theori.tmech;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.item.Item;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidRegistry;

import net.theori.tmech.blocks.BlockLiquidPower;

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;

 

@Mod(modid=TheoreticMechanics.MODID, name=TheoreticMechanics.NAME, version=TheoreticMechanics.VERSION)

public class TheoreticMechanics {

public static final String MODID = "tmech";

public static final String NAME = "Theoretic Mechanics";

public static final String VERSION = "0.1.0-dev1";

 

@Instance(value = TheoreticMechanics.MODID)

public static TheoreticMechanics instance;

 

@SidedProxy(clientSide="net.theori.tmech.client.ClientProxy", serverSide="net.theori.tmech.CommonProxy")

public static CommonProxy proxy;

 

// Fluids

public static Fluid liquidPower = new Fluid("liquidpower").setLuminosity(15).setDensity(10000).setTemperature(1273).setViscosity(9000);

 

// Blocks

public static Block blockLiquidPower = new BlockLiquidPower(TheoreticMechanics.liquidPower, Material.lava);

 

@EventHandler

public void preInit(FMLPreInitializationEvent event) {

 

}

 

@EventHandler

public void load(FMLInitializationEvent event) {

proxy.registerRenderers();

 

// Fluids

FluidRegistry.registerFluid(liquidPower);

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event) {

 

}

}

 

 

 

Fluid block class:

 

 

package net.theori.tmech.blocks;

 

import net.minecraft.block.material.Material;

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

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.util.IIcon;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

import net.minecraftforge.fluids.BlockFluidClassic;

import net.minecraftforge.fluids.Fluid;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class BlockLiquidPower extends BlockFluidClassic {

@SideOnly(Side.CLIENT)

protected IIcon stillIcon;

@SideOnly(Side.CLIENT)

protected IIcon flowingIcon;

 

public BlockLiquidPower(Fluid fluid, Material material) {

super(fluid, material);

setBlockName("liquidPower");

setCreativeTab(CreativeTabs.tabMisc);

}

 

@Override

public IIcon getIcon(int side, int meta) {

return (side == 0 || side == 1)? stillIcon : flowingIcon;

 

}

 

@SideOnly(Side.CLIENT)

@Override

public void registerBlockIcons(IIconRegister register) {

stillIcon = register.registerIcon("modid:powerStill");

flowingIcon = register.registerIcon("modid:powerFlowing");

}

 

@Override

public boolean canDisplace(IBlockAccess world, int x, int y, int z) {

if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;

return super.canDisplace(world, x, y, z);

}

 

@Override

public boolean displaceIfPossible(World world, int x, int y, int z) {

if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;

return super.displaceIfPossible(world, x, y, z);

}

}

 

 

Link to comment
Share on other sites

Hello,

 

I am currently working on a mod for Minecraft 1.7.2 using Forge, and I have ran into a problem.

 

The problem is that Minecraft crashes on loading after adding a fluid. Any help is much appreciated.

I am also implementing Buildcraft, Forestry and IC2 APIs but haven't used any of them yet.

 

Base Mod class:

 

 

package net.theori.tmech;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.item.Item;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidRegistry;

import net.theori.tmech.blocks.BlockLiquidPower;

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;

 

@Mod(modid=TheoreticMechanics.MODID, name=TheoreticMechanics.NAME, version=TheoreticMechanics.VERSION)

public class TheoreticMechanics {

public static final String MODID = "tmech";

public static final String NAME = "Theoretic Mechanics";

public static final String VERSION = "0.1.0-dev1";

 

@Instance(value = TheoreticMechanics.MODID)

public static TheoreticMechanics instance;

 

@SidedProxy(clientSide="net.theori.tmech.client.ClientProxy", serverSide="net.theori.tmech.CommonProxy")

public static CommonProxy proxy;

 

// Fluids

public static Fluid liquidPower = new Fluid("liquidpower").setLuminosity(15).setDensity(10000).setTemperature(1273).setViscosity(9000);

 

// Blocks

public static Block blockLiquidPower = new BlockLiquidPower(TheoreticMechanics.liquidPower, Material.lava);

 

@EventHandler

public void preInit(FMLPreInitializationEvent event) {

 

}

@EventHandler

public void load(FMLInitializationEvent event) {

proxy.registerRenderers();

 

// Fluids

FluidRegistry.registerFluid(liquidPower);

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event) {

 

}

}

 

 

 

 

ahmmm... shouldn't you register your blovks in preinit?

like:

 

 

        public static Block blockXYZ;


@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	blockXYZ = new......;
}


 

 

 

Thats the way i do it...(Don't forget the thank you button!)

 

Here could be your advertisement!

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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