Skip to content

Commit

Permalink
fixed server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 12, 2024
1 parent 7e11fda commit 25276ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import com.terraformersmc.campanion.stat.CampanionStats;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelEvent;
import net.minecraftforge.client.model.geometry.IGeometryLoader;
import net.minecraftforge.client.model.geometry.IUnbakedGeometry;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
Expand Down Expand Up @@ -55,8 +57,8 @@ public CampanionForge() {
CampanionStats.loadClass();
});

CampanionForgeClient.registerEvents(modEventBus);
modEventBus.addListener((FMLClientSetupEvent event) -> CampanionForgeClient.init());

DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CampanionForgeClient::new);

modEventBus.addListener((ModelEvent.RegisterGeometryLoaders event) ->
event.register("bridge_planks", (IGeometryLoader<BridgePlanksUnbakedGeometry>) (jsonObject, deserializationContext) -> new BridgePlanksUnbakedGeometry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

public class CampanionForgeClient {

public CampanionForgeClient() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
CampanionForgeClient.registerEvents(modEventBus);
modEventBus.addListener((FMLClientSetupEvent event) -> CampanionForgeClient.init());
}

public static void registerEvents(IEventBus modEventBus) {
modEventBus.addListener((RegisterKeyMappingsEvent event) -> CampanionClient.registerKeybindings(event::register));
modEventBus.addListener((EntityRenderersEvent.RegisterRenderers event) -> CampanionClient.registerEntityRenderers(event::registerEntityRenderer));
Expand Down

0 comments on commit 25276ce

Please sign in to comment.