mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed the double gui bug
This commit is contained in:
parent
334e768166
commit
7b9eaffdbf
5 changed files with 25 additions and 35 deletions
|
@ -18,6 +18,7 @@ import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
|||
import com.mojang.util.UUIDTypeAdapter;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||
import com.voxelmodpack.hdskins.resource.SkinResourceManager;
|
||||
import com.voxelmodpack.hdskins.skins.AsyncCacheLoader;
|
||||
import com.voxelmodpack.hdskins.skins.SkinServer;
|
||||
|
@ -82,6 +83,24 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
private SkinResourceManager resources = new SkinResourceManager();
|
||||
// private ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
private Class<? extends GuiSkins> skinsClass = null;
|
||||
|
||||
public void setPrefferedSkinsGuiClass(Class<? extends GuiSkins> clazz) {
|
||||
skinsClass = clazz;
|
||||
}
|
||||
|
||||
public GuiSkins createSkinsGui() {
|
||||
if (skinsClass != null) {
|
||||
try {
|
||||
return skinsClass.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return new GuiSkins();
|
||||
}
|
||||
|
||||
public Optional<ResourceLocation> getSkinLocation(GameProfile profile1, final Type type, boolean loadIfAbsent) {
|
||||
if (!enabled)
|
||||
return Optional.empty();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.voxelmodpack.hdskins.mixin;
|
||||
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
|
||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
@ -27,8 +27,7 @@ public class MixinGuiMainMenu extends GuiScreen {
|
|||
@Inject(method = "actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V", at = @At("RETURN"))
|
||||
private void onActionPerformed(GuiButton button, CallbackInfo ci) {
|
||||
if (button.id == SKINS) {
|
||||
this.mc.displayGuiScreen(new GuiSkins());
|
||||
this.mc.displayGuiScreen(HDSkinManager.INSTANCE.createSkinsGui());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony;
|
|||
import com.minelittlepony.gui.PonySettingsPanel;
|
||||
import com.mumfrey.liteloader.Configurable;
|
||||
import com.mumfrey.liteloader.InitCompleteListener;
|
||||
import com.mumfrey.liteloader.Tickable;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||
|
||||
|
@ -11,7 +10,7 @@ import net.minecraft.client.Minecraft;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
public class LiteModMineLittlePony implements Tickable, InitCompleteListener, Configurable {
|
||||
public class LiteModMineLittlePony implements InitCompleteListener, Configurable {
|
||||
|
||||
private MineLittlePony mlp;
|
||||
|
||||
|
@ -39,11 +38,6 @@ public class LiteModMineLittlePony implements Tickable, InitCompleteListener, Co
|
|||
mlp.postInit(minecraft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
|
||||
mlp.onTick(minecraft, inGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
||||
return PonySettingsPanel.class;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.minelittlepony;
|
||||
|
||||
import com.minelittlepony.gui.GuiPonySettings;
|
||||
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
import com.minelittlepony.pony.data.PonyDataSerialzier;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||
import com.voxelmodpack.hdskins.skins.SkinServer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
@ -72,29 +70,13 @@ public class MineLittlePony {
|
|||
// logger.info("Set MineLP skin server URL.");
|
||||
manager.addClearListener(ponyManager);
|
||||
|
||||
manager.setPrefferedSkinsGuiClass(GuiSkinsMineLP.class);
|
||||
|
||||
RenderManager rm = minecraft.getRenderManager();
|
||||
renderManager.initialisePlayerRenderers(rm);
|
||||
renderManager.initializeMobRenderers(rm, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on every update tick
|
||||
*/
|
||||
void onTick(Minecraft minecraft, boolean inGame) {
|
||||
|
||||
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
||||
minecraft.displayGuiScreen(new GuiPonySettings());
|
||||
}
|
||||
|
||||
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
||||
&& !(minecraft.currentScreen instanceof GuiSkinsMineLP);
|
||||
if (skins) {
|
||||
minecraft.displayGuiScreen(new GuiSkinsMineLP(ponyManager));
|
||||
}
|
||||
HDSkinManager.INSTANCE.setEnabled(config.hd);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the global MineLP instance.
|
||||
*/
|
||||
|
|
|
@ -14,11 +14,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
*/
|
||||
public class GuiSkinsMineLP extends GuiSkins {
|
||||
|
||||
private PonyManager ponyManager;
|
||||
|
||||
public GuiSkinsMineLP(PonyManager manager) {
|
||||
ponyManager = manager;
|
||||
}
|
||||
private PonyManager ponyManager = MineLittlePony.getInstance().getManager();
|
||||
|
||||
@Override
|
||||
protected EntityPlayerModel getModel(GameProfile profile) {
|
||||
|
|
Loading…
Reference in a new issue