2016-11-17 05:45:04 +01:00
|
|
|
package com.minelittlepony;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-06-20 23:21:21 +02:00
|
|
|
import com.minelittlepony.gui.GuiPonySettings;
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
2018-04-25 13:02:10 +02:00
|
|
|
import com.minelittlepony.pony.data.IPonyData;
|
|
|
|
import com.minelittlepony.pony.data.PonyDataSerialzier;
|
2018-06-10 21:55:13 +02:00
|
|
|
import com.minelittlepony.render.PonySkullRenderer;
|
2016-01-26 09:20:39 +01:00
|
|
|
import com.mumfrey.liteloader.core.LiteLoader;
|
|
|
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
2018-07-14 05:05:21 +02:00
|
|
|
import com.voxelmodpack.hdskins.skins.LegacySkinServer;
|
2018-01-03 06:29:32 +01:00
|
|
|
import com.voxelmodpack.hdskins.skins.SkinServer;
|
2018-07-28 21:35:41 +02:00
|
|
|
import com.voxelmodpack.hdskins.skins.ValhallaSkinServer;
|
2015-08-02 00:36:33 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2016-01-26 09:20:39 +01:00
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
2016-08-22 23:32:03 +02:00
|
|
|
import net.minecraft.client.resources.IReloadableResourceManager;
|
2016-11-24 08:01:23 +01:00
|
|
|
import net.minecraft.client.resources.data.MetadataSerializer;
|
2016-01-26 09:20:39 +01:00
|
|
|
import net.minecraft.client.settings.KeyBinding;
|
2016-11-25 05:40:19 +01:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2016-11-24 08:01:23 +01:00
|
|
|
import org.lwjgl.input.Keyboard;
|
2015-11-17 06:17:35 +01:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Static MineLittlePony singleton class. Everything's controlled from up here.
|
|
|
|
*/
|
2016-01-26 09:16:11 +01:00
|
|
|
public class MineLittlePony {
|
2015-11-17 06:17:35 +01:00
|
|
|
|
2016-11-25 05:40:19 +01:00
|
|
|
public static final Logger logger = LogManager.getLogger("MineLittlePony");
|
|
|
|
|
2018-05-01 12:38:13 +02:00
|
|
|
public static final String MOD_NAME = "Mine Little Pony";
|
|
|
|
public static final String MOD_VERSION = "@VERSION@";
|
2018-04-25 21:29:49 +02:00
|
|
|
|
2018-07-28 21:35:41 +02:00
|
|
|
private static final String MINELP_VALHALLA_SERVER = "http://skins.minelittlepony-mod.com";
|
2018-07-14 05:05:21 +02:00
|
|
|
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
|
|
|
|
private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com";
|
2016-01-26 09:20:39 +01:00
|
|
|
|
|
|
|
private static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
private static MineLittlePony instance;
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
private final PonyConfig config;
|
|
|
|
private final PonyManager ponyManager;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
private final PonyRenderManager renderManager;
|
2016-12-01 08:24:21 +01:00
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
MineLittlePony() {
|
|
|
|
instance = this;
|
|
|
|
|
|
|
|
LiteLoader.getInput().registerKeyBinding(SETTINGS_GUI);
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
config = new PonyConfig();
|
|
|
|
ponyManager = new PonyManager(config);
|
2018-06-03 11:57:22 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
renderManager = new PonyRenderManager();
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2016-01-29 04:11:11 +01:00
|
|
|
LiteLoader.getInstance().registerExposable(config, null);
|
2016-08-22 23:32:03 +02:00
|
|
|
|
|
|
|
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
2018-04-25 21:29:49 +02:00
|
|
|
irrm.registerReloadListener(ponyManager);
|
2016-11-24 08:01:23 +01:00
|
|
|
|
|
|
|
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
|
|
|
ms.registerMetadataSectionType(new PonyDataSerialzier(), IPonyData.class);
|
2018-01-03 06:29:32 +01:00
|
|
|
|
|
|
|
// This also makes it the default gateway server.
|
2018-07-14 05:05:21 +02:00
|
|
|
SkinServer.defaultServers.add(new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY));
|
2018-07-28 21:35:41 +02:00
|
|
|
SkinServer.defaultServers.add(0, new ValhallaSkinServer(MINELP_VALHALLA_SERVER));
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Called when the game is ready.
|
|
|
|
*/
|
2016-01-26 09:20:39 +01:00
|
|
|
void postInit(Minecraft minecraft) {
|
|
|
|
|
|
|
|
HDSkinManager manager = HDSkinManager.INSTANCE;
|
2017-08-08 22:34:09 +02:00
|
|
|
// manager.setSkinUrl(SKIN_SERVER_URL);
|
|
|
|
// manager.setGatewayURL(GATEWAY_URL);
|
2016-01-26 09:20:39 +01:00
|
|
|
manager.addSkinModifier(new PonySkinModifier());
|
2017-08-08 22:34:09 +02:00
|
|
|
// logger.info("Set MineLP skin server URL.");
|
2018-06-03 11:57:22 +02:00
|
|
|
manager.addClearListener(ponyManager);
|
2016-01-26 09:20:39 +01:00
|
|
|
|
2018-08-19 23:55:38 +02:00
|
|
|
manager.setSkinsGui(GuiSkinsMineLP::new);
|
2018-06-10 18:54:50 +02:00
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
RenderManager rm = minecraft.getRenderManager();
|
2018-04-25 21:29:49 +02:00
|
|
|
renderManager.initialisePlayerRenderers(rm);
|
|
|
|
renderManager.initializeMobRenderers(rm, config);
|
2018-06-20 23:12:12 +02:00
|
|
|
}
|
2018-06-10 21:55:13 +02:00
|
|
|
|
2018-06-20 23:21:21 +02:00
|
|
|
void onTick(Minecraft minecraft, boolean inGame) {
|
|
|
|
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
|
|
|
minecraft.displayGuiScreen(new GuiPonySettings());
|
|
|
|
}
|
2018-06-20 23:28:29 +02:00
|
|
|
|
|
|
|
PonySkullRenderer.resolve();
|
2018-06-20 23:21:21 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the global MineLP instance.
|
|
|
|
*/
|
2016-01-26 09:16:11 +01:00
|
|
|
public static MineLittlePony getInstance() {
|
|
|
|
return instance;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the static pony manager instance.
|
|
|
|
*/
|
2015-11-17 06:17:35 +01:00
|
|
|
public PonyManager getManager() {
|
2018-04-24 14:55:32 +02:00
|
|
|
return ponyManager;
|
2015-11-17 06:17:35 +01:00
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the static pony render manager responsible for all entity renderers.
|
|
|
|
*/
|
|
|
|
public PonyRenderManager getRenderManager() {
|
|
|
|
return renderManager;
|
|
|
|
}
|
2015-11-17 06:17:35 +01:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the global MineLP client configuration.
|
|
|
|
*/
|
2015-11-17 06:17:35 +01:00
|
|
|
public static PonyConfig getConfig() {
|
2015-08-02 00:36:33 +02:00
|
|
|
return getInstance().config;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|