Jump to content

Forge API Implementation Problems (Thermal Dynamics)


benfah

Recommended Posts

Hello Guys,

 

At first, sorry for my bad English, I'm German.

 

I've programmed a mod named MoreEMC

 

It uses the ProjectE API to add a EMC value to specific items from other mods like Draconic Evolution.

 

Any item works fine except the Hardened Energy Fluxduct from Thermal Dynamics

 

The Errorlog:

java.lang.NullPointerException: Initializing game
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213)
at moze_intel.projecte.impl.EMCProxyImpl.registerCustomEMC(EMCProxyImpl.java:23)
at me.benfah.moreemc.MyMod.preInit(MyMod.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

The Mainclass:

package me.benfah.moreemc;

import moze_intel.projecte.api.ProjectEAPI;
import moze_intel.projecte.api.proxy.IEMCProxy;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cofh.thermaldynamics.item.TDItems;
import cofh.thermalfoundation.item.TFItems;

import com.brandon3055.draconicevolution.common.ModItems;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
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;


@Mod(modid = MyMod.MODID, name = "More EMC", version = MyMod.VERSION, dependencies = "required-after:ProjectE;required-after:ThermalFoundation;required-after:ThermalDynamics;required-after:DraconicEvolution")
public class MyMod
{
    public static final String MODID = "moreemc";
    public static final String VERSION = "1.0";
    
    
    


    
    public static Item testItem;
    
   
    
    @Instance(MyMod.MODID)
public static MyMod modInstance;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {

    	
    	IEMCProxy emcProxy = ProjectEAPI.getEMCProxy();
    	
    	emcProxy.registerCustomEMC(TFItems.dustNiter, 20);

    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconiumIngot), 16384);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconicIngot), 131072);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.dragonHeart), 262144);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconicHelm), 6062080);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconicChest), 9699328);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconicLeggs), 8486912);
    	emcProxy.registerCustomEMC(new ItemStack(ModItems.draconicBoots), 4849664);
    	
    	
    	

    

    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	
    	

    	
    	
    }

    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    	
    	IEMCProxy emcProxy = ProjectEAPI.getEMCProxy();

    	emcProxy.registerCustomEMC(TDItems.ductEnergyHardened, 20); //<---- The Error


    	
    


    }
}

 

Thanks in advance  :)

Link to comment
Share on other sites

Looking at Thermal Dynamics in a decompiler, the fields in

TDItems

are never actually initialised. To get a duct

ItemStack

, get the appropriate

Duct

from the

TDDucts

class and then use the

Duct#itemStack

field.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.