mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-21 03:44:22 +01:00
Update packages (again) and separate all Litemod code
This commit is contained in:
parent
711a5c6ff3
commit
5ce50f2d07
38 changed files with 438 additions and 236 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.client;
|
package com.minelittlepony.client;
|
||||||
|
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
|
||||||
import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
@ -15,11 +14,6 @@ import javax.annotation.Nullable;
|
||||||
*/
|
*/
|
||||||
public class ForgeProxy {
|
public class ForgeProxy {
|
||||||
|
|
||||||
/**
|
|
||||||
* True if forge is present.
|
|
||||||
*/
|
|
||||||
private static boolean forgeLoaded = ModUtilities.fmlIsPresent();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the mod armour texture for an associated item and slot.
|
* Gets the mod armour texture for an associated item and slot.
|
||||||
*
|
*
|
||||||
|
@ -31,7 +25,7 @@ public class ForgeProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
|
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
|
||||||
if (forgeLoaded)
|
if (MineLPClient.getInstance().getModUtilities().hasFml())
|
||||||
return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type);
|
return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type);
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +39,9 @@ public class ForgeProxy {
|
||||||
* @param def Default return value if no mods present
|
* @param def Default return value if no mods present
|
||||||
*/
|
*/
|
||||||
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
|
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
|
||||||
if (forgeLoaded)
|
if (MineLPClient.getInstance().getModUtilities().hasFml()) {
|
||||||
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
|
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
|
||||||
|
}
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
src/client/java/com/minelittlepony/client/IModUtilities.java
Normal file
17
src/client/java/com/minelittlepony/client/IModUtilities.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package com.minelittlepony.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Timer;
|
||||||
|
|
||||||
|
public interface IModUtilities {
|
||||||
|
<T extends TileEntity> void addRenderer(Class<T> type, TileEntitySpecialRenderer<T> renderer);
|
||||||
|
|
||||||
|
<T extends Entity> void addRenderer(Class<T> type, Render<T> renderer);
|
||||||
|
|
||||||
|
boolean hasFml();
|
||||||
|
|
||||||
|
Timer getGameTimer();
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.client.pony.PonyData;
|
||||||
import com.minelittlepony.client.pony.PonyDataSerialiser;
|
import com.minelittlepony.client.pony.PonyDataSerialiser;
|
||||||
import com.minelittlepony.client.pony.PonyManager;
|
import com.minelittlepony.client.pony.PonyManager;
|
||||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||||
|
import com.minelittlepony.common.client.gui.GuiHost;
|
||||||
import com.minelittlepony.hdskins.HDSkinManager;
|
import com.minelittlepony.hdskins.HDSkinManager;
|
||||||
import com.minelittlepony.hdskins.server.LegacySkinServer;
|
import com.minelittlepony.hdskins.server.LegacySkinServer;
|
||||||
import com.minelittlepony.hdskins.server.SkinServer;
|
import com.minelittlepony.hdskins.server.SkinServer;
|
||||||
|
@ -42,8 +43,18 @@ public class MineLPClient extends MineLittlePony {
|
||||||
private PonyConfig config;
|
private PonyConfig config;
|
||||||
private PonyManager ponyManager;
|
private PonyManager ponyManager;
|
||||||
|
|
||||||
|
private final IModUtilities utilities;
|
||||||
|
|
||||||
private final PonyRenderManager renderManager = PonyRenderManager.getInstance();
|
private final PonyRenderManager renderManager = PonyRenderManager.getInstance();
|
||||||
|
|
||||||
|
public static MineLPClient getInstance() {
|
||||||
|
return (MineLPClient)MineLittlePony.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MineLPClient(IModUtilities utils) {
|
||||||
|
utilities = utils;
|
||||||
|
}
|
||||||
|
|
||||||
void init(PonyConfig newConfig) {
|
void init(PonyConfig newConfig) {
|
||||||
config = newConfig;
|
config = newConfig;
|
||||||
ponyManager = new PonyManager(config);
|
ponyManager = new PonyManager(config);
|
||||||
|
@ -83,7 +94,7 @@ public class MineLPClient extends MineLittlePony {
|
||||||
void onTick(Minecraft minecraft, boolean inGame) {
|
void onTick(Minecraft minecraft, boolean inGame) {
|
||||||
if (inGame && minecraft.currentScreen == null) {
|
if (inGame && minecraft.currentScreen == null) {
|
||||||
if (SETTINGS_GUI.isPressed()) {
|
if (SETTINGS_GUI.isPressed()) {
|
||||||
minecraft.displayGuiScreen(new GuiPonySettings());
|
minecraft.displayGuiScreen(new GuiHost(new GuiPonySettings()));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ((Minecraft.getSystemTime() % 10) == 0) {
|
if ((Minecraft.getSystemTime() % 10) == 0) {
|
||||||
|
@ -126,4 +137,8 @@ public class MineLPClient extends MineLittlePony {
|
||||||
public PonyConfig getConfig() {
|
public PonyConfig getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IModUtilities getModUtilities() {
|
||||||
|
return utilities;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import com.minelittlepony.client.render.entities.MobRenderers;
|
||||||
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
||||||
import com.minelittlepony.hdskins.entity.EntityPonyModel;
|
import com.minelittlepony.hdskins.entity.EntityPonyModel;
|
||||||
import com.minelittlepony.settings.PonyConfig;
|
import com.minelittlepony.settings.PonyConfig;
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ public class PonyRenderManager {
|
||||||
*/
|
*/
|
||||||
public void initialisePlayerRenderers(RenderManager manager) {
|
public void initialisePlayerRenderers(RenderManager manager) {
|
||||||
// Preview on the select skin gui
|
// Preview on the select skin gui
|
||||||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
|
MineLPClient.getInstance().getModUtilities().addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
|
||||||
|
|
||||||
PlayerModels[] models = PlayerModels.values();
|
PlayerModels[] models = PlayerModels.values();
|
||||||
|
|
||||||
|
@ -93,10 +92,10 @@ public class PonyRenderManager {
|
||||||
if (!renderMap.containsKey(type)) {
|
if (!renderMap.containsKey(type)) {
|
||||||
renderMap.put(type, manager.getEntityClassRenderObject(type));
|
renderMap.put(type, manager.getEntityClassRenderObject(type));
|
||||||
}
|
}
|
||||||
ModUtilities.addRenderer((Class<T>)type, renderer);
|
MineLPClient.getInstance().getModUtilities().addRenderer((Class<T>)type, renderer);
|
||||||
} else {
|
} else {
|
||||||
if (renderMap.containsKey(type)) {
|
if (renderMap.containsKey(type)) {
|
||||||
ModUtilities.addRenderer(type, (Render<V>)renderMap.get(type));
|
MineLPClient.getInstance().getModUtilities().addRenderer(type, (Render<V>)renderMap.get(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.minelittlepony.client.gui;
|
package com.minelittlepony.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.client.render.entities.MobRenderers;
|
import com.minelittlepony.client.render.entities.MobRenderers;
|
||||||
import com.minelittlepony.common.gui.Checkbox;
|
import com.minelittlepony.common.client.gui.Checkbox;
|
||||||
import com.minelittlepony.common.gui.Label;
|
import com.minelittlepony.common.client.gui.GameGui;
|
||||||
import com.minelittlepony.common.gui.SettingsPanel;
|
import com.minelittlepony.common.client.gui.GuiHost;
|
||||||
import com.minelittlepony.common.gui.Slider;
|
import com.minelittlepony.common.client.gui.IGuiGuest;
|
||||||
|
import com.minelittlepony.common.client.gui.Label;
|
||||||
|
import com.minelittlepony.common.client.gui.Slider;
|
||||||
import com.minelittlepony.settings.PonyConfig;
|
import com.minelittlepony.settings.PonyConfig;
|
||||||
import com.minelittlepony.settings.PonyLevel;
|
import com.minelittlepony.settings.PonyLevel;
|
||||||
import com.minelittlepony.settings.PonyConfig.PonySettings;
|
import com.minelittlepony.settings.PonyConfig.PonySettings;
|
||||||
|
@ -14,7 +18,7 @@ import com.minelittlepony.settings.PonyConfig.PonySettings;
|
||||||
* In-Game options menu.
|
* In-Game options menu.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GuiPonySettings extends SettingsPanel {
|
public class GuiPonySettings implements IGuiGuest {
|
||||||
|
|
||||||
private static final String OPTIONS_PREFIX = "minelp.options.";
|
private static final String OPTIONS_PREFIX = "minelp.options.";
|
||||||
|
|
||||||
|
@ -29,29 +33,29 @@ public class GuiPonySettings extends SettingsPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui(GuiHost host) {
|
||||||
final int LEFT = width / 10;
|
final int LEFT = host.width / 10;
|
||||||
final int RIGHT = mustScroll() ? LEFT : width - width / 3 - 16;
|
final int RIGHT = host.mustScroll() ? LEFT : host.width - host.width / 3 - 16;
|
||||||
|
|
||||||
int row = mustScroll() ? 0 : 32;
|
int row = host.mustScroll() ? 0 : 32;
|
||||||
|
|
||||||
if (!mustScroll()) {
|
if (!host.mustScroll()) {
|
||||||
addButton(new Label(width / 2, 12, getTitle(), -1, true));
|
host.addButton(new Label(host.width / 2, 12, getTitle(), -1, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(new Label(LEFT, row += 15, PONY_LEVEL, -1));
|
host.addButton(new Label(LEFT, row += 15, PONY_LEVEL, -1));
|
||||||
addButton(new Slider(LEFT, row += 15, 0, 2, config.getPonyLevel().ordinal(), (int id, String name, float value) -> {
|
host.addButton(new Slider(LEFT, row += 15, 0, 2, config.getPonyLevel().ordinal(), (int id, String name, float value) -> {
|
||||||
return format(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase());
|
return GameGui.format(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase());
|
||||||
}, v -> {
|
}, v -> {
|
||||||
PonyLevel level = PonyLevel.valueFor(v);
|
PonyLevel level = PonyLevel.valueFor(v);
|
||||||
config.setPonyLevel(level);
|
config.setPonyLevel(level);
|
||||||
return (float)level.ordinal();
|
return (float)level.ordinal();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (isCtrlKeyDown() && isShiftKeyDown()) {
|
if (GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()) {
|
||||||
addButton(new Label(LEFT, row += 30, "minelp.debug.scale", -1));
|
host.addButton(new Label(LEFT, row += 30, "minelp.debug.scale", -1));
|
||||||
addButton(new Slider(LEFT, row += 15, 0.1F, 3, config.getGlobalScaleFactor(), (int id, String name, float value) -> {
|
host.addButton(new Slider(LEFT, row += 15, 0.1F, 3, config.getGlobalScaleFactor(), (int id, String name, float value) -> {
|
||||||
return format("minelp.debug.scale.value", format(describeCurrentScale(value)));
|
return GameGui.format("minelp.debug.scale.value", GameGui.format(describeCurrentScale(value)));
|
||||||
}, v -> {
|
}, v -> {
|
||||||
config.setGlobalScaleFactor(v);
|
config.setGlobalScaleFactor(v);
|
||||||
return config.getGlobalScaleFactor();
|
return config.getGlobalScaleFactor();
|
||||||
|
@ -59,55 +63,55 @@ public class GuiPonySettings extends SettingsPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
row += 15;
|
row += 15;
|
||||||
addButton(new Label(LEFT, row += 15, OPTIONS_PREFIX + "options", -1));
|
host.addButton(new Label(LEFT, row += 15, OPTIONS_PREFIX + "options", -1));
|
||||||
for (PonySettings i : PonySettings.values()) {
|
for (PonySettings i : PonySettings.values()) {
|
||||||
addButton(new Checkbox(LEFT, row += 15, OPTIONS_PREFIX + i.name().toLowerCase(), i.get(), i));
|
host.addButton(new Checkbox(LEFT, row += 20, OPTIONS_PREFIX + i.name().toLowerCase(), i.get(), i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mustScroll()) {
|
if (host.mustScroll()) {
|
||||||
row += 15;
|
row += 15;
|
||||||
} else {
|
} else {
|
||||||
row = 32;
|
row = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(new Label(RIGHT, row += 15, MOB_PREFIX + "title", -1));
|
host.addButton(new Label(RIGHT, row += 15, MOB_PREFIX + "title", -1));
|
||||||
for (MobRenderers i : MobRenderers.values()) {
|
for (MobRenderers i : MobRenderers.values()) {
|
||||||
addButton(new Checkbox(RIGHT, row += 15, MOB_PREFIX + i.name().toLowerCase(), i.get(), i));
|
host.addButton(new Checkbox(RIGHT, row += 20, MOB_PREFIX + i.name().toLowerCase(), i.get(), i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String describeCurrentScale(float value) {
|
public String describeCurrentScale(float value) {
|
||||||
if (value >= 3) {
|
if (value >= 3) {
|
||||||
return format("minelp.debug.scale.meg");
|
return GameGui.format("minelp.debug.scale.meg");
|
||||||
}
|
}
|
||||||
if (value == 2) {
|
if (value == 2) {
|
||||||
return format("minelp.debug.scale.max");
|
return GameGui.format("minelp.debug.scale.max");
|
||||||
}
|
}
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
return format("minelp.debug.scale.mid");
|
return GameGui.format("minelp.debug.scale.mid");
|
||||||
}
|
}
|
||||||
if (value == 0.9F) {
|
if (value == 0.9F) {
|
||||||
return format("minelp.debug.scale.sa");
|
return GameGui.format("minelp.debug.scale.sa");
|
||||||
}
|
}
|
||||||
if (value <= 0.1F) {
|
if (value <= 0.1F) {
|
||||||
return format("minelp.debug.scale.min");
|
return GameGui.format("minelp.debug.scale.min");
|
||||||
}
|
}
|
||||||
return String.format("%f", value);
|
return String.format("%f", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawContents(int mouseX, int mouseY, float partialTicks) {
|
public boolean drawContents(GuiHost host, int mouseX, int mouseY, float partialTicks) {
|
||||||
drawDefaultBackground();
|
host.drawDefaultBackground();
|
||||||
super.drawContents(mouseX, mouseY, partialTicks);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed(GuiHost host) {
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
public String getTitle() {
|
||||||
return OPTIONS_PREFIX + "title";
|
return OPTIONS_PREFIX + "title";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.minelittlepony.client.gui.hdskins;
|
package com.minelittlepony.client.gui.hdskins;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.common.gui.IconicToggle;
|
import com.minelittlepony.common.client.gui.IconicToggle;
|
||||||
import com.minelittlepony.common.gui.Style;
|
import com.minelittlepony.common.client.gui.Style;
|
||||||
import com.minelittlepony.hdskins.entity.EntityPonyModel;
|
import com.minelittlepony.hdskins.entity.EntityPonyModel;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
||||||
import com.minelittlepony.hdskins.gui.GuiSkins;
|
import com.minelittlepony.hdskins.gui.GuiSkins;
|
||||||
|
|
|
@ -3,11 +3,11 @@ package com.minelittlepony.client.render;
|
||||||
import org.lwjgl.opengl.GL14;
|
import org.lwjgl.opengl.GL14;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
import com.minelittlepony.client.MineLPClient;
|
||||||
import com.minelittlepony.client.ducks.IRenderItem;
|
import com.minelittlepony.client.ducks.IRenderItem;
|
||||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||||
import com.minelittlepony.client.util.render.Color;
|
import com.minelittlepony.client.util.render.Color;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.mumfrey.liteloader.client.overlays.IMinecraft;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
@ -120,7 +120,7 @@ public class LevitatingItemRenderer {
|
||||||
boolean doNormal = entity.getItemInUseCount() <= 0 || action == EnumAction.NONE;
|
boolean doNormal = entity.getItemInUseCount() <= 0 || action == EnumAction.NONE;
|
||||||
|
|
||||||
if (doNormal) { // eating, blocking, and drinking are not transformed. Only held items.
|
if (doNormal) { // eating, blocking, and drinking are not transformed. Only held items.
|
||||||
float ticks = ((IMinecraft)Minecraft.getMinecraft()).getTimer().elapsedPartialTicks - entity.ticksExisted;
|
float ticks = MineLPClient.getInstance().getModUtilities().getGameTimer().elapsedPartialTicks - entity.ticksExisted;
|
||||||
|
|
||||||
float floatAmount = (float)Math.sin(ticks / 9) / 40;
|
float floatAmount = (float)Math.sin(ticks / 9) / 40;
|
||||||
float driftAmount = (float)Math.cos(ticks / 6) / 40;
|
float driftAmount = (float)Math.cos(ticks / 6) / 40;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.minelittlepony.client.render.tileentities.skull;
|
package com.minelittlepony.client.render.tileentities.skull;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
import com.minelittlepony.client.MineLPClient;
|
||||||
import com.minelittlepony.client.ducks.IRenderItem;
|
import com.minelittlepony.client.ducks.IRenderItem;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.minelittlepony.settings.PonyConfig;
|
import com.minelittlepony.settings.PonyConfig;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||||
import net.minecraft.tileentity.TileEntitySkull;
|
import net.minecraft.tileentity.TileEntitySkull;
|
||||||
|
@ -51,7 +51,7 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
||||||
if (MineLittlePony.getInstance().getConfig().ponyskulls) {
|
if (MineLittlePony.getInstance().getConfig().ponyskulls) {
|
||||||
if (!(instance instanceof PonySkullRenderer)) {
|
if (!(instance instanceof PonySkullRenderer)) {
|
||||||
backup = instance;
|
backup = instance;
|
||||||
ModUtilities.addRenderer(TileEntitySkull.class, ponyInstance);
|
MineLPClient.getInstance().getModUtilities().addRenderer(TileEntitySkull.class, ponyInstance);
|
||||||
instance = ponyInstance;
|
instance = ponyInstance;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,7 +60,7 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
||||||
if (backup == null) {
|
if (backup == null) {
|
||||||
backup = new TileEntitySkullRenderer();
|
backup = new TileEntitySkullRenderer();
|
||||||
}
|
}
|
||||||
ModUtilities.addRenderer(TileEntitySkull.class, backup);
|
MineLPClient.getInstance().getModUtilities().addRenderer(TileEntitySkull.class, backup);
|
||||||
instance = backup;
|
instance = backup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkbox that supports a gui action when it changes.
|
||||||
|
*
|
||||||
|
* @author Sollace
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Checkbox extends Slider implements IGuiTooltipped<Checkbox> {
|
||||||
|
|
||||||
|
protected static final ResourceLocation RECIPE_BOOK = new ResourceLocation("textures/gui/widgets.png");
|
||||||
|
|
||||||
|
private int tipX = 0;
|
||||||
|
private int tipY = 0;
|
||||||
|
|
||||||
|
private List<String> tooltip = null;
|
||||||
|
|
||||||
|
private boolean checked;
|
||||||
|
|
||||||
|
private IGuiCallback<Boolean> switchAction;
|
||||||
|
|
||||||
|
public Checkbox(int x, int y, String displayString, boolean value, IGuiCallback<Boolean> callback) {
|
||||||
|
super(x, y, 0, 1, (value ? 1 : 0), (i, name, v) -> I18n.format(displayString), null);
|
||||||
|
|
||||||
|
checked = value;
|
||||||
|
|
||||||
|
width = 20;
|
||||||
|
height = 20;
|
||||||
|
|
||||||
|
switchAction = callback;
|
||||||
|
action = this::perform;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSliderValue(float value, boolean notifyResponder) {
|
||||||
|
super.setSliderValue(value >= 0.5F ? 1 : 0, notifyResponder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float perform(float v) {
|
||||||
|
boolean value = v >= 0.5F;
|
||||||
|
|
||||||
|
if (value != checked) {
|
||||||
|
checked = switchAction.perform(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return checked ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Checkbox setTooltip(List<String> tooltip) {
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderToolTip(Minecraft mc, int mouseX, int mouseY) {
|
||||||
|
if (visible && isMouseOver() && tooltip != null) {
|
||||||
|
mc.currentScreen.drawHoveringText(tooltip, mouseX + tipX, mouseY + tipY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Checkbox setTooltipOffset(int x, int y) {
|
||||||
|
tipX = x;
|
||||||
|
tipY = y;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawCenteredString(FontRenderer fonts, String text, int x, int y, int color) {
|
||||||
|
super.drawString(fonts, text, x + width - 5, y, color);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import net.minecraft.util.SoundEvent;
|
||||||
|
|
||||||
public abstract class GameGui extends GuiScreen {
|
public abstract class GameGui extends GuiScreen {
|
||||||
|
|
||||||
protected static String format(String string, Object... pars) {
|
public static String format(String string, Object... pars) {
|
||||||
return string == null ? null : I18n.format(string, pars);
|
return string == null ? null : I18n.format(string, pars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public abstract class GameGui extends GuiScreen {
|
||||||
* Formats a translation string and returns it in a list wrapped to a given width.
|
* Formats a translation string and returns it in a list wrapped to a given width.
|
||||||
* This can be safely used in initGui, where the fontRenderer is often still null.
|
* This can be safely used in initGui, where the fontRenderer is often still null.
|
||||||
*/
|
*/
|
||||||
protected List<String> formatMultiLine(String string, int width, Object...pars) {
|
public List<String> formatMultiLine(String string, int width, Object...pars) {
|
||||||
FontRenderer fr = fontRenderer;
|
FontRenderer fr = fontRenderer;
|
||||||
|
|
||||||
if (fr == null) {
|
if (fr == null) {
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
|
||||||
|
public class GuiHost extends GameGui {
|
||||||
|
|
||||||
|
private final IGuiGuest guest;
|
||||||
|
|
||||||
|
public GuiHost(IGuiGuest guest) {
|
||||||
|
this.guest = guest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
guest.initGui(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawContents(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
if (guest.drawContents(this, mouseX, mouseY, partialTicks)) {
|
||||||
|
super.drawContents(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
guest.onGuiClosed(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return guest.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends GuiButton> T addButton(T button) {
|
||||||
|
return super.addButton(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mustScroll() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response actions for UI events.
|
* Response actions for UI events.
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response actions for UI events.
|
* Response actions for UI events.
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
|
public interface IGuiGuest {
|
||||||
|
|
||||||
|
void initGui(GuiHost host);
|
||||||
|
|
||||||
|
default boolean drawContents(GuiHost host, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onGuiClosed(GuiHost host) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTitle();
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IStyleFactory {
|
public interface IStyleFactory {
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import com.minelittlepony.hdskins.util.MoreStreams;
|
import com.minelittlepony.hdskins.util.MoreStreams;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
|
@ -1,6 +1,9 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiSlider;
|
import net.minecraft.client.gui.GuiSlider;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
|
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,28 +16,29 @@ public class Slider extends GuiSlider {
|
||||||
|
|
||||||
private static Responder callback;
|
private static Responder callback;
|
||||||
|
|
||||||
|
protected IGuiCallback<Float> action;
|
||||||
|
|
||||||
public Slider(int x, int y, float minIn, float maxIn, float defaultValue, GuiSlider.FormatHelper formatter, IGuiCallback<Float> action) {
|
public Slider(int x, int y, float minIn, float maxIn, float defaultValue, GuiSlider.FormatHelper formatter, IGuiCallback<Float> action) {
|
||||||
super(callback = new Responder(action), 0, x, y, "", minIn, maxIn, defaultValue, formatter);
|
super(callback = new Responder(), 0, x, y, "", minIn, maxIn, defaultValue, formatter);
|
||||||
callback.owner = this;
|
callback.owner = this;
|
||||||
callback = null;
|
callback = null;
|
||||||
|
|
||||||
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class Responder implements GuiResponder {
|
private static final class Responder implements GuiResponder {
|
||||||
|
|
||||||
private final IGuiCallback<Float> action;
|
@Nullable
|
||||||
|
|
||||||
private Slider owner;
|
private Slider owner;
|
||||||
|
|
||||||
private Responder(IGuiCallback<Float> callback) {
|
|
||||||
action = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEntryValue(int id, boolean value) { }
|
public void setEntryValue(int id, boolean value) { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEntryValue(int id, float value) {
|
public void setEntryValue(int id, float value) {
|
||||||
owner.setSliderValue(action.perform(value), false);
|
if (owner != null) {
|
||||||
|
owner.setSliderValue(owner.action.perform(value), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.7",
|
"minVersion": "0.7",
|
||||||
"package": "com.minelittlepony.mixin",
|
"package": "com.minelittlepony.client.mixin",
|
||||||
"refmap": "minelp.mixin.refmap.json",
|
"refmap": "minelp.mixin.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.minelittlepony.common;
|
package com.minelittlepony.common;
|
||||||
|
|
||||||
import com.minelittlepony.common.gui.IGuiCallback;
|
import com.minelittlepony.common.client.gui.IGuiCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sensible config container that actually lets us programmatically index values by a key.
|
* A sensible config container that actually lets us programmatically index values by a key.
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.minelittlepony.common.gui;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checkbox that supports a gui action when it changes.
|
|
||||||
*
|
|
||||||
* @author Sollace
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Checkbox extends GuiCheckbox implements IGuiTooltipped<Checkbox> {
|
|
||||||
|
|
||||||
private int tipX = 0;
|
|
||||||
private int tipY = 0;
|
|
||||||
|
|
||||||
private List<String> tooltip = null;
|
|
||||||
|
|
||||||
private final IGuiCallback<Boolean> action;
|
|
||||||
|
|
||||||
public Checkbox(int x, int y, String displayString, boolean value, IGuiCallback<Boolean> callback) {
|
|
||||||
super(0, x, y, I18n.format(displayString));
|
|
||||||
action = callback;
|
|
||||||
checked = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void perform() {
|
|
||||||
checked = action.perform(!checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Checkbox setTooltip(List<String> tooltip) {
|
|
||||||
this.tooltip = tooltip;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderToolTip(Minecraft mc, int mouseX, int mouseY) {
|
|
||||||
if (visible && isMouseOver() && tooltip != null) {
|
|
||||||
mc.currentScreen.drawHoveringText(tooltip, mouseX + tipX, mouseY + tipY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Checkbox setTooltipOffset(int x, int y) {
|
|
||||||
tipX = x;
|
|
||||||
tipY = y;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
|
||||||
if (super.mousePressed(mc, mouseX, mouseY)) {
|
|
||||||
perform();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,8 +30,6 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
@ -194,7 +192,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
// schedule texture loading on the main thread.
|
// schedule texture loading on the main thread.
|
||||||
TextureLoader.loadTexture(resource, new ThreadDownloadImageData(
|
TextureLoader.loadTexture(resource, new ThreadDownloadImageData(
|
||||||
new File(LiteLoader.getAssetsDirectory(), "hd/" + skinDir + texture.getHash().substring(0, 2) + "/" + texture.getHash()),
|
new File(HDSkins.getInstance().getAssetsDirectory(), "hd/" + skinDir + texture.getHash().substring(0, 2) + "/" + texture.getHash()),
|
||||||
texture.getUrl(),
|
texture.getUrl(),
|
||||||
DefaultPlayerSkin.getDefaultSkinLegacy(),
|
DefaultPlayerSkin.getDefaultSkinLegacy(),
|
||||||
new ImageBufferDownloadHD(type, () -> {
|
new ImageBufferDownloadHD(type, () -> {
|
||||||
|
@ -243,9 +241,9 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSkinCache() {
|
public void clearSkinCache() {
|
||||||
LiteLoaderLogger.info("Clearing local player skin cache");
|
logger.info("Clearing local player skin cache");
|
||||||
|
|
||||||
FileUtils.deleteQuietly(new File(LiteLoader.getAssetsDirectory(), "hd"));
|
FileUtils.deleteQuietly(new File(HDSkins.getInstance().getAssetsDirectory(), "hd"));
|
||||||
|
|
||||||
skins.invalidateAll();
|
skins.invalidateAll();
|
||||||
parseSkins();
|
parseSkins();
|
||||||
|
|
68
src/hdskins/java/com/minelittlepony/hdskins/HDSkins.java
Normal file
68
src/hdskins/java/com/minelittlepony/hdskins/HDSkins.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package com.minelittlepony.hdskins;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
||||||
|
import com.minelittlepony.hdskins.gui.RenderPlayerModel;
|
||||||
|
import com.minelittlepony.hdskins.server.SkinServer;
|
||||||
|
import com.minelittlepony.hdskins.upload.GLWindow;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public abstract class HDSkins {
|
||||||
|
public static final String MOD_NAME = "HD Skins";
|
||||||
|
public static final String VERSION = "4.0.0";
|
||||||
|
|
||||||
|
private static HDSkins instance;
|
||||||
|
|
||||||
|
public static HDSkins getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HDSkins() {
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
public List<SkinServer> skin_servers = SkinServer.defaultServers;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
public boolean experimentalSkinDrop = false;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
public String lastChosenFile = "";
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||||
|
irrm.registerReloadListener(HDSkinManager.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract File getAssetsDirectory();
|
||||||
|
|
||||||
|
public abstract void saveConfig();
|
||||||
|
|
||||||
|
protected abstract <T extends Entity> void addRenderer(Class<T> type, Function<RenderManager, Render<T>> renderer);
|
||||||
|
|
||||||
|
public void initComplete() {
|
||||||
|
addRenderer(EntityPlayerModel.class, RenderPlayerModel::new);
|
||||||
|
|
||||||
|
// register skin servers.
|
||||||
|
skin_servers.forEach(HDSkinManager.INSTANCE::addSkinServer);
|
||||||
|
|
||||||
|
if (experimentalSkinDrop) {
|
||||||
|
GLWindow.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onToggledFullScreen(boolean fullScreen) {
|
||||||
|
GLWindow.current().refresh(fullScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,9 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
||||||
|
@ -20,7 +23,6 @@ import com.mojang.authlib.exceptions.AuthenticationException;
|
||||||
import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -34,6 +36,8 @@ import java.util.function.Predicate;
|
||||||
|
|
||||||
public class SkinUploader implements Closeable {
|
public class SkinUploader implements Closeable {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private final Iterator<SkinServer> skinServers;
|
private final Iterator<SkinServer> skinServers;
|
||||||
|
|
||||||
public static final String ERR_NO_SERVER = "hdskins.error.noserver";
|
public static final String ERR_NO_SERVER = "hdskins.error.noserver";
|
||||||
|
@ -187,7 +191,7 @@ public class SkinUploader implements Closeable {
|
||||||
|
|
||||||
return gateway.uploadSkin(new SkinUpload(mc.getSession(), skinType, localSkin == null ? null : localSkin.toURI(), skinMetadata)).handle((response, throwable) -> {
|
return gateway.uploadSkin(new SkinUpload(mc.getSession(), skinType, localSkin == null ? null : localSkin.toURI(), skinMetadata)).handle((response, throwable) -> {
|
||||||
if (throwable == null) {
|
if (throwable == null) {
|
||||||
LiteLoaderLogger.info("Upload completed with: %s", response);
|
logger.info("Upload completed with: %s", response);
|
||||||
setError(null);
|
setError(null);
|
||||||
} else {
|
} else {
|
||||||
setError(Throwables.getRootCause(throwable).toString());
|
setError(Throwables.getRootCause(throwable).toString());
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.minelittlepony.hdskins.gui;
|
package com.minelittlepony.hdskins.gui;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.minelittlepony.common.gui.Button;
|
import com.minelittlepony.common.client.gui.Button;
|
||||||
import com.minelittlepony.common.gui.GameGui;
|
import com.minelittlepony.common.client.gui.GameGui;
|
||||||
import com.minelittlepony.common.gui.IGuiAction;
|
import com.minelittlepony.common.client.gui.IGuiAction;
|
||||||
import com.minelittlepony.common.gui.IconicButton;
|
import com.minelittlepony.common.client.gui.IconicButton;
|
||||||
import com.minelittlepony.common.gui.IconicToggle;
|
import com.minelittlepony.common.client.gui.IconicToggle;
|
||||||
import com.minelittlepony.common.gui.Label;
|
import com.minelittlepony.common.client.gui.Label;
|
||||||
import com.minelittlepony.common.gui.Style;
|
import com.minelittlepony.common.client.gui.Style;
|
||||||
import com.minelittlepony.hdskins.HDSkinManager;
|
import com.minelittlepony.hdskins.HDSkinManager;
|
||||||
import com.minelittlepony.hdskins.SkinChooser;
|
import com.minelittlepony.hdskins.SkinChooser;
|
||||||
import com.minelittlepony.hdskins.SkinUploader;
|
import com.minelittlepony.hdskins.SkinUploader;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
package com.minelittlepony.hdskins.gui;
|
package com.minelittlepony.hdskins.gui;
|
||||||
|
|
||||||
import com.minelittlepony.common.gui.Checkbox;
|
import com.minelittlepony.common.client.gui.Checkbox;
|
||||||
import com.minelittlepony.common.gui.SettingsPanel;
|
import com.minelittlepony.common.client.gui.GuiHost;
|
||||||
import com.minelittlepony.hdskins.LiteModHDSkins;
|
import com.minelittlepony.common.client.gui.IGuiGuest;
|
||||||
|
import com.minelittlepony.hdskins.HDSkins;
|
||||||
import com.minelittlepony.hdskins.upload.GLWindow;
|
import com.minelittlepony.hdskins.upload.GLWindow;
|
||||||
|
|
||||||
public class HDSkinsConfigPanel extends SettingsPanel {
|
public class HDSkinsConfigPanel implements IGuiGuest {
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui(GuiHost host) {
|
||||||
final LiteModHDSkins mod = LiteModHDSkins.instance();
|
final HDSkins mod = HDSkins.getInstance();
|
||||||
|
|
||||||
addButton(new Checkbox(40, 40, "hdskins.options.skindrops", mod.experimentalSkinDrop, checked -> {
|
host.addButton(new Checkbox(40, 40, "hdskins.options.skindrops", mod.experimentalSkinDrop, checked -> {
|
||||||
mod.experimentalSkinDrop = checked;
|
mod.experimentalSkinDrop = checked;
|
||||||
|
|
||||||
mod.writeConfig();
|
mod.saveConfig();
|
||||||
|
|
||||||
if (checked) {
|
if (checked) {
|
||||||
GLWindow.create();
|
GLWindow.create();
|
||||||
|
@ -22,11 +23,11 @@ public class HDSkinsConfigPanel extends SettingsPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
return checked;
|
return checked;
|
||||||
})).setTooltip(formatMultiLine("hdskins.warning.experimental", 250));
|
})).setTooltip(host.formatMultiLine("hdskins.warning.experimental", 250));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
public String getTitle() {
|
||||||
return "HD Skins Settings";
|
return "HD Skins Settings";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.minelittlepony.hdskins;
|
package com.minelittlepony.hdskins.litemod;
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.minelittlepony.common.client.gui.GuiLiteHost;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPlayerModel;
|
import com.minelittlepony.hdskins.HDSkinManager;
|
||||||
|
import com.minelittlepony.hdskins.HDSkins;
|
||||||
import com.minelittlepony.hdskins.gui.HDSkinsConfigPanel;
|
import com.minelittlepony.hdskins.gui.HDSkinsConfigPanel;
|
||||||
import com.minelittlepony.hdskins.gui.RenderPlayerModel;
|
|
||||||
import com.minelittlepony.hdskins.server.SkinServer;
|
import com.minelittlepony.hdskins.server.SkinServer;
|
||||||
import com.minelittlepony.hdskins.server.SkinServerSerializer;
|
import com.minelittlepony.hdskins.server.SkinServerSerializer;
|
||||||
import com.minelittlepony.hdskins.upload.GLWindow;
|
|
||||||
import com.mumfrey.liteloader.Configurable;
|
import com.mumfrey.liteloader.Configurable;
|
||||||
import com.mumfrey.liteloader.InitCompleteListener;
|
import com.mumfrey.liteloader.InitCompleteListener;
|
||||||
import com.mumfrey.liteloader.ViewportListener;
|
import com.mumfrey.liteloader.ViewportListener;
|
||||||
|
@ -20,44 +19,28 @@ import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@ExposableOptions(strategy = ConfigStrategy.Unversioned, filename = "hdskins")
|
@ExposableOptions(strategy = ConfigStrategy.Unversioned, filename = "hdskins")
|
||||||
public class LiteModHDSkins implements InitCompleteListener, ViewportListener, Configurable, AdvancedExposable {
|
public class LiteModHDSkins extends HDSkins implements InitCompleteListener, ViewportListener, Configurable, AdvancedExposable {
|
||||||
|
|
||||||
private static LiteModHDSkins instance;
|
|
||||||
|
|
||||||
public static LiteModHDSkins instance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Expose
|
|
||||||
public List<SkinServer> skin_servers = SkinServer.defaultServers;
|
|
||||||
|
|
||||||
@Expose
|
|
||||||
public boolean experimentalSkinDrop = false;
|
|
||||||
|
|
||||||
@Expose
|
|
||||||
public String lastChosenFile = "";
|
|
||||||
|
|
||||||
public LiteModHDSkins() {
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "HD Skins";
|
return HDSkins.MOD_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return "4.0.0";
|
return HDSkins.VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeConfig() {
|
@Override
|
||||||
|
public void saveConfig() {
|
||||||
LiteLoader.getInstance().writeConfig(this);
|
LiteLoader.getInstance().writeConfig(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,9 +49,7 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
|
||||||
|
|
||||||
// register config
|
// register config
|
||||||
LiteLoader.getInstance().registerExposable(this, null);
|
LiteLoader.getInstance().registerExposable(this, null);
|
||||||
|
super.init();
|
||||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
|
||||||
irrm.registerReloadListener(HDSkinManager.INSTANCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,19 +69,12 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
||||||
return HDSkinsConfigPanel.class;
|
return Panel.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
||||||
ModUtilities.addRenderer(EntityPlayerModel.class, new RenderPlayerModel<>(minecraft.getRenderManager()));
|
initComplete();
|
||||||
|
|
||||||
// register skin servers.
|
|
||||||
skin_servers.forEach(HDSkinManager.INSTANCE::addSkinServer);
|
|
||||||
|
|
||||||
if (experimentalSkinDrop) {
|
|
||||||
GLWindow.create();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,6 +84,22 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFullScreenToggled(boolean fullScreen) {
|
public void onFullScreenToggled(boolean fullScreen) {
|
||||||
GLWindow.current().refresh(fullScreen);
|
super.onToggledFullScreen(fullScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <T extends Entity> void addRenderer(Class<T> type, Function<RenderManager, Render<T>> renderer) {
|
||||||
|
ModUtilities.addRenderer(type, renderer.apply(Minecraft.getMinecraft().getRenderManager()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getAssetsDirectory() {
|
||||||
|
return LiteLoader.getAssetsDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Panel extends GuiLiteHost {
|
||||||
|
public Panel() {
|
||||||
|
super(new HDSkinsConfigPanel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package com.minelittlepony.hdskins.mixin;
|
package com.minelittlepony.hdskins.mixin;
|
||||||
|
|
||||||
import com.minelittlepony.common.gui.IconicButton;
|
import com.minelittlepony.common.client.gui.IconicButton;
|
||||||
import com.minelittlepony.hdskins.HDSkinManager;
|
import com.minelittlepony.hdskins.HDSkinManager;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
|
|
|
@ -5,13 +5,13 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -26,6 +26,8 @@ import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class SkinResourceManager implements IResourceManagerReloadListener {
|
public class SkinResourceManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private ExecutorService executor = Executors.newSingleThreadExecutor();
|
private ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
private Map<UUID, Skin> uuidSkins = Maps.newHashMap();
|
private Map<UUID, Skin> uuidSkins = Maps.newHashMap();
|
||||||
|
@ -55,7 +57,7 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JsonParseException je) {
|
} catch (JsonParseException je) {
|
||||||
LiteLoaderLogger.warning(je, "Invalid skins.json in %s", res.getResourcePackName());
|
logger.warn("Invalid skins.json in " + res.getResourcePackName(), je);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.mojang.authlib.exceptions.AuthenticationException;
|
||||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
||||||
import com.mojang.util.UUIDTypeAdapter;
|
import com.mojang.util.UUIDTypeAdapter;
|
||||||
import com.mumfrey.liteloader.modconfig.Exposable;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.Session;
|
import net.minecraft.util.Session;
|
||||||
|
@ -21,7 +20,7 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public interface SkinServer extends Exposable {
|
public interface SkinServer {
|
||||||
|
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||||
|
|
|
@ -9,7 +9,7 @@ import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.minelittlepony.hdskins.LiteModHDSkins;
|
import com.minelittlepony.hdskins.HDSkins;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for "open file" dialog threads
|
* Base class for "open file" dialog threads
|
||||||
|
@ -39,7 +39,7 @@ public abstract class ThreadOpenFile extends Thread implements IFileDialog {
|
||||||
JFileChooser fileDialog = new JFileChooser();
|
JFileChooser fileDialog = new JFileChooser();
|
||||||
fileDialog.setDialogTitle(dialogTitle);
|
fileDialog.setDialogTitle(dialogTitle);
|
||||||
|
|
||||||
String last = LiteModHDSkins.instance().lastChosenFile;
|
String last = HDSkins.getInstance().lastChosenFile;
|
||||||
if (!StringUtils.isBlank(last)) {
|
if (!StringUtils.isBlank(last)) {
|
||||||
fileDialog.setSelectedFile(new File(last));
|
fileDialog.setSelectedFile(new File(last));
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,8 @@ public abstract class ThreadOpenFile extends Thread implements IFileDialog {
|
||||||
File f = fileDialog.getSelectedFile();
|
File f = fileDialog.getSelectedFile();
|
||||||
|
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
LiteModHDSkins.instance().lastChosenFile = f.getAbsolutePath();
|
HDSkins.getInstance().lastChosenFile = f.getAbsolutePath();
|
||||||
LiteModHDSkins.instance().writeConfig();
|
HDSkins.getInstance().saveConfig();
|
||||||
|
|
||||||
if (!f.exists() && f.getName().indexOf('.') == -1) {
|
if (!f.exists() && f.getName().indexOf('.') == -1) {
|
||||||
f = appendMissingExtension(f);
|
f = appendMissingExtension(f);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.7",
|
"minVersion": "0.7",
|
||||||
"package": "com.voxelmodpack.hdskins.mixin",
|
"package": "com.minelittlepony.hdskins.mixin",
|
||||||
"refmap": "hdskins.mixin.refmap.json",
|
"refmap": "hdskins.mixin.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinMinecraft",
|
"MixinMinecraft",
|
||||||
|
|
|
@ -2,23 +2,31 @@ package com.minelittlepony.client;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.client.gui.GuiPonySettings;
|
import com.minelittlepony.client.gui.GuiPonySettings;
|
||||||
|
import com.minelittlepony.common.client.gui.GuiLiteHost;
|
||||||
import com.minelittlepony.settings.PonyConfig;
|
import com.minelittlepony.settings.PonyConfig;
|
||||||
import com.mumfrey.liteloader.Configurable;
|
import com.mumfrey.liteloader.Configurable;
|
||||||
import com.mumfrey.liteloader.InitCompleteListener;
|
import com.mumfrey.liteloader.InitCompleteListener;
|
||||||
import com.mumfrey.liteloader.Tickable;
|
import com.mumfrey.liteloader.Tickable;
|
||||||
|
import com.mumfrey.liteloader.client.overlays.IMinecraft;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
||||||
import com.mumfrey.liteloader.modconfig.Exposable;
|
import com.mumfrey.liteloader.modconfig.Exposable;
|
||||||
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
||||||
|
import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Timer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class LiteModMineLittlePony implements InitCompleteListener, Tickable, Configurable {
|
public class LiteModMineLittlePony implements IModUtilities, InitCompleteListener, Tickable, Configurable {
|
||||||
|
|
||||||
private final MineLPClient mlp = new MineLPClient();
|
private final MineLPClient mlp = new MineLPClient(this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -56,7 +64,33 @@ public class LiteModMineLittlePony implements InitCompleteListener, Tickable, Co
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
||||||
return GuiPonySettings.class;
|
return Panel.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends TileEntity> void addRenderer(Class<T> type, TileEntitySpecialRenderer<T> renderer) {
|
||||||
|
ModUtilities.addRenderer(type, renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Entity> void addRenderer(Class<T> type, Render<T> renderer) {
|
||||||
|
ModUtilities.addRenderer(type, renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFml() {
|
||||||
|
return ModUtilities.fmlIsPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Timer getGameTimer() {
|
||||||
|
return ((IMinecraft)Minecraft.getMinecraft()).getTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Panel extends GuiLiteHost {
|
||||||
|
public Panel() {
|
||||||
|
super(new GuiPonySettings());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
|
@ -1,26 +1,26 @@
|
||||||
package com.minelittlepony.common.gui;
|
package com.minelittlepony.common.client.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.gl.GLClippingPlanes;
|
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.mumfrey.liteloader.gl.GLClippingPlanes;
|
||||||
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
|
import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
|
||||||
|
|
||||||
/**
|
import java.io.IOException;
|
||||||
* A GuiScreen that doubles as a liteloader panel. What is this madness!?
|
|
||||||
*/
|
public class GuiLiteHost extends GuiHost implements ConfigPanel {
|
||||||
public abstract class SettingsPanel extends GameGui implements ConfigPanel {
|
|
||||||
|
|
||||||
private boolean isInPanel = false;
|
private boolean isInPanel = false;
|
||||||
|
|
||||||
private int contentHeight;
|
private int contentHeight;
|
||||||
|
|
||||||
|
public GuiLiteHost(IGuiGuest guest) {
|
||||||
|
super(guest);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPanelTitle() {
|
public String getPanelTitle() {
|
||||||
return format(getTitle());
|
return format(getTitle());
|
||||||
|
@ -32,7 +32,7 @@ public abstract class SettingsPanel extends GameGui implements ConfigPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T extends GuiButton> T addButton(T button) {
|
public <T extends GuiButton> T addButton(T button) {
|
||||||
if (button.y > contentHeight) {
|
if (button.y > contentHeight) {
|
||||||
contentHeight = button.y;
|
contentHeight = button.y;
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,8 @@ public abstract class SettingsPanel extends GameGui implements ConfigPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean mustScroll() {
|
@Override
|
||||||
|
public boolean mustScroll() {
|
||||||
return isInPanel;
|
return isInPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getTitle();
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue