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
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

View file

@ -93,9 +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();
}
config.ponyskulls.onChanged(PonySkullRenderer::resolve);
// TODO Config is loaded too early for listeners
PonySkullRenderer.resolve(config.ponyskulls.get());
if (FabricLoader.getInstance().isModLoaded("hdskins")) {
IndirectHDSkins.initialize();

View file

@ -155,7 +155,5 @@ public class GuiPonySettings extends GameGui {
@Override
public void removed() {
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.
*/
public static void resolve() {
if (MineLittlePony.getInstance().getConfig().ponyskulls.get()) {
public static void resolve(boolean ponySkulls) {
if (ponySkulls) {
if (!(INSTANCE instanceof PonySkullRenderer)) {
backup = INSTANCE;
BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance);