Use config listeners for skulls.

This commit is contained in:
Matthew Messinger 2019-07-24 21:35:21 -04:00
parent 0e211ba90b
commit 2676503d98
4 changed files with 7 additions and 8 deletions

View file

@ -17,5 +17,6 @@ org.gradle.daemon=false
# Dependencies # Dependencies
fabric_version=0.3.0+ fabric_version=0.3.0+
kirin_version=1.14.4-1.4.2 # TODO update kirin before release
kirin_version=1.14.4-1.4.3-SNAPSHOT
hd_skins_version=1.14.4-5.4.2 hd_skins_version=1.14.4-5.4.2

View file

@ -93,9 +93,9 @@ public class MineLittlePony implements ClientModInitializer {
ClientTickCallback.EVENT.register(this::onTick); ClientTickCallback.EVENT.register(this::onTick);
ClientReadyCallback.EVENT.register(this::onClientReady); ClientReadyCallback.EVENT.register(this::onClientReady);
ScreenInitCallback.EVENT.register(this::onScreenInit); ScreenInitCallback.EVENT.register(this::onScreenInit);
if (config.ponyskulls.get()) { config.ponyskulls.onChanged(PonySkullRenderer::resolve);
PonySkullRenderer.resolve(); // TODO Config is loaded too early for listeners
} PonySkullRenderer.resolve(config.ponyskulls.get());
if (FabricLoader.getInstance().isModLoaded("hdskins")) { if (FabricLoader.getInstance().isModLoaded("hdskins")) {
IndirectHDSkins.initialize(); IndirectHDSkins.initialize();

View file

@ -155,7 +155,5 @@ public class GuiPonySettings extends GameGui {
@Override @Override
public void removed() { public void removed() {
config.save(); config.save();
PonySkullRenderer.resolve();
} }
} }

View file

@ -43,8 +43,8 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer {
* *
* Original/Existing renderer is stored to a backup variable as a fallback in case of mods. * Original/Existing renderer is stored to a backup variable as a fallback in case of mods.
*/ */
public static void resolve() { public static void resolve(boolean ponySkulls) {
if (MineLittlePony.getInstance().getConfig().ponyskulls.get()) { if (ponySkulls) {
if (!(INSTANCE instanceof PonySkullRenderer)) { if (!(INSTANCE instanceof PonySkullRenderer)) {
backup = INSTANCE; backup = INSTANCE;
BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance); BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance);