Embeddium (Rubidium) Extra

Embeddium (Rubidium) Extra

15M Downloads

Crash when installed on dedicated servers

PaintNinja opened this issue ยท 0 comments

commented

Make sure you are not opening a duplicate.

Minecraft version.

1.19.4

Rubidium Extra version.

0.4.18+mc1.19.4-build.84

Rubidium version.

0.6.4

What happened?

I'm aware this mod is client-side-only, however we keep getting questions asking for help with crashes on the Forge discord server and I've noticed you've tried fixing this already.

I've made this GitHub issue report to properly log it and note some of the causes so that you understand why this is happening. I'll file a pull request shortly that'll address these issues for you. I mean no disrespect, only trying to help out. :)

Issue 1 - OnlyIn

When Forge loads a mod, it searches for a @Mod annotation. In this case, yours is here:
https://github.com/dimadencep/sodium-extra-forge/blob/e4e83124c719cb333b88997721021900cbd5a9d5/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java#L16-L18

I see you've tried using OnlyIn to stop it from loading, however this actually causes the game to crash as it attempts to load a class you've asked it to strip out on servers:

java.lang.RuntimeException: Attempted to load class me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod for invalid dist DEDICATED_SERVER

Removing OnlyIn fixes this issue. Generally speaking, you should avoid using OnlyIn altogether.

Issue 2 - Classloading

With issue 1 fixed, next up is classloading.

Once it's found your @Mod annotated class, it creates an instance of it. This causes a bunch of client-side handler classes to be initialised, but since the mod is running on a dedicated server where some of the classes your handlers reference (such as rendering) do not exist, it'll crash due to attempting to reference client-only classes on a dedicated server, with the almost same error as issue 1.
https://github.com/dimadencep/sodium-extra-forge/blob/e4e83124c719cb333b88997721021900cbd5a9d5/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java#L58-L60

The easiest solution to this is using @EventBusSubscriber. You can ask it to only subscribe to events on clients, and if your mod isn't running on a client, it'll never load the class unless you explicitly reference it from your mod class. The event bus subscriber handles registering event listeners for you. Your main mod class would not reference any client things and be mostly empty.

Issue 3 - mods.toml

Fairly minor thing. If your mod's client-side-only, all the dependencies should be side = "CLIENT".

Relevant logs

https://gist.github.com/PaintNinja/12561adfe7e8da03498c43569cc48ce1

Additional information

I'll create a pull request to fix this