2016-11-17 05:45:04 +01:00
|
|
|
package com.minelittlepony;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.gui.PonySettingPanel;
|
|
|
|
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
|
|
|
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
|
|
|
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
2016-11-24 08:01:23 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyEvoker;
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyPigman;
|
|
|
|
import com.minelittlepony.renderer.RenderPonySkeleton;
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyVex;
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyVillager;
|
2016-11-24 08:01:23 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyVindicator;
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.renderer.RenderPonyZombie;
|
|
|
|
import com.minelittlepony.renderer.RenderPonyZombieVillager;
|
2016-01-26 09:20:39 +01:00
|
|
|
import com.mumfrey.liteloader.core.LiteLoader;
|
|
|
|
import com.mumfrey.liteloader.util.ModUtilities;
|
|
|
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
|
|
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
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-24 08:01:23 +01:00
|
|
|
import net.minecraft.entity.monster.EntityEvoker;
|
2016-11-17 05:45:04 +01:00
|
|
|
import net.minecraft.entity.monster.EntityHusk;
|
2016-01-26 09:20:39 +01:00
|
|
|
import net.minecraft.entity.monster.EntityPigZombie;
|
|
|
|
import net.minecraft.entity.monster.EntitySkeleton;
|
2016-11-17 05:45:04 +01:00
|
|
|
import net.minecraft.entity.monster.EntityStray;
|
2016-11-17 05:45:04 +01:00
|
|
|
import net.minecraft.entity.monster.EntityVex;
|
2016-11-24 08:01:23 +01:00
|
|
|
import net.minecraft.entity.monster.EntityVindicator;
|
2016-11-17 05:45:04 +01:00
|
|
|
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
2016-01-26 09:20:39 +01:00
|
|
|
import net.minecraft.entity.monster.EntityZombie;
|
2016-11-17 05:45:04 +01:00
|
|
|
import net.minecraft.entity.monster.EntityZombieVillager;
|
2016-01-26 09:20:39 +01:00
|
|
|
import net.minecraft.entity.passive.EntityVillager;
|
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
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
public static final String MOD_NAME = "Mine Little Pony";
|
|
|
|
public static final String MOD_VERSION = "@VERSION@";
|
|
|
|
|
|
|
|
private static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com";
|
|
|
|
private static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
|
|
|
|
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;
|
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
private PonyConfig config;
|
|
|
|
private PonyManager ponyManager;
|
2015-11-17 06:19:58 +01:00
|
|
|
private ProxyContainer proxy;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
MineLittlePony() {
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void init() {
|
|
|
|
LiteLoader.getInput().registerKeyBinding(SETTINGS_GUI);
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
this.config = new PonyConfig();
|
|
|
|
this.ponyManager = new PonyManager(config);
|
2015-11-17 06:19:58 +01:00
|
|
|
this.proxy = new ProxyContainer();
|
2016-01-26 09:20:39 +01: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();
|
|
|
|
irrm.registerReloadListener(this.ponyManager);
|
2016-11-24 08:01:23 +01:00
|
|
|
|
|
|
|
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
|
|
|
ms.registerMetadataSectionType(new PonyDataSerialzier(), IPonyData.class);
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void postInit(Minecraft minecraft) {
|
|
|
|
|
|
|
|
HDSkinManager.clearSkinCache();
|
|
|
|
HDSkinManager manager = HDSkinManager.INSTANCE;
|
|
|
|
manager.setSkinUrl(SKIN_SERVER_URL);
|
|
|
|
manager.setGatewayURL(GATEWAY_URL);
|
|
|
|
manager.addSkinModifier(new PonySkinModifier());
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Set MineLP skin server URL.");
|
2016-01-26 09:20:39 +01:00
|
|
|
|
|
|
|
RenderManager rm = minecraft.getRenderManager();
|
|
|
|
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
|
|
|
if (this.config.villagers) {
|
|
|
|
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
2016-11-17 05:45:04 +01:00
|
|
|
ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Villagers are now ponies.");
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.zombies) {
|
2016-11-25 05:40:19 +01:00
|
|
|
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<>(rm));
|
2016-11-17 05:45:04 +01:00
|
|
|
ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Zombies are now ponies.");
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.pigzombies) {
|
2016-08-22 23:32:03 +02:00
|
|
|
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyPigman(rm));
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Zombie pigmen are now ponies.");
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.skeletons) {
|
2016-11-25 05:40:19 +01:00
|
|
|
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<>(rm));
|
2016-11-17 05:45:04 +01:00
|
|
|
ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
|
|
|
|
ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Skeletons are now ponies.");
|
2016-01-26 09:20:39 +01:00
|
|
|
}
|
2016-11-24 08:01:23 +01:00
|
|
|
|
2016-11-17 05:45:04 +01:00
|
|
|
if (this.config.illagers) {
|
|
|
|
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
|
2016-11-24 08:01:23 +01:00
|
|
|
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
|
|
|
|
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
|
2016-11-25 05:40:19 +01:00
|
|
|
logger.info("Illagers are now ponies.");
|
2016-11-17 05:45:04 +01:00
|
|
|
}
|
2016-01-26 09:20:39 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void onTick(Minecraft minecraft, boolean inGame) {
|
2016-11-24 08:01:23 +01:00
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
|
|
|
minecraft.displayGuiScreen(new PonySettingPanel());
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
|
|
|
&& !(minecraft.currentScreen instanceof GuiSkinsMineLP);
|
2016-08-25 07:36:00 +02:00
|
|
|
if (skins) {
|
2016-01-26 09:20:39 +01:00
|
|
|
minecraft.displayGuiScreen(new GuiSkinsMineLP(ponyManager));
|
|
|
|
}
|
|
|
|
HDSkinManager.INSTANCE.setEnabled(config.hd);
|
2016-01-28 05:26:12 +01:00
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2016-01-26 09:16:11 +01:00
|
|
|
public static MineLittlePony getInstance() {
|
|
|
|
return instance;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
public PonyManager getManager() {
|
|
|
|
return this.ponyManager;
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:19:58 +01:00
|
|
|
public static ProxyContainer getProxy() {
|
|
|
|
return getInstance().proxy;
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
public static PonyConfig getConfig() {
|
2015-08-02 00:36:33 +02:00
|
|
|
return getInstance().config;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|