diff --git a/src/main/java/com/minelittlepony/client/MineLittlePony.java b/src/main/java/com/minelittlepony/client/MineLittlePony.java index 8b1406ba..8588c0f5 100644 --- a/src/main/java/com/minelittlepony/client/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/client/MineLittlePony.java @@ -93,6 +93,9 @@ public class MineLittlePony implements ClientModInitializer { ClientTickCallback.EVENT.register(this::onTick); ClientReadyCallback.EVENT.register(this::onClientReady); ScreenInitCallback.EVENT.register(this::onScreenInit); + if (config.ponyskulls.get()) { + PonySkullRenderer.resolve(); + } if (FabricLoader.getInstance().isModLoaded("hdskins")) { IndirectHDSkins.initialize(); @@ -135,8 +138,6 @@ public class MineLittlePony implements ClientModInitializer { } } } - - PonySkullRenderer.resolve(); } private void onScreenInit(Screen screen, ScreenInitCallback.ButtonList buttons) { diff --git a/src/main/java/com/minelittlepony/client/gui/GuiPonySettings.java b/src/main/java/com/minelittlepony/client/gui/GuiPonySettings.java index 2cceedd0..a451eb75 100644 --- a/src/main/java/com/minelittlepony/client/gui/GuiPonySettings.java +++ b/src/main/java/com/minelittlepony/client/gui/GuiPonySettings.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.gui; +import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.resource.language.I18n; import net.minecraft.text.LiteralText; @@ -155,5 +156,7 @@ public class GuiPonySettings extends GameGui { public void onClose() { super.onClose(); config.save(); + + PonySkullRenderer.resolve(); } } diff --git a/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java b/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java index 84732f0f..a905a34d 100644 --- a/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java +++ b/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java @@ -3,7 +3,6 @@ package com.minelittlepony.client.render.layer; import com.minelittlepony.client.model.AbstractPonyModel; import com.minelittlepony.client.model.IPonyModel; import com.minelittlepony.client.render.IPonyRender; -import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer; import com.minelittlepony.model.BodyPart; import com.mojang.authlib.GameProfile; @@ -11,6 +10,7 @@ import net.minecraft.block.AbstractSkullBlock; import net.minecraft.block.SkullBlock.SkullType; import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.entity.EquipmentSlot; @@ -97,7 +97,7 @@ public class LayerPonyCustomHead skullMap = SystemUtil.consume(Maps.newHashMap(), (skullMap) -> { @@ -44,27 +44,20 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { * * Original/Existing renderer is stored to a backup variable as a fallback in case of mods. */ - public static SkullBlockEntityRenderer resolve() { + public static void resolve() { if (MineLittlePony.getInstance().getConfig().ponyskulls.get()) { if (!(INSTANCE instanceof PonySkullRenderer)) { backup = INSTANCE; BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance); - INSTANCE = ponyInstance; } } else { if ((INSTANCE instanceof PonySkullRenderer)) { - ponyInstance = (PonySkullRenderer) INSTANCE; if (backup == null) { backup = new SkullBlockEntityRenderer(); } BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, backup); - INSTANCE = backup; } } - - INSTANCE.setRenderManager(BlockEntityRenderDispatcher.INSTANCE); - - return INSTANCE; } @Override