2015-11-17 06:09:04 +01:00
|
|
|
package com.brohoof.minelittlepony;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import org.lwjgl.input.Keyboard;
|
|
|
|
|
2015-11-17 06:09:04 +01:00
|
|
|
import com.brohoof.minelittlepony.gui.MineLittlePonyGUI;
|
|
|
|
import com.brohoof.minelittlepony.gui.MineLittlePonyGUIMob;
|
|
|
|
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;
|
2015-08-02 00:36:33 +02:00
|
|
|
import com.mumfrey.liteloader.InitCompleteListener;
|
|
|
|
import com.mumfrey.liteloader.core.LiteLoader;
|
|
|
|
import com.mumfrey.liteloader.util.ModUtilities;
|
|
|
|
import com.voxelmodpack.common.properties.gui.SettingsPanelManager;
|
|
|
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
|
|
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
|
|
|
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
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;
|
|
|
|
|
|
|
|
public class MineLittlePony implements InitCompleteListener {
|
2015-11-17 06:17:35 +01:00
|
|
|
|
|
|
|
public static final String MOD_VERSION = "@VERSION@";
|
2015-08-02 00:36:33 +02:00
|
|
|
public static final String MOD_NAME = "Mine Little Pony";
|
|
|
|
public static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com";
|
|
|
|
public static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
|
|
|
|
public static final String UPLOAD_URL = "http://minelpskinmanager.voxelmodpack.com/";
|
|
|
|
private static final KeyBinding guiKeybinding = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
|
|
|
private static final KeyBinding skinKeybinding = 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
|
|
|
|
|
|
|
public MineLittlePony() {
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static MineLittlePony getInstance() {
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return MOD_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getVersion() {
|
|
|
|
return MOD_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void upgradeSettings(String version, File configPath, File oldConfigPath) {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void init(File configPath) {
|
|
|
|
LiteLoader.getInput().registerKeyBinding(guiKeybinding);
|
|
|
|
LiteLoader.getInput().registerKeyBinding(skinKeybinding);
|
2015-11-17 06:17:35 +01:00
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
SettingsPanelManager.addSettingsPanel("Pony", MineLittlePonyGUI.class);
|
|
|
|
SettingsPanelManager.addSettingsPanel("Pony Mobs", MineLittlePonyGUIMob.class);
|
|
|
|
|
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();
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
LiteLoader.getInstance().registerExposable(config, null);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
2016-01-19 06:34:07 +01:00
|
|
|
|
|
|
|
HDSkinManager.clearSkinCache();
|
|
|
|
HDSkinManager manager = HDSkinManager.INSTANCE;
|
|
|
|
manager.setSkinUrl(config.skinfix ? GATEWAY_URL : SKIN_SERVER_URL);
|
|
|
|
manager.setGatewayURL(GATEWAY_URL);
|
|
|
|
manager.addSkinModifier(new PonySkinModifier());
|
|
|
|
MineLPLogger.info("Set MineLP skin server URL.");
|
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
RenderManager rm = minecraft.getRenderManager();
|
|
|
|
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
2015-11-17 06:17:35 +01:00
|
|
|
if (this.config.getVillagers().get()) {
|
2015-08-02 00:36:33 +02:00
|
|
|
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
|
|
|
MineLPLogger.info("Villagers are now ponies.");
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
if (this.config.getZombies().get()) {
|
2015-08-02 00:36:33 +02:00
|
|
|
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie(rm));
|
|
|
|
MineLPLogger.info("Zombies are now ponies.");
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
if (this.config.getPigZombies().get()) {
|
2015-08-02 00:36:33 +02:00
|
|
|
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyZombie(rm));
|
|
|
|
MineLPLogger.info("Zombie pigmen are now ponies.");
|
|
|
|
}
|
|
|
|
|
2015-11-17 06:17:35 +01:00
|
|
|
if (this.config.getSkeletons().get()) {
|
2015-08-02 00:36:33 +02:00
|
|
|
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm));
|
|
|
|
MineLPLogger.info("Skeletons are now ponies.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
|
|
|
|
if (inGame && minecraft.currentScreen == null && guiKeybinding.isPressed()) {
|
2015-08-13 04:41:51 +02:00
|
|
|
minecraft.displayGuiScreen(new MineLittlePonyGUI());
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2015-08-13 04:41:51 +02:00
|
|
|
boolean pressed = minecraft.currentScreen instanceof GuiMainMenu
|
|
|
|
&& Keyboard.isKeyDown(skinKeybinding.getKeyCode());
|
|
|
|
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
|
|
|
&& !(minecraft.currentScreen instanceof GuiSkinsMineLP);
|
|
|
|
if (pressed || skins) {
|
2015-11-17 06:17:35 +01:00
|
|
|
minecraft.displayGuiScreen(new GuiSkinsMineLP(ponyManager));
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2016-01-19 06:34:07 +01:00
|
|
|
HDSkinManager.INSTANCE.setEnabled(config.getHd().get());
|
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
|
|
|
}
|
2015-11-17 06:17:35 +01:00
|
|
|
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|