From 45bc0ef5ecb61ffeac12c94abd82619cc31e9655 Mon Sep 17 00:00:00 2001 From: 90 <90@national.shitposting.agency> Date: Wed, 25 Jan 2023 23:57:51 +0000 Subject: [PATCH] Move render type init to FMLClientSetupEvent on Forge fixes occasional crash bug --- .../java/gripe/_90/megacells/forge/MEGACellsClient.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java index 7c561084..6c97c2aa 100644 --- a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java +++ b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java @@ -43,6 +43,7 @@ public class MEGACellsClient { public MEGACellsClient() { var bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::initScreens); + bus.addListener(this::initRenderTypes); bus.addListener(this::initModels); bus.addListener(this::initModelRotation); bus.addListener(this::initItemColors); @@ -53,12 +54,16 @@ private void initScreens(FMLClientSetupEvent ignoredEvent) { "/screens/megacells/mega_pattern_provider.json"); } + private void initRenderTypes(FMLClientSetupEvent ignoredEvent) { + for (var type : MEGACraftingUnitType.values()) { + ItemBlockRenderTypes.setRenderLayer(type.getDefinition().block(), RenderType.cutout()); + } + } + private void initModels(ModelEvent.RegisterGeometryLoaders event) { for (var type : MEGACraftingUnitType.values()) { event.register("block/crafting/" + type.getAffix() + "_formed", new SimpleModelLoader<>(() -> new CraftingCubeModel(new MEGACraftingUnitModelProvider(type)))); - - ItemBlockRenderTypes.setRenderLayer(type.getDefinition().block(), RenderType.cutout()); } BlockEntityRenderers.register(MEGABlockEntities.MEGA_CRAFTING_MONITOR, CraftingMonitorRenderer::new);