Error trying load mod in dedicated server
Dks00 opened this issue ยท 4 comments
Hi,
i'm trying to use this mod in a Dedicated_server and i have this issue.
Thanx for all!
Description:
-- Head --
Thread: main
Stacktrace:
at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[forge-1.16.5-36.1.32.jar:36.1] {}
-- MOD rpg-hud --
Details:
Mod File: [1.16.5][Forge] RPG-HUD-3.8.4.jar
Failure message: RPG-Hud has class loading errors
java.lang.RuntimeException: Attempted to load class net/spellcraftgaming/rpghud/main/ModRPGHud for invalid dist DEDICATED_SERVER
Mod Version: 3.8.4
Mod Issue URL: https://github.com/KurodaAkira/RPG-Hud/issues
Exception message: java.lang.RuntimeException: Attempted to load class net/spellcraftgaming/rpghud/main/ModRPGHud for invalid dist DEDICATED_SERVER
More detail:
crash-2021-06-22_12.28.33-fml.txt
Dont put the mod in the mods folder of a server.
It does not belong there.
The mod works entirely on the side of the client.
Someone on the Forge Discord also had this issue, which prompted me to take a closer look:
The @OnlyIn
annotation is a marker annotation that should only exist in Vanilla MC code. It has no purpose in mod code and may even lead to classloading errors being hidden in a dev environment when used in mod code.
Furthermore, the general consensus is that one-sided mods should simply not do anything when installed on the wrong side (except notifying the user via a log warning) instead of crashing. Do note that this requires moving all code that accesses client-only code out of the class marked with @Mod
and into a class which is only loaded when running on the client (for example by registering the event listeners with the @Mod.EventBusSubscriber
annotation instead of via EventBus#addListener()
).
If you have any more questions regarding this, feel free to come by the Forge Discord.