From b972fda9af1eb5b013542d2da24f8152a2db8d25 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Thu, 24 Nov 2016 02:01:23 -0500 Subject: [PATCH] Remove remote player skin metadata XP Also use java 8. --- build.gradle | 7 + build.number | 4 +- .../voxelmodpack/hdskins/IMetaHandler.java | 8 - .../hdskins/gui/EntityPlayerModel.java | 7 - .../hdskins/gui/GuiMetaHandler.java | 580 ------------------ .../voxelmodpack/hdskins/gui/GuiSkins.java | 84 +-- .../hdskins/gui/RenderPlayerModel.java | 5 - .../resources/assets/hdskins/lang/en_us.lang | 2 - .../com/minelittlepony/MineLittlePony.java | 11 +- src/main/java/com/minelittlepony/Pony.java | 45 -- .../hdskins/gui/GuiSkinsMineLP.java | 20 +- .../hdskins/gui/RenderPonyModel.java | 25 - .../assets/minelittlepony/lang/en_us.lang | 6 - src/main/resources/mixin.minelp.json | 1 + 14 files changed, 46 insertions(+), 759 deletions(-) delete mode 100644 src/hdskins/java/com/voxelmodpack/hdskins/IMetaHandler.java delete mode 100644 src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiMetaHandler.java diff --git a/build.gradle b/build.gradle index b40bd1de..aae4eb94 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,9 @@ group = 'com.brohoof.minelp' version = '1.11.0.0-beta' description = 'Mine Little Pony' +targetCompatibility = 1.8 +sourceCompatibility = 1.8 + minecraft { version = "1.11" // first snapshot for 1.11. Change to stable when possible. @@ -51,8 +54,12 @@ sourceSets { refMap = 'mixin.minelp.refmap.json' compileClasspath += hdskins.output } + } +compileApiJava.sourceCompatibility = 1.6 +compileApiJava.targetCompatibility = 1.6 + litemod.json { author = 'Verdana, Rene_Z, Mumfrey, JoyJoy' description = 'Mine Little Pony turns players and mobs into ponies' diff --git a/build.number b/build.number index ac47a096..1c0578c3 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon Nov 14 00:39:19 EST 2016 -build.number=255 +#Thu Nov 17 01:03:51 EST 2016 +build.number=258 diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/IMetaHandler.java b/src/hdskins/java/com/voxelmodpack/hdskins/IMetaHandler.java deleted file mode 100644 index a2be38c6..00000000 --- a/src/hdskins/java/com/voxelmodpack/hdskins/IMetaHandler.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.voxelmodpack.hdskins; - -import com.google.common.base.Optional; - -public interface IMetaHandler { - - Optional get(String key); -} diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java index 41f172e4..a2c095d9 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java @@ -10,7 +10,6 @@ import com.google.common.collect.Iterables; import com.mojang.authlib.GameProfile; import com.voxelmodpack.hdskins.DynamicTextureImage; import com.voxelmodpack.hdskins.HDSkinManager; -import com.voxelmodpack.hdskins.IMetaHandler; import com.voxelmodpack.hdskins.ImageBufferDownloadHD; import com.voxelmodpack.hdskins.PreviewTexture; @@ -36,7 +35,6 @@ public class EntityPlayerModel extends EntityLivingBase { public boolean isSwinging = false; protected boolean remoteSkin = false; protected boolean hasLocalTexture = false; - public IMetaHandler metaHandler; public EntityPlayerModel(GameProfile profile) { super((World) null); @@ -135,11 +133,6 @@ public class EntityPlayerModel extends EntityLivingBase { this.swingProgress = this.swingProgressInt / 8.0F; } - public void updateMeta(IMetaHandler guiMetaHandler) { - this.metaHandler = guiMetaHandler; - - } - @Override public EnumHandSide getPrimaryHand() { return Minecraft.getMinecraft().gameSettings.mainHand; diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiMetaHandler.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiMetaHandler.java deleted file mode 100644 index 71b5ae4d..00000000 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiMetaHandler.java +++ /dev/null @@ -1,580 +0,0 @@ -package com.voxelmodpack.hdskins.gui; - -import static net.minecraft.client.renderer.GlStateManager.*; - -import java.awt.Color; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.lwjgl.input.Keyboard; - -import com.google.common.base.Converter; -import com.google.common.base.Enums; -import com.google.common.base.Functions; -import com.google.common.base.Joiner; -import com.google.common.base.Optional; -import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.primitives.Ints; -import com.mumfrey.liteloader.client.gui.GuiCheckbox; -import com.mumfrey.webprefs.WebPreferencesManager; -import com.mumfrey.webprefs.interfaces.IWebPreferences; -import com.voxelmodpack.hdskins.HDSkinManager; -import com.voxelmodpack.hdskins.IMetaHandler; -import com.voxelmodpack.hdskins.gui.color.GuiColorButton; -import com.voxelmodpack.hdskins.gui.color.GuiColorButton.CloseListener; -import com.voxelmodpack.hdskins.gui.color.GuiControl; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiSlider; -import net.minecraft.client.gui.GuiSlider.FormatHelper; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.Entity; - -public class GuiMetaHandler extends GuiScreen implements IMetaHandler { - - private GuiScreen parent; - private List> options = Lists.newArrayList(); - protected int optionHeight = 5; - protected int optionPosX; - - private EntityPlayerModel model; - private float updateCounter; - - public GuiMetaHandler(GuiScreen parent, EntityPlayerModel localPlayer) { - this.parent = parent; - model = localPlayer; - } - - public > void selection(String name, Class options) { - this.options.add(new Sel(name, options)); - } - - public void bool(String name) { - this.options.add(new Bol(name)); - } - - public void number(String name, int min, int max) { - this.options.add(new Num(name, min, max)); - } - - public void color(String name) { - this.options.add(new Col(name)); - } - - @Override - public Optional get(String key) { - for (Opt opt : options) { - if (opt.name.equals(key)) { - if (opt.isEnabled()) { - return Optional.fromNullable(opt.toString()); - } - } - } - return Optional.absent(); - } - - @Override - public void setWorldAndResolution(Minecraft mc, int width, int height) { - super.setWorldAndResolution(mc, width, height); - ScaledResolution sr = new ScaledResolution(mc); - GuiControl.setScreenSizeAndScale(width, height, sr.getScaleFactor()); - } - - @Override - public void initGui() { - super.initGui(); - optionHeight = 30; - optionPosX = this.width / 8; - this.buttonList.add(new GuiButton(0, width / 2 - 100, height - 30, 80, 20, "Cancel")); - this.buttonList.add(new GuiButton(1, width / 2 + 20, height - 30, 80, 20, "Apply")); - for (Opt opt : options) { - opt.init(); - } - fetch(); - } - - @Override - public void onGuiClosed() { - this.model.updateMeta(null); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - switch (button.id) { - case 1: - push(); - case 0: - mc.displayGuiScreen(parent); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - if (keyCode == Keyboard.KEY_ESCAPE) { - mc.displayGuiScreen(parent); - } else { - for (Opt opt : this.options) { - opt.keyTyped(typedChar, keyCode); - } - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTick) { - this.drawDefaultBackground(); - - int top = 30; - int bottom = height - 40; - int mid = width / 2; - - float yPos = this.height; - float scale = this.height * 0.25F; - - Gui.drawRect(mid + 10, top, width - 10, bottom, Integer.MIN_VALUE); - - ((GuiSkins) parent).enableClipping(30, height - 40); - enableBlend(); - enableDepth(); - mc.getTextureManager().bindTexture(this.model.getSkinTexture()); - renderPlayerModel(this.model, width * 0.75F, height * .75F, height * 0.25F, mouseX, yPos - scale * 1.8F - mouseY, partialTick); - disableDepth(); - disableBlend(); - ((GuiSkins) parent).disableClipping(); - - this.drawCenteredString(this.fontRendererObj, "Skin Overrides", width / 2, 10, -1); - super.drawScreen(mouseX, mouseY, partialTick); - for (Opt opt : options) { - opt.drawOption(mouseX, mouseY); - } - } - - public void renderPlayerModel(Entity thePlayer, float xPosition, float yPosition, float scale, float mouseX, float mouseY, float partialTick) { - enableColorMaterial(); - pushMatrix(); - translate(xPosition, yPosition, 200.0F); - - GlStateManager.color(1, 1, 1, 1); - scale(-scale, scale, scale); - rotate(180.0F, 0.0F, 0.0F, 1.0F); - rotate(135.0F, 0.0F, 1.0F, 0.0F); - - RenderHelper.enableStandardItemLighting(); - - rotate(-135.0F, 0.0F, 1.0F, 0.0F); - rotate(15.0F, 1.0F, 0.0F, 0.0F); - rotate((this.updateCounter + partialTick) * 2.5F, 0.0F, 1.0F, 0.0F); - thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40.0F)) * 20.0F; - translate(0.0D, thePlayer.getYOffset(), 0.0D); - - RenderManager rm = Minecraft.getMinecraft().getRenderManager(); - rm.playerViewY = 180.0F; - rm.doRenderEntity(thePlayer, 0, 0, 0, 0, 1, false); - - popMatrix(); - RenderHelper.disableStandardItemLighting(); - disableColorMaterial(); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int button) throws IOException { - super.mouseClicked(mouseX, mouseY, button); - if (mouseX > width / 2) - this.model.swingArm(); - for (Opt opt : options) { - opt.mouseClicked(mouseX, mouseY); - } - } - - @Override - public void updateScreen() { - this.model.updateMeta(this); - this.model.updateModel(); - - this.updateCounter++; - } - - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - super.mouseReleased(mouseX, mouseY, state); - for (Opt opt : options) { - opt.mouseReleased(mouseX, mouseY); - } - } - - public void setControlsEnabled(boolean enabled) { - for (Opt opt : this.options) { - opt.setControlEnabled(enabled); - } - for (GuiButton guiButton : buttonList) { - guiButton.enabled = enabled; - } - } - - public void push() { - IWebPreferences prefs = WebPreferencesManager.getDefault().getLocalPreferences(false); - Map data = this.toMap(); - for (Entry e : data.entrySet()) { - prefs.set(e.getKey(), e.getValue()); - } - // set the enabled metadata - prefs.set(HDSkinManager.METADATA_KEY, Joiner.on(',').join(data.keySet())); - prefs.commit(false); - } - - public void fetch() { - IWebPreferences prefs = WebPreferencesManager.getDefault().getLocalPreferences(false); - if (prefs.has(HDSkinManager.METADATA_KEY)) { - String meta = prefs.get(HDSkinManager.METADATA_KEY); - Map data = Maps.newHashMap(); - for (String key : Splitter.on(',').omitEmptyStrings().trimResults().split(meta)) { - if (prefs.has(key)) { - data.put(key, prefs.get(key)); - } - } - fromMap(data); - } - } - - private Map toMap() { - Map map = Maps.newHashMap(); - for (Opt opt : options) { - if (opt.isEnabled()) { - map.put(opt.getName(), opt.toString()); - } - } - return map; - } - - private void fromMap(Map data) { - for (Opt opt : options) { - if (data.containsKey(opt.getName())) { - opt.fromString(data.get(opt.getName())); - opt.setEnabled(opt.value.isPresent()); - } - } - } - - private abstract class Opt { - - protected Minecraft mc = Minecraft.getMinecraft(); - protected final String name; - protected Optional value = Optional.absent(); - - private GuiCheckbox enabled; - - public Opt(String name) { - this.name = name; - } - - private String getName() { - return name; - } - - public void setEnabled(boolean enabled) { - this.enabled.checked = enabled; - } - - public void setControlEnabled(boolean enabled) { - this.enabled.enabled = enabled; - } - - public boolean isEnabled() { - return this.enabled.checked; - } - - protected void init() { - this.enabled = new GuiCheckbox(0, optionPosX + 2, optionHeight, ""); - } - - protected void drawOption(int mouseX, int mouseY) { - this.enabled.drawButton(mc, mouseX, mouseY); - } - - protected void mouseClicked(int mouseX, int mouseY) { - if (this.enabled.mousePressed(mc, mouseX, mouseY)) { - this.enabled.checked = !this.enabled.checked; - } - } - - protected void mouseReleased(int mouseX, int mouseY) { - - } - - protected void keyTyped(char typedChar, int keyCode) { - - } - - @Override - public abstract String toString(); - - public abstract void fromString(String s); - } - - private class Bol extends Opt { - - private GuiCheckbox chk; - - public Bol(String name) { - super(name); - } - - @Override - public void setControlEnabled(boolean enabled) { - super.setControlEnabled(enabled); - this.chk.enabled = enabled; - } - - @Override - public void init() { - super.init(); - this.chk = new GuiCheckbox(0, optionPosX + 20, optionHeight, I18n.format(this.name)); - optionHeight += 14; - } - - @Override - protected void drawOption(int mouseX, int mouseY) { - super.drawOption(mouseX, mouseY); - chk.drawButton(mc, mouseX, mouseY); - - } - - @Override - protected void mouseClicked(int mouseX, int mouseY) { - super.mouseClicked(mouseX, mouseY); - if (chk.mousePressed(mc, mouseX, mouseY)) { - chk.checked = !chk.checked; - } - } - - @Override - public String toString() { - return this.value.transform(Functions.toStringFunction()).orNull(); - } - - @Override - public void fromString(String s) { - value = Optional.of(Boolean.parseBoolean(s)); - } - } - - private class Num extends Opt implements GuiResponder, FormatHelper { - - private final int min; - private final int max; - - private GuiSlider guiSlider; - - public Num(String name, int min, int max) { - super(name); - this.min = min; - this.max = max; - this.value = Optional.of(min); - } - - @Override - public void setControlEnabled(boolean enabled) { - super.setControlEnabled(enabled); - this.guiSlider.enabled = enabled; - } - - @Override - public void init() { - super.init(); - this.guiSlider = new GuiSlider(this, 0, optionPosX + 20, optionHeight, I18n.format(this.name), min, max, min, this); - optionHeight += 22; - } - - @Override - protected void drawOption(int mouseX, int mouseY) { - super.drawOption(mouseX, mouseY); - this.guiSlider.drawButton(mc, mouseX, mouseY); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY) { - super.mouseClicked(mouseX, mouseY); - this.guiSlider.mousePressed(mc, mouseX, mouseY); - } - - @Override - protected void mouseReleased(int mouseX, int mouseY) { - this.guiSlider.mouseReleased(mouseX, mouseY); - } - - @Override - public void setEntryValue(int id, float value) { - this.value = Optional.of((int) value); - } - - @Override - public String getText(int id, String name, float value) { - return name + ": " + (int) value; - } - - @Override - public String toString() { - return this.value.transform(Functions.toStringFunction()).orNull(); - } - - @Override - public void fromString(String s) { - value = Optional.fromNullable(Ints.tryParse(s)); - } - - @Override - public void setEntryValue(int id, boolean value) {} - - @Override - public void setEntryValue(int id, String value) {} - - } - - private class Sel> extends Opt { - - private Class type; - private final List options; - - private int index; - - private GuiButton button; - - public Sel(String name, Class enumType) { - super(name); - this.type = enumType; - this.options = ImmutableList.copyOf(enumType.getEnumConstants()); - this.value = Optional.of(this.get()); - } - - @Override - public void setControlEnabled(boolean enabled) { - super.setControlEnabled(enabled); - this.button.enabled = enabled; - } - - @Override - protected void init() { - super.init(); - this.button = new GuiButton(0, optionPosX + 20, optionHeight, 100, 20, I18n.format(name, this.get().toString())); - optionHeight += 22; - } - - @Override - protected void drawOption(int mouseX, int mouseY) { - super.drawOption(mouseX, mouseY); - this.button.drawButton(mc, mouseX, mouseY); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY) { - super.mouseClicked(mouseX, mouseY); - if (this.button.mousePressed(mc, mouseX, mouseY)) { - this.index++; - if (this.index >= this.options.size()) { - this.index = 0; - } - this.value = Optional.of(get()); - this.button.displayString = I18n.format(name, this.toString()); - } - } - - private E get() { - return this.options.get(this.index); - } - - @Override - public String toString() { - return this.value.transform(Enums.stringConverter(type).reverse()).orNull(); - } - - @Override - public void fromString(String s) { - value = Enums.getIfPresent(type, s); - this.index = value.isPresent() ? value.get().ordinal() : 0; - this.button.displayString = I18n.format(name, this.toString()); - } - - } - - private class Col extends Opt implements CloseListener { - - private GuiColorButton color; - - private Converter colorConverter = new Converter() { - @Override - protected Color doBackward(Integer b) { - return new Color(b); - } - - @Override - protected Integer doForward(Color a) { - return a.getRGB(); - } - }; - - public Col(String name) { - super(name); - value = Optional.of(Color.WHITE); - } - - @Override - protected void init() { - super.init(); - this.color = new GuiColorButton(mc, 0, optionPosX + 20, optionHeight, 20, 20, value.get(), I18n.format(name), this); - } - - @Override - public void onClose() { - this.value = Optional.of(new Color(this.color.getColor())); - setControlsEnabled(true); - } - - @Override - protected void drawOption(int mouseX, int mouseY) { - super.drawOption(mouseX, mouseY); - this.color.drawButton(mc, mouseX, mouseY); - this.color.drawPicker(mc, mouseX, mouseY); - - } - - @Override - protected void mouseClicked(int mouseX, int mouseY) { - super.mouseClicked(mouseX, mouseY); - if (this.color.mousePressed(mc, mouseX, mouseY)) { - setControlsEnabled(false); - } - } - - @Override - protected void mouseReleased(int mouseX, int mouseY) { - this.color.mouseReleased(mouseX, mouseY); - } - - @Override - protected void keyTyped(char typedChar, int keyCode) { - this.color.keyTyped(typedChar, keyCode); - } - - @Override - public String toString() { - return this.value.transform(colorConverter).transform(Functions.toStringFunction()).orNull(); - } - - @Override - public void fromString(String s) { - this.value = Optional.fromNullable(Ints.tryParse(s)).transform(colorConverter.reverse()); - } - } -} diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiSkins.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiSkins.java index a25bd2b4..d8ed63b7 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiSkins.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiSkins.java @@ -1,34 +1,5 @@ package com.voxelmodpack.hdskins.gui; -import static net.minecraft.client.renderer.GlStateManager.*; - -import java.awt.Color; -import java.awt.Window.Type; -import java.awt.dnd.DropTarget; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.DoubleBuffer; -import java.util.HashMap; -import java.util.List; - -import javax.imageio.ImageIO; -import javax.swing.BorderFactory; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.WindowConstants; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.JavaVersion; -import org.apache.commons.lang3.SystemUtils; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.glu.GLU; - import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.mojang.authlib.GameProfile; @@ -42,7 +13,6 @@ import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload; import com.voxelmodpack.hdskins.upload.awt.IOpenFileCallback; import com.voxelmodpack.hdskins.upload.awt.ThreadOpenFilePNG; import com.voxelmodpack.voxelmenu.IPanoramaRenderer; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; @@ -59,6 +29,26 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.Session; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextFormatting; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.JavaVersion; +import org.apache.commons.lang3.SystemUtils; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.Color; +import java.awt.Window.Type; +import java.awt.dnd.DropTarget; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.nio.DoubleBuffer; +import java.util.HashMap; +import java.util.List; + +import static net.minecraft.client.renderer.GlStateManager.*; public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpenFileCallback, IPanoramaRenderer { private static final int MAX_SKIN_DIMENSION = 8192; @@ -72,12 +62,11 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_2.png"), new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_3.png"), new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_4.png"), - new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_5.png") }; + new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_5.png")}; private GuiButton btnBrowse; private GuiButton btnUpload; private GuiButton btnClear; private GuiButton btnBack; - private GuiButton btnMeta; protected EntityPlayerModel localPlayer; protected EntityPlayerModel remotePlayer; protected DoubleBuffer doubleBuffer; @@ -100,8 +89,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe private float lastPartialTick; private JFrame fileDrop; - private GuiMetaHandler metadata; - // translations private final String manager = I18n.format("hdskins.manager"); private final String unreadable = I18n.format("hdskins.error.unreadable"); @@ -132,8 +119,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe this.reloadRemoteSkin(); this.fetchingSkin = true; this.panoramaRenderer = LiteModHDSkinsMod.getPanoramaRenderer(this); - this.metadata = new GuiMetaHandler(this, this.remotePlayer); - this.setupMetaOverrides(this.metadata); } protected EntityPlayerModel getModel(GameProfile profile) { @@ -184,9 +169,11 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe } - protected void onSetRemoteSkin() {} + protected void onSetRemoteSkin() { + } - protected void onSetLocalSkin(BufferedImage skin) {} + protected void onSetLocalSkin(BufferedImage skin) { + } private void reloadRemoteSkin() { try { @@ -199,7 +186,8 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe } @Override - public void updatePanorama() {} + public void updatePanorama() { + } @Override public int getUpdateCounter() { @@ -213,7 +201,8 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe } @Override - public void setPanoramaResolution(Minecraft minecraft, int width, int height) {} + public void setPanoramaResolution(Minecraft minecraft, int width, int height) { + } @Override public void initGui() { @@ -224,15 +213,10 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe this.buttonList.add(this.btnUpload = new GuiButton(1, this.width / 2 - 24, this.height / 2 - 10, 48, 20, ">>")); this.buttonList.add(this.btnClear = new GuiButton(2, this.width - 90, this.height - 36, 60, 20, "Clear")); this.buttonList.add(this.btnBack = new GuiButton(3, this.width / 2 - 50, this.height - 36, 100, 20, "Close")); - this.buttonList.add(this.btnMeta = new GuiButton(4, 2, 2, 20, 20, "...")); this.btnUpload.enabled = false; this.btnBrowse.enabled = !this.mc.isFullScreen(); } - protected void setupMetaOverrides(GuiMetaHandler meta) { - meta.bool("hdskins.slim"); - } - /** * @wbp.parser.entryPoint */ @@ -310,7 +294,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe }); if (!skinFile.exists()) { this.skinMessage = unreadable; - } else if (!FilenameUtils.isExtension(skinFile.getName(), new String[] { "png", "PNG" })) { + } else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) { this.skinMessage = ext; } else { BufferedImage chosenImage; @@ -326,7 +310,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe this.skinMessage = open; } else if (isPowerOfTwo(chosenImage.getWidth()) && (chosenImage.getWidth() == chosenImage.getHeight() * 2 - || chosenImage.getWidth() == chosenImage.getHeight()) + || chosenImage.getWidth() == chosenImage.getHeight()) && chosenImage.getWidth() <= MAX_SKIN_DIMENSION && chosenImage.getHeight() <= MAX_SKIN_DIMENSION) { synchronized (this.skinLock) { @@ -371,10 +355,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe this.mc.displayGuiScreen(new GuiMainMenu()); } - if (guiButton.id == this.btnMeta.id) { - this.mc.displayGuiScreen(metadata); - } - } } } @@ -744,7 +724,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe @Override public void onUploadComplete(String response) { - LiteLoaderLogger.info("Upload completed with: %s", new Object[] { response }); + LiteLoaderLogger.info("Upload completed with: %s", new Object[]{response}); this.uploadingSkin = false; this.threadSkinUpload = null; if (!response.equalsIgnoreCase("OK")) { diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java index b5297275..53cd9c19 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java @@ -44,12 +44,7 @@ public class RenderPlayerModel extends RenderLiving } public ModelPlayer getEntityModel(M entity) { - if (entity.metaHandler != null && entity.metaHandler.get("slim").isPresent()) { - boolean skinny = "true".equals(entity.metaHandler.get("slim").get()); - return skinny ? THIN : FAT; - } return FAT; - } @Override diff --git a/src/hdskins/resources/assets/hdskins/lang/en_us.lang b/src/hdskins/resources/assets/hdskins/lang/en_us.lang index 531f9e6b..b5ccefa1 100644 --- a/src/hdskins/resources/assets/hdskins/lang/en_us.lang +++ b/src/hdskins/resources/assets/hdskins/lang/en_us.lang @@ -18,5 +18,3 @@ hdskins.local=Local Skin hdskins.server=Server Skin gui.ok=OK - -hdskins.slim=Slim arms \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/MineLittlePony.java b/src/main/java/com/minelittlepony/MineLittlePony.java index f4cffa9f..b9f74481 100644 --- a/src/main/java/com/minelittlepony/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/MineLittlePony.java @@ -1,7 +1,5 @@ package com.minelittlepony; -import org.lwjgl.input.Keyboard; - import com.minelittlepony.gui.PonySettingPanel; import com.minelittlepony.hdskins.gui.EntityPonyModel; import com.minelittlepony.hdskins.gui.GuiSkinsMineLP; @@ -19,7 +17,6 @@ import com.mumfrey.liteloader.core.LiteLoader; import com.mumfrey.liteloader.util.ModUtilities; import com.voxelmodpack.hdskins.HDSkinManager; import com.voxelmodpack.hdskins.gui.GuiSkins; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.IReloadableResourceManager; @@ -36,18 +33,13 @@ import net.minecraft.entity.monster.EntityWitherSkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.EntityZombieVillager; import net.minecraft.entity.passive.EntityVillager; +import org.lwjgl.input.Keyboard; public class MineLittlePony { public static final String MOD_NAME = "Mine Little Pony"; public static final String MOD_VERSION = "@VERSION@"; - 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"; - 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"); @@ -122,6 +114,7 @@ public class MineLittlePony { } void onTick(Minecraft minecraft, boolean inGame) { + if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) { minecraft.displayGuiScreen(new PonySettingPanel()); } diff --git a/src/main/java/com/minelittlepony/Pony.java b/src/main/java/com/minelittlepony/Pony.java index bf1a6191..62164da6 100644 --- a/src/main/java/com/minelittlepony/Pony.java +++ b/src/main/java/com/minelittlepony/Pony.java @@ -49,7 +49,6 @@ public class Pony { MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId, player.getName(), player.getUniqueID(), this.textureResourceLocation); this.checkSkin(this.textureResourceLocation); - this.checkMeta(profile); } public Pony(@Nonnull ResourceLocation aTextureResourceLocation) { @@ -66,7 +65,6 @@ public class Pony { public void checkSkin() { if (!this.skinChecked) { this.checkSkin(this.textureResourceLocation); - this.checkMeta(this.profile); } } @@ -77,49 +75,6 @@ public class Pony { } } - private void checkMeta(GameProfile profile) { - final IWebPreferences prefs = WebPreferencesManager.getDefault().getPreferences(profile); - - if (prefs == null) - return; - - final List keys; - if (prefs.has(HDSkinManager.METADATA_KEY)) { - String list = prefs.get(HDSkinManager.METADATA_KEY); - keys = Splitter.on(',').splitToList(list); - } else { - keys = Lists.newArrayList(); - } - - // >inb4 java 8 - // checkMeta(Predicates.and(keys::contains, prefs::has), prefs::get); - checkMeta(new Predicate() { - @Override - public boolean apply(String key) { - return keys.contains(key) && prefs.has(key); - } - }, new Function() { - @Override - public String apply(String key) { - return prefs.get(key); - } - }); - } - - private void checkMeta(Predicate has, Function prefs) { - - if (has.apply(MineLittlePony.MLP_RACE)) - metadata.setRace(PonyRace.valueOf(prefs.apply(MineLittlePony.MLP_RACE))); - if (has.apply(MineLittlePony.MLP_TAIL)) - metadata.setTail(TailLengths.valueOf(prefs.apply(MineLittlePony.MLP_TAIL))); - if (has.apply(MineLittlePony.MLP_GENDER)) - metadata.setGender(PonyGender.valueOf(prefs.apply(MineLittlePony.MLP_GENDER))); - if (has.apply(MineLittlePony.MLP_SIZE)) - metadata.setSize(PonySize.valueOf(prefs.apply(MineLittlePony.MLP_SIZE))); - if (has.apply(MineLittlePony.MLP_MAGIC)) - metadata.setGlowColor(Integer.parseInt(prefs.apply(MineLittlePony.MLP_MAGIC))); - } - public BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) { BufferedImage skinImage = null; try { diff --git a/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java b/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java index 8d77402e..2c7acd98 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java @@ -1,18 +1,12 @@ package com.minelittlepony.hdskins.gui; -import java.awt.image.BufferedImage; - -import com.minelittlepony.MineLittlePony; -import com.minelittlepony.PonyGender; import com.minelittlepony.PonyManager; -import com.minelittlepony.PonyRace; -import com.minelittlepony.PonySize; -import com.minelittlepony.TailLengths; import com.minelittlepony.util.MineLPLogger; import com.mojang.authlib.GameProfile; import com.voxelmodpack.hdskins.gui.EntityPlayerModel; import com.voxelmodpack.hdskins.gui.GuiSkins; -import com.voxelmodpack.hdskins.gui.GuiMetaHandler; + +import java.awt.image.BufferedImage; public class GuiSkinsMineLP extends GuiSkins { @@ -22,16 +16,6 @@ public class GuiSkinsMineLP extends GuiSkins { this.ponyManager = manager; } - @Override - protected void setupMetaOverrides(GuiMetaHandler meta) { - super.setupMetaOverrides(meta); - meta.selection(MineLittlePony.MLP_RACE, PonyRace.class); - meta.selection(MineLittlePony.MLP_TAIL, TailLengths.class); - meta.selection(MineLittlePony.MLP_GENDER, PonyGender.class); - meta.selection(MineLittlePony.MLP_SIZE, PonySize.class); - meta.color(MineLittlePony.MLP_MAGIC); - } - @Override protected EntityPlayerModel getModel(GameProfile profile) { return new EntityPonyModel(profile); diff --git a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java index f0e2e92e..1054b29e 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java @@ -1,15 +1,9 @@ package com.minelittlepony.hdskins.gui; -import com.google.common.base.Optional; import com.minelittlepony.MineLittlePony; import com.minelittlepony.Pony; -import com.minelittlepony.PonyGender; -import com.minelittlepony.PonyRace; -import com.minelittlepony.PonySize; -import com.minelittlepony.TailLengths; import com.minelittlepony.model.PlayerModel; import com.voxelmodpack.hdskins.gui.RenderPlayerModel; - import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.renderer.entity.RenderManager; @@ -25,25 +19,6 @@ public class RenderPonyModel extends RenderPlayerModel { thePony.invalidateSkinCheck(); thePony.checkSkin(); - if (playermodel.metaHandler != null) { - Optional race = playermodel.metaHandler.get(MineLittlePony.MLP_RACE); - Optional tail = playermodel.metaHandler.get(MineLittlePony.MLP_TAIL); - Optional gender = playermodel.metaHandler.get(MineLittlePony.MLP_GENDER); - Optional size = playermodel.metaHandler.get(MineLittlePony.MLP_SIZE); - Optional magicColor = playermodel.metaHandler.get(MineLittlePony.MLP_MAGIC); - - if (race.isPresent()) - thePony.metadata.setRace(PonyRace.valueOf(race.get())); - if (tail.isPresent()) - thePony.metadata.setTail(TailLengths.valueOf(tail.get())); - if (gender.isPresent()) - thePony.metadata.setGender(PonyGender.valueOf(gender.get())); - if (size.isPresent()) - thePony.metadata.setSize(PonySize.valueOf(size.get())); - if (magicColor.isPresent()) - thePony.metadata.setGlowColor(Integer.parseInt(magicColor.get())); - } - // TODO small arms PlayerModel pm = thePony.getModel(true, false); pm.apply(thePony.metadata); diff --git a/src/main/resources/assets/minelittlepony/lang/en_us.lang b/src/main/resources/assets/minelittlepony/lang/en_us.lang index a483c82f..c61001a7 100644 --- a/src/main/resources/assets/minelittlepony/lang/en_us.lang +++ b/src/main/resources/assets/minelittlepony/lang/en_us.lang @@ -16,9 +16,3 @@ minelp.mobs.villagers=Ponify villagers minelp.mobs.zombies=Ponify zombies minelp.mobs.zombiepigmen=Ponify zombie pigmen minelp.mobs.skeletons=Ponify skeletons - -mlp.race=Race: %s -mlp.tail=Tail: %s -mlp.gender=Gender: %s -mlp.size=Size: %s -mlp.magic=Magic color \ No newline at end of file diff --git a/src/main/resources/mixin.minelp.json b/src/main/resources/mixin.minelp.json index 121623fd..7f49417b 100644 --- a/src/main/resources/mixin.minelp.json +++ b/src/main/resources/mixin.minelp.json @@ -3,6 +3,7 @@ "minVersion": "0.4.10", "package": "com.minelittlepony.mixin", "refmap": "mixin.minelp.refmap.json", + "compatibilityLevel": "JAVA_8", "mixins": [ "MixinRenderPlayer" ]