2015-11-17 06:09:04 +01:00
|
|
|
package com.brohoof.minelittlepony;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
import org.lwjgl.input.Keyboard;
|
|
|
|
|
|
|
|
import com.brohoof.minelittlepony.gui.PonySettingPanel;
|
|
|
|
import com.brohoof.minelittlepony.hdskins.gui.EntityPonyModel;
|
|
|
|
import com.brohoof.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
|
|
|
import com.brohoof.minelittlepony.hdskins.gui.RenderPonyModel;
|
|
|
|
import com.brohoof.minelittlepony.renderer.RenderPonySkeleton;
|
|
|
|
import com.brohoof.minelittlepony.renderer.RenderPonyVillager;
|
|
|
|
import com.brohoof.minelittlepony.renderer.RenderPonyZombie;
|
|
|
|
import com.brohoof.minelittlepony.util.MineLPLogger;
|
|
|
|
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.gui.GuiMainMenu;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
import net.minecraft.client.settings.KeyBinding;
|
|
|
|
import net.minecraft.entity.monster.EntityPigZombie;
|
|
|
|
import net.minecraft.entity.monster.EntitySkeleton;
|
|
|
|
import net.minecraft.entity.monster.EntityZombie;
|
|
|
|
import net.minecraft.entity.passive.EntityVillager;
|
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-01-26 09:20:39 +01:00
|
|
|
public static final String MOD_NAME = "Mine Little Pony";
|
|
|
|
public static final String MOD_VERSION = "@VERSION@";
|
|
|
|
|
2016-05-22 05:56:50 +02:00
|
|
|
public static final String MLP_SIZE = "mlp.size";
|
|
|
|
public static final String MLP_GENDER = "mlp.gender";
|
|
|
|
public static final String MLP_TAIL = "mlp.tail";
|
|
|
|
public static final String MLP_RACE = "mlp.race";
|
|
|
|
public static final String MLP_MAGIC = "mlp.magic";
|
|
|
|
|
2016-01-26 09:20:39 +01:00
|
|
|
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");
|
|
|
|
private static final KeyBinding SKIN_MANAGER = new KeyBinding("Skin Manager", Keyboard.KEY_F1, "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);
|
|
|
|
LiteLoader.getInput().registerKeyBinding(SKIN_MANAGER);
|
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-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());
|
|
|
|
MineLPLogger.info("Set MineLP skin server URL.");
|
|
|
|
|
|
|
|
RenderManager rm = minecraft.getRenderManager();
|
|
|
|
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
|
|
|
if (this.config.villagers) {
|
|
|
|
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
|
|
|
MineLPLogger.info("Villagers are now ponies.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.zombies) {
|
2016-03-01 06:33:09 +01:00
|
|
|
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<EntityZombie>(rm));
|
2016-01-26 09:20:39 +01:00
|
|
|
MineLPLogger.info("Zombies are now ponies.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.pigzombies) {
|
2016-03-01 06:33:09 +01:00
|
|
|
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyZombie<EntityPigZombie>(rm));
|
2016-01-26 09:20:39 +01:00
|
|
|
MineLPLogger.info("Zombie pigmen are now ponies.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.config.skeletons) {
|
|
|
|
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm));
|
|
|
|
MineLPLogger.info("Skeletons are now ponies.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void onTick(Minecraft minecraft, boolean inGame) {
|
|
|
|
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
|
|
|
minecraft.displayGuiScreen(new PonySettingPanel());
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean pressed = minecraft.currentScreen instanceof GuiMainMenu
|
|
|
|
&& Keyboard.isKeyDown(SKIN_MANAGER.getKeyCode());
|
|
|
|
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
|
|
|
&& !(minecraft.currentScreen instanceof GuiSkinsMineLP);
|
|
|
|
if (pressed || skins) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getSPUsername() {
|
2015-11-17 06:17:35 +01:00
|
|
|
return Minecraft.getMinecraft().getSession().getUsername();
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2016-01-26 09:20:39 +01:00
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|