From ed2c09a052554ffb7be72be004ed043b8549a6a5 Mon Sep 17 00:00:00 2001 From: LAX1DUDE Date: Wed, 30 Mar 2022 17:12:27 -0700 Subject: [PATCH] added alex skins --- .../bungee/eaglercraft/PluginEaglerSkins.java | 2 +- lwjgl-rundir/resources/credits.txt | 2 +- lwjgl-rundir/resources/sounds/sounds.dat | Bin 4610 -> 4631 bytes .../eaglercraft/DefaultSkinRenderer.java | 110 +++++++++-- .../lax1dude/eaglercraft/EaglerProfile.java | 63 ++++-- .../eaglercraft/GuiScreenEditProfile.java | 186 ++++++++++++++---- .../eaglercraft/ModelBipedNewSkins.java | 7 +- .../java/net/minecraft/src/ModelBiped.java | 5 + .../java/net/minecraft/src/RenderPlayer.java | 20 +- .../java/net/minecraft/src/RenderXPOrb.java | 3 + 10 files changed, 319 insertions(+), 79 deletions(-) diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java index 0c311cc..517d4b9 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java @@ -16,7 +16,7 @@ public class PluginEaglerSkins extends Plugin implements Listener { private final HashMap skinCollection = new HashMap(); - private static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 1 }; + private static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 64*64*4, 128*128*4, 1 }; private static final int VALID_DEFAULT_SKINS = 33; diff --git a/lwjgl-rundir/resources/credits.txt b/lwjgl-rundir/resources/credits.txt index 79973e5..06a0237 100644 --- a/lwjgl-rundir/resources/credits.txt +++ b/lwjgl-rundir/resources/credits.txt @@ -8,7 +8,7 @@ eaglercraft makes use of baislsl's java PNG decoder, which is available at §nht all graphical assets in this project were ripped from mojang's official minecraft.jar for minecraft version 1.5.2 and they are mojang's intellectual property. assets ommitted include the minecraft soundtrack and music disks and all software references to the mojang/minecraft api. -eaglercraft servers are powered by md_5's BungeeCord and the CraftBukkit project available at §nhttp://www.spigotmc.org/§r. BungeeCord has been modified to accept eaglercraft's strange login packets and to host a websocket server to translate browser connections to raw TCP that vanilla minecraft servers can understand. All java plugins designed for CraftBukkit 1.5.2 are compatible with this configuration. +eaglercraft servers are powered by md_5's BungeeCord and the CraftBukkit project available at §nhttps://bukkit.org/§r. BungeeCord has been modified to accept eaglercraft's strange login packets and to host a websocket server to translate browser connections to raw TCP that vanilla minecraft servers can understand. All java plugins designed for CraftBukkit 1.5.2 are compatible with this configuration. scroll down for the detailed license statements diff --git a/lwjgl-rundir/resources/sounds/sounds.dat b/lwjgl-rundir/resources/sounds/sounds.dat index 9489980f0de90cc399540d43f8bb932505589330..fa3a4516e99deb7afbfa4a3cc61e0c09e51c106d 100644 GIT binary patch delta 30 lcmZotnXa;dQAmuHfv+GZu`($!Iom%itvI#B=Ifz;1^|v#3Vr|p delta 9 QcmbQP(xkG1QHYTN01k=*CIA2c diff --git a/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java b/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java index a297839..30610f2 100644 --- a/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java +++ b/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java @@ -59,6 +59,18 @@ public class DefaultSkinRenderer { new TextureLocation("/skins/30.longarms.png"), new TextureLocation("/skins/31.laxdude.png") }; + + public static final boolean[] defaultVanillaSkinClassicOrSlimVariants = new boolean[] { + false, true, + false, true, + false, true, + false, true, + false, true, + false, true, + false, true, + false, true, + false, true + }; private static final HashMap skinCookies = new HashMap(); private static final HashMap skinGLUnits = new HashMap(); @@ -93,7 +105,7 @@ public class DefaultSkinRenderer { }else if(p instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p; if(pp.skinPacket != null) { - if(((int)pp.skinPacket[0] & 0xFF) < 4) { + if(((int)pp.skinPacket[0] & 0xFF) < 6) { if(!skinGLUnits.containsKey(pp)) { byte[] skinToLoad = new byte[pp.skinPacket.length - 1]; System.arraycopy(pp.skinPacket, 1, skinToLoad, 0, skinToLoad.length); @@ -106,6 +118,7 @@ public class DefaultSkinRenderer { h = 32; break; case 1: + case 4: w = 64; h = 64; break; @@ -114,6 +127,7 @@ public class DefaultSkinRenderer { h = 64; break; case 3: + case 5: w = 128; h = 128; break; @@ -168,6 +182,10 @@ public class DefaultSkinRenderer { return !(id == 0 || id == 2 || id == 4 || id == 6 || id == 8 || id == 10 || id == 12 || id == 14 || id == 18 || id == 28); } + public static boolean isAlexSkin(int id) { + return id < defaultVanillaSkinClassicOrSlimVariants.length && defaultVanillaSkinClassicOrSlimVariants[id]; + } + public static boolean isStandardModel(int id) { return !isZombieModel(id) && !(id == 19 || id == 20 || id == 21 || id == 32 || id == 33 || id == 34); } @@ -178,8 +196,8 @@ public class DefaultSkinRenderer { public static boolean isPlayerNewSkin(EntityPlayer p) { if(p instanceof EntityClientPlayerMP) { - if(EaglerProfile.presetSkinId == -1) { - int type = EaglerProfile.getSkinSize(EaglerProfile.skinDatas.get(EaglerProfile.customSkinId).length); + if(EaglerProfile.presetSkinId <= -1) { + int type = EaglerProfile.getSkinSize(EaglerProfile.skins.get(EaglerProfile.customSkinId).data.length); return (type == 1 || type == 3); }else { return isNewSkin(EaglerProfile.presetSkinId); @@ -187,8 +205,8 @@ public class DefaultSkinRenderer { }else if(p instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p; if(pp.skinPacket != null) { - if(pp.skinPacket[0] < (byte)4) { - return (pp.skinPacket[0] == (byte)1) || (pp.skinPacket[0] == (byte)3); + if(pp.skinPacket[0] < (byte)6) { + return (pp.skinPacket[0] == (byte)1) || (pp.skinPacket[0] == (byte)3) || (pp.skinPacket[0] == (byte)4) || (pp.skinPacket[0] == (byte)5); }else { return isNewSkin((int)pp.skinPacket[1] & 0xFF); } @@ -197,6 +215,26 @@ public class DefaultSkinRenderer { return false; } + public static boolean isPlayerNewSkinSlim(EntityPlayer p) { + if(p instanceof EntityClientPlayerMP) { + if(EaglerProfile.presetSkinId == -1) { + return EaglerProfile.skins.get(EaglerProfile.customSkinId).slim; + }else { + return isAlexSkin(EaglerProfile.presetSkinId); + } + }else if(p instanceof EntityOtherPlayerMP) { + EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p; + if(pp.skinPacket != null) { + if(pp.skinPacket[0] < (byte)6) { + return (pp.skinPacket[0] == (byte)4) || (pp.skinPacket[0] == (byte)5); + }else { + return isAlexSkin((int)pp.skinPacket[1] & 0xFF); + } + } + } + return false; + } + public static boolean isPlayerStandard(EntityPlayer p) { if(p instanceof EntityClientPlayerMP) { if(EaglerProfile.presetSkinId == -1) { @@ -207,7 +245,7 @@ public class DefaultSkinRenderer { }else if(p instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p; if(pp.skinPacket != null) { - if(pp.skinPacket[0] < (byte)4) { + if(pp.skinPacket[0] < (byte)6) { return true; }else { return isStandardModel((int)pp.skinPacket[1] & 0xFF); @@ -227,7 +265,7 @@ public class DefaultSkinRenderer { }else if(p instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p; if(pp.skinPacket != null) { - if(pp.skinPacket[0] < (byte)4) { + if(pp.skinPacket[0] < (byte)6) { return 0; }else { return (int)pp.skinPacket[1] & 0xFF; @@ -239,6 +277,7 @@ public class DefaultSkinRenderer { public static ModelBiped oldSkinRenderer = null; public static ModelBipedNewSkins newSkinRenderer = null; + public static ModelBipedNewSkins newSkinRendererSlim = null; public static ModelZombie zombieRenderer = null; public static ModelVillager villagerRenderer = null; public static ModelEnderman endermanRenderer = null; @@ -246,7 +285,7 @@ public class DefaultSkinRenderer { public static ModelSkeleton skeletonRenderer = null; public static void renderPlayerPreview(int x, int y, int mx, int my, int id2) { - int id = id2 - EaglerProfile.skinNames.size(); + int id = id2 - EaglerProfile.skins.size(); EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); @@ -265,7 +304,7 @@ public class DefaultSkinRenderer { EaglerAdapter.glTranslatef(0.0F, -1.0F, 0.0F); if(id < 0) { - Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.glTex.get(id2)); + Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(id2).glTex); }else { defaultVanillaSkins[id].bindTexture(); } @@ -273,15 +312,21 @@ public class DefaultSkinRenderer { if(isStandardModel(id) || id < 0) { if(oldSkinRenderer == null) oldSkinRenderer = new ModelBiped(0.0F, 0.0F, 64, 32); if(newSkinRenderer == null) newSkinRenderer = new ModelBipedNewSkins(0.0F, false); - newSkinRenderer.isChild = false; + if(newSkinRendererSlim == null) newSkinRendererSlim = new ModelBipedNewSkins(0.0F, true); oldSkinRenderer.isChild = false; + newSkinRenderer.isChild = false; + newSkinRendererSlim.isChild = false; boolean isNew = isNewSkin(id); if(id < 0) { - int type = EaglerProfile.getSkinSize(EaglerProfile.skinDatas.get(id2).length); + int type = EaglerProfile.getSkinSize(EaglerProfile.skins.get(id2).data.length); isNew = (type == 1 || type == 3); } if(isNew) { - newSkinRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); + if((id < 0 && EaglerProfile.skins.get(id2).slim) || (id >= 0 && isAlexSkin(id))) { + newSkinRendererSlim.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); + }else { + newSkinRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); + } }else { oldSkinRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); } @@ -331,5 +376,46 @@ public class DefaultSkinRenderer { OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); } + + public static void renderAlexOrSteve(int x, int y, int mx, int my, boolean alex) { + ModelBipedNewSkins bp; + if(alex) { + if(newSkinRendererSlim == null) { + newSkinRendererSlim = new ModelBipedNewSkins(0.0F, true); + } + bp = newSkinRendererSlim; + }else { + if(newSkinRenderer == null) { + newSkinRenderer = new ModelBipedNewSkins(0.0F, false); + } + bp = newSkinRenderer; + } + + EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); + EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); + EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE); + EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + EaglerAdapter.glPushMatrix(); + EaglerAdapter.glTranslatef((float) x, (float) (y - 80), 100.0F); + EaglerAdapter.glScalef(50.0f, 50.0f, 50.0f); + EaglerAdapter.glRotatef(180.0f, 1.0f, 0.0f, 0.0f); + EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL); + EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); + RenderHelper.enableGUIStandardItemLighting(); + EaglerAdapter.glTranslatef(0.0F, 1.0F, 0.0F); + EaglerAdapter.glRotatef(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f); + EaglerAdapter.glRotatef(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f); + EaglerAdapter.glTranslatef(0.0F, -1.0F, 0.0F); + + bp.isChild = false; + bp.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); + + EaglerAdapter.glPopMatrix(); + EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); + } } diff --git a/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java b/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java index 5a9f7fb..66cd922 100644 --- a/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java +++ b/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java @@ -3,9 +3,24 @@ package net.lax1dude.eaglercraft; import java.util.ArrayList; import net.minecraft.client.Minecraft; +import net.minecraft.src.NBTBase; +import net.minecraft.src.NBTTagByteArray; import net.minecraft.src.NBTTagCompound; public class EaglerProfile { + + public static class EaglerProfileSkin { + public String name; + public byte[] data; + public boolean slim; + public int glTex; + public EaglerProfileSkin(String name, byte[] data, boolean slim, int glTex) { + this.name = name; + this.data = data; + this.slim = slim; + this.glTex = glTex; + } + } public static String username; public static int presetSkinId; @@ -13,10 +28,8 @@ public class EaglerProfile { public static String myChannel; - public static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 2 }; - public static ArrayList skinNames = new ArrayList(); - public static ArrayList skinDatas = new ArrayList(); - public static ArrayList glTex = new ArrayList(); + public static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 64*64*4, 128*128*4, 2 }; + public static ArrayList skins = new ArrayList(); public static final EaglercraftRandom rand; @@ -31,13 +44,19 @@ public class EaglerProfile { public static byte[] getSkinPacket() { if(presetSkinId == -1) { - byte[] d = skinDatas.get(customSkinId); + byte[] d = skins.get(customSkinId).data; byte[] d2 = new byte[1 + d.length]; d2[0] = (byte) getSkinSize(d.length); + if(d2[0] == (byte)1 && skins.get(customSkinId).slim) { + d2[0] = (byte)4; + } + if(d2[0] == (byte)3 && skins.get(customSkinId).slim) { + d2[0] = (byte)5; + } System.arraycopy(d, 0, d2, 1, d.length); return d2; }else { - return new byte[] { (byte)4, (byte)presetSkinId }; + return new byte[] { (byte)6, (byte)presetSkinId }; } } @@ -48,16 +67,14 @@ public class EaglerProfile { return r; } - public static int addSkin(String name, byte[] data) { - int i = skinNames.indexOf(name); - - if(i != -1) { - skinDatas.set(i, data); - }else { - skinNames.add(name); - skinDatas.add(data); + public static int addSkin(String name, byte[] data, boolean slim) { + int i = -1; + for(int j = 0, l = skins.size(); j < l; ++j) { + if(skins.get(j).name.equalsIgnoreCase(name)) { + i = j; + break; + } } - int t = getSkinSize(data.length); if(t == -1) { @@ -73,6 +90,7 @@ public class EaglerProfile { h = 32; break; case 1: + case 4: w = 64; h = 64; break; @@ -81,6 +99,7 @@ public class EaglerProfile { h = 64; break; case 3: + case 5: w = 128; h = 128; break; @@ -88,9 +107,12 @@ public class EaglerProfile { int im = Minecraft.getMinecraft().renderEngine.setupTextureRaw(data, w, h); if(i == -1) { - glTex.add(im); + i = skins.size(); + skins.add(new EaglerProfileSkin(name, data, slim, im)); }else { - glTex.set(i, im); + skins.get(i).glTex = im; + skins.get(i).data = data; + skins.get(i).slim = slim; } return i; @@ -175,7 +197,12 @@ public class EaglerProfile { NBTTagCompound n = LocalStorageManager.profileSettingsStorage.getCompoundTag("skins"); for(Object s : NBTTagCompound.getTagMap(n).keySet()) { String s2 = (String)s; - addSkin(s2, n.getByteArray(s2)); + NBTBase k = n.getTag(s2); + if(k.getId() == (byte)7) { + addSkin(s2, ((NBTTagByteArray)k).byteArray, false); + }else if(k.getId() == (byte)10) { + addSkin(s2, ((NBTTagCompound)k).getByteArray("data"), ((NBTTagCompound)k).getBoolean("slim")); + } } } } diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenEditProfile.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenEditProfile.java index f7e131b..fce9f25 100644 --- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenEditProfile.java +++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenEditProfile.java @@ -1,5 +1,6 @@ package net.lax1dude.eaglercraft; +import net.lax1dude.eaglercraft.EaglerProfile.EaglerProfileSkin; import net.minecraft.src.GuiButton; import net.minecraft.src.GuiScreen; import net.minecraft.src.GuiTextField; @@ -21,6 +22,8 @@ public class GuiScreenEditProfile extends GuiScreen { private int mousex = 0; private int mousey = 0; + private boolean newSkinWaitSteveOrAlex = false; + private static final TextureLocation gui = new TextureLocation("/gui/gui.png"); public static final String[] defaultOptions = new String[] { @@ -63,10 +66,19 @@ public class GuiScreenEditProfile extends GuiScreen { public GuiScreenEditProfile(GuiScreen parent) { this.parent = parent; - this.dropDownOptions = EaglerProfile.concatArrays(EaglerProfile.skinNames.toArray(new String[0]), defaultOptions); + reconcatDD(); } - private GuiButton button0, button1, button2; + private void reconcatDD() { + String[] n = new String[EaglerProfile.skins.size()]; + for(int i = 0; i < n.length; ++i) { + n[i] = EaglerProfile.skins.get(i).name; + } + + this.dropDownOptions = EaglerProfile.concatArrays(n, defaultOptions); + } + + private GuiButton button0, button1, button2, button10, button11, button12; public void initGui() { super.initGui(); @@ -76,7 +88,7 @@ public class GuiScreenEditProfile extends GuiScreen { this.username = new GuiTextField(this.fontRenderer, this.width / 2 - 20 + 1, this.height / 6 + 24 + 1, 138, 20); this.username.setFocused(true); this.username.setText(EaglerProfile.username); - selectedSlot = EaglerProfile.presetSkinId == -1 ? EaglerProfile.customSkinId : (EaglerProfile.presetSkinId + EaglerProfile.skinNames.size()); + selectedSlot = EaglerProfile.presetSkinId == -1 ? EaglerProfile.customSkinId : (EaglerProfile.presetSkinId + EaglerProfile.skins.size()); //this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 140, "eeeee")); this.buttonList.add(button0 = new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done"))); this.buttonList.add(button1 = new GuiButton(2, this.width / 2 - 21, this.height / 6 + 110, 71, 20, var1.translateKey("profile.addSkin"))); @@ -103,7 +115,7 @@ public class GuiScreenEditProfile extends GuiScreen { drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, 0xff000015); this.username.drawTextBox(); - if(dropDownOpen) { + if(dropDownOpen || newSkinWaitSteveOrAlex) { super.drawScreen(0, 0, par3); }else { super.drawScreen(mx, my, par3); @@ -161,7 +173,67 @@ public class GuiScreenEditProfile extends GuiScreen { int xx = this.width / 2 - 80; int yy = this.height / 6 + 130; - DefaultSkinRenderer.renderPlayerPreview(xx, yy, mx, my, selectedSlot); + + if(newSkinWaitSteveOrAlex && selectedSlot < EaglerProfile.skins.size()) { + skinWidth = 70; + skinHeight = 120; + + EaglerProfile.EaglerProfileSkin eee = EaglerProfile.skins.get(selectedSlot); + + EaglerAdapter.glClear(EaglerAdapter.GL_DEPTH_BUFFER_BIT); + + skinX = this.width / 2 - 90; + skinY = this.height / 4; + xx = skinX + 35; + yy = skinY + 117; + + boolean mouseOver = mx >= skinX && my >= skinY && mx < skinX + skinWidth && my < skinY + skinHeight; + int cc = mouseOver ? 0xFFDDDD99 : 0xFF555555; + + EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); + EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA); + drawRect(0, 0, width, height, 0xbb000000); + drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, 0xbb000000); + EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); + + drawRect(skinX, skinY, skinX + 1, skinY + skinHeight, cc); + drawRect(skinX, skinY, skinX + skinWidth, skinY + 1, cc); + drawRect(skinX + skinWidth - 1, skinY, skinX + skinWidth, skinY + skinHeight, cc); + drawRect(skinX, skinY + skinHeight - 1, skinX + skinWidth, skinY + skinHeight, cc); + + if(mouseOver) { + drawCenteredString(fontRenderer, "Steve", skinX + skinWidth / 2, skinY + skinHeight + 6, cc); + } + + this.mc.renderEngine.bindTexture(eee.glTex); + DefaultSkinRenderer.renderAlexOrSteve(xx, yy, mx, my, false); + + skinX = this.width / 2 + 20; + skinY = this.height / 4; + xx = skinX + 35; + yy = skinY + 117; + + mouseOver = mx >= skinX && my >= skinY && mx < skinX + skinWidth && my < skinY + skinHeight; + cc = mouseOver ? 0xFFDDDD99 : 0xFF555555; + + EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); + drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, 0xbb000000); + EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); + + drawRect(skinX, skinY, skinX + 1, skinY + skinHeight, cc); + drawRect(skinX, skinY, skinX + skinWidth, skinY + 1, cc); + drawRect(skinX + skinWidth - 1, skinY, skinX + skinWidth, skinY + skinHeight, cc); + drawRect(skinX, skinY + skinHeight - 1, skinX + skinWidth, skinY + skinHeight, cc); + + if(mouseOver) { + drawCenteredString(fontRenderer, "Alex", skinX + skinWidth / 2, skinY + skinHeight + 8, cc); + } + + this.mc.renderEngine.bindTexture(eee.glTex); + DefaultSkinRenderer.renderAlexOrSteve(xx, yy, mx, my, true); + }else { + DefaultSkinRenderer.renderPlayerPreview(xx, yy, newSkinWaitSteveOrAlex ? width / 2 : mx, newSkinWaitSteveOrAlex ? height / 2 : my, selectedSlot); + } } @@ -178,42 +250,47 @@ public class GuiScreenEditProfile extends GuiScreen { } } + private void save() { + EaglerProfile.username = this.username.getText().length() == 0 ? "null" : this.username.getText(); + EaglerProfile.presetSkinId = selectedSlot - EaglerProfile.skins.size(); + if(EaglerProfile.presetSkinId < 0) { + EaglerProfile.presetSkinId = -1; + EaglerProfile.customSkinId = selectedSlot; + }else { + EaglerProfile.customSkinId = -1; + } + + LocalStorageManager.profileSettingsStorage.setInteger("ps", EaglerProfile.presetSkinId); + LocalStorageManager.profileSettingsStorage.setInteger("cs", EaglerProfile.customSkinId); + LocalStorageManager.profileSettingsStorage.setString("name", EaglerProfile.username); + + NBTTagCompound skins = new NBTTagCompound(); + for(int i = 0, l = EaglerProfile.skins.size(); i < l; i++) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByteArray("data", EaglerProfile.skins.get(i).data); + nbt.setBoolean("slim", EaglerProfile.skins.get(i).slim); + skins.setTag(EaglerProfile.skins.get(i).name, nbt); + } + LocalStorageManager.profileSettingsStorage.setCompoundTag("skins", skins); + + LocalStorageManager.saveStorageP(); + } + protected void actionPerformed(GuiButton par1GuiButton) { if(!dropDownOpen) { if(par1GuiButton.id == 200) { - EaglerProfile.username = this.username.getText().length() == 0 ? "null" : this.username.getText(); - EaglerProfile.presetSkinId = selectedSlot - EaglerProfile.skinNames.size(); - if(EaglerProfile.presetSkinId < 0) { - EaglerProfile.presetSkinId = -1; - EaglerProfile.customSkinId = selectedSlot; - }else { - EaglerProfile.customSkinId = -1; - } - - LocalStorageManager.profileSettingsStorage.setInteger("ps", EaglerProfile.presetSkinId); - LocalStorageManager.profileSettingsStorage.setInteger("cs", EaglerProfile.customSkinId); - LocalStorageManager.profileSettingsStorage.setString("name", EaglerProfile.username); - - NBTTagCompound skins = new NBTTagCompound(); - for(int i = 0; i < EaglerProfile.skinNames.size(); i++) { - skins.setByteArray(EaglerProfile.skinNames.get(i), EaglerProfile.skinDatas.get(i)); - } - LocalStorageManager.profileSettingsStorage.setCompoundTag("skins", skins); - - LocalStorageManager.saveStorageP(); - + save(); this.mc.displayGuiScreen((GuiScreen) parent); }else if(par1GuiButton.id == 2) { EaglerAdapter.openFileChooser("png", "image/png"); }else if(par1GuiButton.id == 3) { - EaglerProfile.skinDatas.clear(); - EaglerProfile.skinNames.clear(); - for(Integer i : EaglerProfile.glTex) { - this.mc.renderEngine.deleteTexture(i.intValue()); + for(EaglerProfileSkin i : EaglerProfile.skins) { + this.mc.renderEngine.deleteTexture(i.glTex); } - EaglerProfile.glTex.clear(); + EaglerProfile.skins.clear(); this.dropDownOptions = defaultOptions; this.selectedSlot = 0; + save(); } } } @@ -256,9 +333,14 @@ public class GuiScreenEditProfile extends GuiScreen { if(name.length() > 32) { name = name.substring(0, 32); } - if(EaglerProfile.addSkin(name, rawSkin) != -1) { - selectedSlot = EaglerProfile.skinNames.size() - 1; - this.dropDownOptions = EaglerProfile.concatArrays(EaglerProfile.skinNames.toArray(new String[0]), defaultOptions); + if((img.w == 64 && img.h == 64) || (img.w == 128 && img.h == 128)) { + newSkinWaitSteveOrAlex = true; + } + int k; + if((k = EaglerProfile.addSkin(name, rawSkin, false)) != -1) { + selectedSlot = k; + reconcatDD(); + save(); } } } @@ -267,6 +349,7 @@ public class GuiScreenEditProfile extends GuiScreen { EaglerAdapter.enableRepeatEvents(false); } + protected void keyTyped(char par1, int par2) { this.username.textboxKeyTyped(par1, par2); @@ -286,6 +369,41 @@ public class GuiScreenEditProfile extends GuiScreen { } protected void mouseClicked(int par1, int par2, int par3) { + if(newSkinWaitSteveOrAlex) { + int skinX = this.width / 2 - 90; + int skinY = this.height / 4; + int skinWidth = 70; + int skinHeight = 120; + if(par1 >= skinX && par2 >= skinY && par1 < skinX + skinWidth && par2 < skinY + skinHeight) { + if(selectedSlot < EaglerProfile.skins.size()) { + newSkinWaitSteveOrAlex = false; + EaglerProfile.skins.get(selectedSlot).slim = false; + save(); + } + return; + } + skinX = this.width / 2 + 20; + skinY = this.height / 4; + if(par1 >= skinX && par2 >= skinY && par1 < skinX + skinWidth && par2 < skinY + skinHeight) { + if(selectedSlot < EaglerProfile.skins.size()) { + EaglerProfile.skins.get(selectedSlot).slim = true; + newSkinWaitSteveOrAlex = false; + save(); + } + } + return; + }else if(selectedSlot < EaglerProfile.skins.size()) { + int skinX = this.width / 2 - 120; + int skinY = this.height / 6 + 8; + int skinWidth = 80; + int skinHeight = 130; + if(par1 >= skinX && par2 >= skinY && par1 < skinX + skinWidth && par2 < skinY + skinHeight) { + if(selectedSlot < EaglerProfile.skins.size()) { + newSkinWaitSteveOrAlex = true; + return; + } + } + } super.mouseClicked(par1, par2, par3); this.username.mouseClicked(par1, par2, par3); diff --git a/src/main/java/net/lax1dude/eaglercraft/ModelBipedNewSkins.java b/src/main/java/net/lax1dude/eaglercraft/ModelBipedNewSkins.java index 36ccb69..13e969a 100644 --- a/src/main/java/net/lax1dude/eaglercraft/ModelBipedNewSkins.java +++ b/src/main/java/net/lax1dude/eaglercraft/ModelBipedNewSkins.java @@ -12,13 +12,12 @@ public class ModelBipedNewSkins extends ModelBiped { public ModelRenderer field_178730_v; private ModelRenderer field_178729_w; private ModelRenderer field_178736_x; - private boolean field_178735_y; - private static final String __OBFID = "CL_00002626"; + private boolean isAlex; public ModelBipedNewSkins(float p_i46304_1_, boolean p_i46304_2_) { super(p_i46304_1_, 0.0F, 64, 64); - this.field_178735_y = p_i46304_2_; + this.isAlex = p_i46304_2_; this.field_178736_x = new ModelRenderer(this, 24, 0); this.field_178736_x.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, p_i46304_1_); this.field_178729_w = new ModelRenderer(this, 0, 0); @@ -124,7 +123,7 @@ public class ModelBipedNewSkins extends ModelBiped { } public void postRenderHiddenArm(float p_178718_1_) { - if (this.field_178735_y) { + if (this.isAlex) { ++this.bipedRightArm.rotationPointX; this.bipedRightArm.postRender(p_178718_1_); --this.bipedRightArm.rotationPointX; diff --git a/src/main/java/net/minecraft/src/ModelBiped.java b/src/main/java/net/minecraft/src/ModelBiped.java index 9d2caf5..8bf4e50 100644 --- a/src/main/java/net/minecraft/src/ModelBiped.java +++ b/src/main/java/net/minecraft/src/ModelBiped.java @@ -1,5 +1,6 @@ package net.minecraft.src; +import net.lax1dude.eaglercraft.DefaultSkinRenderer; import net.lax1dude.eaglercraft.EaglerAdapter; @@ -90,7 +91,9 @@ public class ModelBiped extends ModelBase { EaglerAdapter.glPushMatrix(); EaglerAdapter.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); EaglerAdapter.glTranslatef(0.0F, 24.0F * par7, 0.0F); + if(par1Entity instanceof EntityPlayer && DefaultSkinRenderer.getPlayerRenderer((EntityPlayer)par1Entity) <= 0) EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST); this.bipedBody.render(par7); + if(par1Entity instanceof EntityPlayer && DefaultSkinRenderer.getPlayerRenderer((EntityPlayer)par1Entity) <= 0) EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); @@ -99,7 +102,9 @@ public class ModelBiped extends ModelBase { EaglerAdapter.glPopMatrix(); } else { this.bipedHead.render(par7); + if(par1Entity instanceof EntityPlayer && DefaultSkinRenderer.getPlayerRenderer((EntityPlayer)par1Entity) <= 0) EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST); this.bipedBody.render(par7); + if(par1Entity instanceof EntityPlayer && DefaultSkinRenderer.getPlayerRenderer((EntityPlayer)par1Entity) <= 0) EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); diff --git a/src/main/java/net/minecraft/src/RenderPlayer.java b/src/main/java/net/minecraft/src/RenderPlayer.java index cd51fc7..bd6ff67 100644 --- a/src/main/java/net/minecraft/src/RenderPlayer.java +++ b/src/main/java/net/minecraft/src/RenderPlayer.java @@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft; public class RenderPlayer extends RenderLiving { private ModelBiped modelBipedMain; private ModelBiped modelBipedMainNewSkin; + private ModelBiped modelBipedMainNewSkinSlim; private ModelBiped modelArmorChestplate; private ModelBiped modelArmor; private static final String[] armorFilenamePrefix = new String[] { "cloth", "chain", "iron", "diamond", "gold" }; @@ -19,6 +20,7 @@ public class RenderPlayer extends RenderLiving { super(new ModelBiped(0.0F), 0.5F); this.modelBipedMain = (ModelBiped) this.mainModel; this.modelBipedMainNewSkin = new ModelBipedNewSkins(0.0F, false); + this.modelBipedMainNewSkinSlim = new ModelBipedNewSkins(0.0F, true); this.modelArmorChestplate = new ModelBiped(1.0F); this.modelArmor = new ModelBiped(0.5F); } @@ -112,32 +114,32 @@ public class RenderPlayer extends RenderLiving { float var10 = 1.0F; EaglerAdapter.glColor3f(var10, var10, var10); ItemStack var11 = par1EntityPlayer.inventory.getCurrentItem(); - this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = var11 != null ? 1 : 0; + this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = this.modelBipedMainNewSkinSlim.heldItemRight = var11 != null ? 1 : 0; if (var11 != null && par1EntityPlayer.getItemInUseCount() > 0) { EnumAction var12 = var11.getItemUseAction(); if (var12 == EnumAction.block) { - this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = 3; + this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = this.modelBipedMainNewSkinSlim.heldItemRight = 3; } else if (var12 == EnumAction.bow) { - this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = this.modelBipedMainNewSkin.aimedBow = true; + this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = this.modelBipedMainNewSkin.aimedBow = this.modelBipedMainNewSkinSlim.aimedBow = true; } } - this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = this.modelBipedMainNewSkin.isSneak = par1EntityPlayer.isSneaking(); + this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = this.modelBipedMainNewSkin.isSneak = this.modelBipedMainNewSkinSlim.aimedBow = par1EntityPlayer.isSneaking(); double var14 = par4 - (double) par1EntityPlayer.yOffset; if (par1EntityPlayer.isSneaking() && !(par1EntityPlayer instanceof EntityPlayerSP)) { var14 -= 0.125D; } - this.mainModel = (DefaultSkinRenderer.isPlayerNewSkin(par1EntityPlayer) ? this.modelBipedMainNewSkin : this.modelBipedMain); + this.mainModel = (DefaultSkinRenderer.isPlayerNewSkin(par1EntityPlayer) ? (DefaultSkinRenderer.isPlayerNewSkinSlim(par1EntityPlayer) ? this.modelBipedMainNewSkinSlim : this.modelBipedMainNewSkin) : this.modelBipedMain); this.mainModel.isChild = false; super.doRenderLiving(par1EntityPlayer, par2, var14, par6, par8, par9); this.mainModel = this.modelBipedMain; - this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = this.modelBipedMainNewSkin.aimedBow = false; - this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = this.modelBipedMainNewSkin.isSneak = false; - this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = 0; + this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = this.modelBipedMainNewSkin.aimedBow = this.modelBipedMainNewSkinSlim.aimedBow = false; + this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = this.modelBipedMainNewSkin.isSneak = this.modelBipedMainNewSkinSlim.isSneak = false; + this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = this.modelBipedMainNewSkin.heldItemRight = this.modelBipedMainNewSkinSlim.heldItemRight = 0; }else { int renderType = DefaultSkinRenderer.getPlayerRenderer(par1EntityPlayer); if(DefaultSkinRenderer.isZombieModel(renderType)) { @@ -582,7 +584,7 @@ public class RenderPlayer extends RenderLiving { protected void bindTexture(EntityLiving par1EntityLiving) { if(par1EntityLiving instanceof EntityClientPlayerMP) { if(EaglerProfile.presetSkinId < 0) { - Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.glTex.get(EaglerProfile.customSkinId)); + Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(EaglerProfile.customSkinId).glTex); }else { DefaultSkinRenderer.defaultVanillaSkins[EaglerProfile.presetSkinId].bindTexture(); } diff --git a/src/main/java/net/minecraft/src/RenderXPOrb.java b/src/main/java/net/minecraft/src/RenderXPOrb.java index 9704407..3f34ff3 100644 --- a/src/main/java/net/minecraft/src/RenderXPOrb.java +++ b/src/main/java/net/minecraft/src/RenderXPOrb.java @@ -18,6 +18,8 @@ public class RenderXPOrb extends Render { public void renderTheXPOrb(EntityXPOrb par1EntityXPOrb, double par2, double par4, double par6, float par8, float par9) { EaglerAdapter.glPushMatrix(); EaglerAdapter.glTranslatef((float) par2, (float) par4, (float) par6); + EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); + EaglerAdapter.glAlphaFunc(0, 0.003921569f); int var10 = par1EntityXPOrb.getTextureByXP(); tex_xporb.bindTexture(); Tessellator var11 = Tessellator.instance; @@ -53,6 +55,7 @@ public class RenderXPOrb extends Render { var11.draw(); EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL); + EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING); EaglerAdapter.glPopMatrix(); }