Posted April 15, 20205 yr Hey there, I just started a new mod and when I lauched it for the first time none of my items were loading. I did some troubleshooting and eventually I found out that the constructor of my main mod file (the one with the Mod annotation) is not being called at all! I have checked the mods.toml file but its all correct. The annotations are correct too. In minecraft the mod shows up as loaded. But as I said, none of the items are registered since the constructor was never called. @Mod("witchcraftmod") @EventBusSubscriber(modid = "witchcraftmod", bus = Bus.MOD) public class WitchcraftMod { public static final String MOD_ID = "witchcraftmod"; public static WitchcraftMod instance; public WitchcraftMod() { System.exit(0); //<---- I put this here to test if the constructor is called, but since minecraft starts normally Im assuming its not final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::setup); modEventBus.addListener(this::doClientStuff); ModItems.ITEMS.register(modEventBus); ModBlocks.BLOCKS.register(modEventBus); Features.FEATURES.register(modEventBus); MinecraftForge.EVENT_BUS.register(this); instance = this; } Does anyone know what I shoulkd do to troubleshoot this further or maybe even how to solve this issue?
April 16, 20205 yr Please show your logs, and use the debugger instead of just adding exit methods in places. This probably isn't part of the issue, but it also looks like you don't need that EventBusSubscriber annotation since you're using IEventBus#addListener. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
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.