Skip to content

Commit

Permalink
Fixed instant server crash due to client mods being loaded on the server
Browse files Browse the repository at this point in the history
  • Loading branch information
seelderr committed Sep 22, 2024
1 parent 3c5321b commit 66cf2d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public static ResourceLocation res(String name) {
public DragonSurvivalMod(IEventBus modEventBus, ModContainer modContainer){
if(FMLEnvironment.dist == Dist.CLIENT){
GeckoLibClient.init();

// Register the configuration screen
modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
}

DragonTypes.registerTypes();
DragonBodies.registerBodies();

Expand Down Expand Up @@ -119,9 +123,6 @@ public DragonSurvivalMod(IEventBus modEventBus, ModContainer modContainer){
DS_STRUCTURE_PLACEMENT_TYPES.register(modEventBus);
DS_TRIGGERS.register(modEventBus);
GLM.register(modEventBus);

// Register the configuration screen
modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
}

private void commonSetup(final FMLCommonSetupEvent event){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.GlStateBackup;
import net.neoforged.neoforge.client.event.RegisterShadersEvent;
import org.jetbrains.annotations.Nullable;

@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
@OnlyIn(Dist.CLIENT)

This comment has been minimized.

Copy link
@SiverDX

SiverDX Sep 22, 2024

Collaborator

the dist in the event subscriber should be enough
@OnlyIn should be avoided imo

This comment has been minimized.

Copy link
@seelderr

seelderr Sep 22, 2024

Author Collaborator

I'll remove the OnlyIn from the class. Out of curiosity why should it be avoided? We should never be loading this stuff on the server anyways, it is client rendering code

This comment has been minimized.

Copy link
@SiverDX

SiverDX Sep 22, 2024

Collaborator

it's more like a crutch
iirc it causes (neo)forge to just delete / remove code
(which is not a process i'd trust in)

and if you somehow reference this class from the server side it's going to crash anyway since it won't exist

(also see neoforged/NeoForge#569)

@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class DragonEditorHandler{
private static ShaderInstance skinGenerationShader;

Expand Down

0 comments on commit 66cf2d7

Please sign in to comment.