-2

I'm currently tearing my hair out with this. I'm making a minecraft 1.12.2 mod. The mod boots fine, and shows itself, but for some reason, the main class is the only one that can use @Mod.

Here is my file tree:
File tree

Here is ModItems.java:

@Mod.EventBusSubscriber(modid = ZepsMagic.MODID)
public class ModItems 
{
    
    static Item crystal;
    
    public static void init() {
        crystal = new Crystal("arobic_crystal");
    }
    
    @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().registerAll(crystal);
    }
}

However, when running the program with ModItems.java, I get:::

C:\Users\Zeptos\Documents\ModIGuess\src\main\java\com\zeptos\zepmagic\ModItems.java:7: error: cannot find symbol @Mod(modid = ZepsMagic.MODID)

This makes no sense to me, as it's totally accessible in ZepsMagic.java. Any tips?

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
ZeptosGT
  • 17
  • 1
  • 1
    That error did not come from that code. Are you trying to write `@Mod(...)` or `@Mod.EventBusSubscriber(...)`, because those are two different things? – Silvio Mayolo May 20 '22 at 23:29
  • What is @Mod from? A library you are including from a maven repo? If so, are you using maven or gradle to build your plugin? It sounds like you may have the wrong compiler scope for that library? If using gradle, make sure you're using `implementation` and not `compileOnly` as an example. Maven would use a scope of `compile` and not `provided` or `runtime`. To avoid possible conflict if a popular library, you may also need to shadow the library which will allow you to use "your" version of the library while another plugin can use a different version of the same library. – r Blue May 20 '22 at 23:47
  • btw... my background is with spigot and not forge/sponge. So that may be why the `@Mod` annotation is not familiar to myself. But your description of the issues sounds like it may be a build/compiler scope issue. At least they maybe an easy item to rule out. – r Blue May 20 '22 at 23:55
  • @user16320675 I tried that :( Imported everything from ZepsMagic.java. But importing that fixed thhe first crash! Two others tho. – ZeptosGT May 21 '22 at 01:03

0 Answers0