'Minecraft Forge FMLClientSetupEvent fired on Server?

As stated in the Title I think that an FMLClientSetupEvent is Fired on a Forge-Minecraft dedicated Server. Forge Versions should be the same. All in all, this leads to the Error

java.lang.RuntimeException: Attempted to load class net/minecraft/client/renderer/entity/EntityRenderer for invalid dist DEDICATED_SERVER

I figured out that this is due to the CustomRender class which is a subclass of EntityRenderer. When deleting the line "RenderingRegistry.registerEntityRend..." where I register the CustomRender the Server starts just fine.

Any ideas on that? I'm really not getting it myself because I can't debug the server app.

Documentation of FMLClientSetupEvent: https://mcforge.readthedocs.io/en/latest/conventions/loadstages/

My Code:

@Mod(Utils.MOD_ID)
public class Main {
    
    public Main() {
        ModItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
        ModSounds.SOUNDS.register(FMLJavaModLoadingContext.get().getModEventBus());
        ModEntityType.ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverSetup);
    }   
    
    
    private void commonSetup(FMLCommonSetupEvent evt) {
        
    }
    
    private void clientSetup(FMLClientSetupEvent evt) {
        Phaser.arrow = ModEntityType.LASERSTRAHL_ENTITY.get(); 
        RenderingRegistry.registerEntityRenderingHandler(Phaser.arrow, renderManager -> new CustomRender(renderManager));
    }
    
    private void serverSetup(FMLDedicatedServerSetupEvent evt) {
        
    }
}


Solution 1:[1]

I figured it out. The event isn't fired but apparently the Server doesn't like the EntityRenderer class being imported. So i made a new class for client setup stuff and called that after the FMLClientSetupEvent.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Florian Hensel