Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

@instance("yourmod"), should fix it, i had the same problem but cpw fixed it on buildcraft

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.