Jump to content

[Solved] Working with two mods at the same time. @Instance


Mazetar

Recommended Posts

I have completed the initial goal of my Tagger Rails mod and while waiting for a friend to test it and give feedback I started working on my 2nd mod.

I have just created the basic setup for creating a forge mod and try to run the client to confirm that the mod is working when it crashes with the following two errors:

 

cpw.mods.fml.common.LoaderException: java.lang.IllegalArgumentException: Can not set static com.mazetar.aimod.common.Aimod field com.mazetar.aimod.common.Aimod.aimodInstance to com.mazetar.taggerrails.common.TaggerRails
at cpw.mods.fml.common.LoadController.transition(LoadController.java:102)

And error two:

java.lang.IllegalArgumentException: Can not set static com.mazetar.taggerrails.common.TaggerRails field com.mazetar.taggerrails.common.TaggerRails.instance to com.mazetar.aimod.common.Aimod
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeStaticObjectFieldAccessorImpl.set(Unknown Source)
at java.lang.reflect.Field.set(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.parseSimpleFieldAnnotation(FMLModContainer.java:331)

 

So it seems to me that the @Instance annotation does for each mod is conflicting with each other?

 

TaggerRails.Java - summary of content:

package com.mazetar.taggerrails.common;
// Some imports
@Mod(modid = "MazTaggerRails", name = "TaggerRails", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = true,
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"TaggerRailsChan"}, packetHandler = ClientPacketHandler.class),
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"TaggerRailsChan"}, packetHandler = ServerPacketHandler.class))
public class TaggerRails 
{
        @SidedProxy(clientSide = "com.mazetar.taggerrails.client.ClientProxy", serverSide = "com.mazetar.taggerrails.common.CommonProxy")
public static CommonProxy proxy;

@Instance
public static TaggerRails instance;

//Later inn the code
@Init
public void load(FMLInitializationEvent evt)
{
       NetworkRegistry.instance().registerGuiHandler(instance, proxy);

 

This mod was working fine on its own.

Then I added my new project into its own package, named "com.mazetar.aimod".

With its own package handlers, Proxy files and its own mod file.

 

Aimod.java - summary of contents.

package com.mazetar.aimod.common;
// lots of imports
@Mod(modid = "MazAiMod", name = "MazetarianAiMod", version = "0.0.2")
@NetworkMod(clientSideRequired = true, serverSideRequired = true,
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"MazAiChan"}, packetHandler = ClientPacketHandler.class),
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"MazAiChan"}, packetHandler = ServerPacketHandler.class))
public class Aimod 
{
     @SidedProxy(clientSide = "com.mazetar.aimod.client.ClientProxy", serverSide = "com.mazetar.aimod.common.CommonProxy")
     public static CommonProxy proxy;

    @Instance
    public static Aimod aimodInstance;

    @PreInit
    public void preInit(FMLPreInitializationEvent event)
    {	
    }
    
    @Init
    public void load(FMLInitializationEvent evt)
    {
	NetworkRegistry.instance().registerGuiHandler(aimodInstance, proxy);
    }

 

I tried renaming the Aimod instance to aimodInstance incase the name of the variable itself would have something to say, it didn't change anything.

Been trying to find places where I reffere to Aimod instead of TaggerRails and vica verca without finding any.

Does anyone have a clue for how to solve this?

 

 

If you guys dont get it.. then well ya.. try harder...

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.