0.1.1: drop NeoForge.EVENT_BUS.register(this) with no @SubscribeEvent methods
Build / build (push) Has been cancelled
Build / build (push) Has been cancelled
The empty-class registration was rejected by NeoForge 21.1 at mod-loading time with: IllegalArgumentException: class uk.sijbers.bnstoolkit.BnsToolkit has no @SubscribeEvent methods, but register was called anyway. That tanked the dedicated server during construct-mods. Caught only after deploying 0.1.0 to the live server — the local /gradlew build doesn't exercise mod-loading. Will add a gameTestServer run later to catch this class of bug pre-deploy. When the first @SubscribeEvent listener lands (likely PlayerLoggedInEvent in M1), the register call comes back together with it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -19,5 +19,5 @@ loader_version_range=[1,)
|
|||||||
mod_id=bnstoolkit
|
mod_id=bnstoolkit
|
||||||
mod_name=Brass and Sigil Toolkit
|
mod_name=Brass and Sigil Toolkit
|
||||||
mod_license=All Rights Reserved
|
mod_license=All Rights Reserved
|
||||||
mod_version=0.1.0
|
mod_version=0.1.1
|
||||||
mod_group_id=uk.sijbers.bnstoolkit
|
mod_group_id=uk.sijbers.bnstoolkit
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package uk.sijbers.bnstoolkit;
|
|||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import uk.sijbers.bnstoolkit.network.BnsNetwork;
|
import uk.sijbers.bnstoolkit.network.BnsNetwork;
|
||||||
@@ -30,7 +29,11 @@ public final class BnsToolkit {
|
|||||||
BnsNetwork.register(modBus);
|
BnsNetwork.register(modBus);
|
||||||
|
|
||||||
modBus.addListener(this::onCommonSetup);
|
modBus.addListener(this::onCommonSetup);
|
||||||
NeoForge.EVENT_BUS.register(this);
|
|
||||||
|
// NOTE: do NOT call NeoForge.EVENT_BUS.register(this) here — NeoForge
|
||||||
|
// 21.1+ throws if the registered class has zero @SubscribeEvent methods.
|
||||||
|
// Add the register() call back together with the first @SubscribeEvent
|
||||||
|
// method (likely PlayerEvent.PlayerLoggedInEvent in M1).
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCommonSetup(final FMLCommonSetupEvent event) {
|
private void onCommonSetup(final FMLCommonSetupEvent event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user