Multiplayer capes

This commit is contained in:
JessePinkman27 2023-12-10 20:32:16 +00:00
parent dd4da4ed46
commit 776a2daafa
29 changed files with 37185 additions and 36677 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,6 +35,9 @@ public class EaglerProfile {
public static int presetSkinId; public static int presetSkinId;
public static int customSkinId; public static int customSkinId;
public static int presetCapeId;
public static final int[] CAPE_DATA_SIZE = new int[] { 32*32*4, -9, 1 };
public static final List<CustomSkin> customSkins = new ArrayList(); public static final List<CustomSkin> customSkins = new ArrayList();
@ -59,6 +62,15 @@ public class EaglerProfile {
} }
} }
public static int getCapeSize(int len) {
for(int i = 0; i < CAPE_DATA_SIZE.length; ++i) {
if(len == CAPE_DATA_SIZE[i]) {
return i;
}
}
return -1;
}
public static SkinModel getActiveSkinModel() { public static SkinModel getActiveSkinModel() {
if(presetSkinId == -1) { if(presetSkinId == -1) {
if(customSkinId >= 0 && customSkinId < customSkins.size()) { if(customSkinId >= 0 && customSkinId < customSkins.size()) {
@ -165,6 +177,7 @@ public class EaglerProfile {
presetSkinId = profile.getInteger("presetSkin"); presetSkinId = profile.getInteger("presetSkin");
customSkinId = profile.getInteger("customSkin"); customSkinId = profile.getInteger("customSkin");
presetCapeId = profile.getInteger("presetCape");
String loadUsername = profile.getString("username").trim(); String loadUsername = profile.getString("username").trim();
@ -209,6 +222,7 @@ public class EaglerProfile {
NBTTagCompound profile = new NBTTagCompound(); NBTTagCompound profile = new NBTTagCompound();
profile.setInteger("presetSkin", presetSkinId); profile.setInteger("presetSkin", presetSkinId);
profile.setInteger("customSkin", customSkinId); profile.setInteger("customSkin", customSkinId);
profile.setInteger("presetCape", presetCapeId);
profile.setString("username", username); profile.setString("username", username);
NBTTagList skinsList = new NBTTagList(); NBTTagList skinsList = new NBTTagList();
for(int i = 0, l = customSkins.size(); i < l; ++i) { for(int i = 0, l = customSkins.size(); i < l; ++i) {

View File

@ -0,0 +1,252 @@
package net.lax1dude.eaglercraft.v1_8.profile;
import java.io.IOException;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
public class GuiScreenEditCape extends GuiScreen {
GuiScreen parent;
private int skinToShow;
private int mousex = 0;
private int mousey = 0;
private boolean dropDownOpen = false;
private String[] dropDownOptions;
private int slotsVisible = 0;
private int selectedSlot = 0;
private int scrollPos = -1;
private int skinsHeight = 0;
private boolean dragging = false;
SkinModel model = null;
public static final String[] defaultVanillaCapeNames = new String[] {
"No Cape",
"Minecon 2011",
"Minecon 2012",
"Minecon 2013",
"Minecon 2015",
"Minecon 2016",
"Microsoft Account",
"Realms Mapmaker",
"Mojang Old",
"Mojang New",
"Jira Moderator",
"Mojang Very Old",
"Scrolls",
"Cobalt",
"Lang Translator",
"Millionth Player",
"Prismarine",
"Snowman",
"Spade",
"Birthday",
"dB"
};
public GuiScreenEditCape(GuiScreen parent, int skinToShow, SkinModel model) {
this.parent = parent;
this.skinToShow = skinToShow;
this.selectedSlot = EaglerProfile.presetCapeId;
this.model = model;
}
public void initGui() {
Keyboard.enableRepeatEvents(true);
this.buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168, I18n.format("gui.done")));
}
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
private static final ResourceLocation eaglerGui = new ResourceLocation("eagler:gui/eagler_gui.png");
public void drawScreen(int mx, int my, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, "Select Cape", this.width / 2, 15, 16777215);
mousex = mx;
mousey = my;
int skinX = width / 2 - 120;
int skinY = height / 6 + 8;
int skinWidth = 80;
int skinHeight = 130;
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, 0xff000015);
if(dropDownOpen) {
super.drawScreen(-1, -1, par3);
} else {
super.drawScreen(mx, my, par3);
}
skinX = width / 2 - 20;
skinY = height / 6 + 53;
skinWidth = 140;
skinHeight = 22;
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 21, skinY + skinHeight - 1, -16777216);
drawRect(skinX + skinWidth - 20, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216);
GlStateManager.color(1f, 1f, 1f, 1f);
mc.getTextureManager().bindTexture(eaglerGui);
drawTexturedModalRect(skinX + skinWidth - 18, skinY + 3, 0, 240, 16, 16);
this.fontRendererObj.drawStringWithShadow(dropDownOptions[selectedSlot], skinX + 5, skinY + 7, 14737632);
EaglerProfile.presetCapeId = selectedSlot;
skinX = width / 2 - 20;
skinY = height / 6 + 74;
skinWidth = 140;
skinHeight = (height - skinY - 4);
slotsVisible = (skinHeight / 10);
if(slotsVisible > dropDownOptions.length) slotsVisible = dropDownOptions.length;
skinHeight = slotsVisible * 10 + 7;
skinsHeight = skinHeight;
if(scrollPos == -1) {
scrollPos = selectedSlot - 2;
}
if(scrollPos > (dropDownOptions.length - slotsVisible)) {
scrollPos = (dropDownOptions.length - slotsVisible);
}
if(scrollPos < 0) {
scrollPos = 0;
}
if(dropDownOpen) {
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216);
for(int i = 0; i < slotsVisible; i++) {
if(i + scrollPos < dropDownOptions.length) {
int idx = i + scrollPos;
if(selectedSlot == i + scrollPos) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x77ffffff);
}else if(mx >= skinX && mx < (skinX + skinWidth - 10) && my >= (skinY + i*10 + 5) && my < (skinY + i*10 + 15)) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x55ffffff);
}
this.fontRendererObj.drawStringWithShadow(dropDownOptions[i + scrollPos], skinX + 5, skinY + 5 + i*10, 14737632);
}
}
int scrollerSize = skinHeight * slotsVisible / dropDownOptions.length;
int scrollerPos = skinHeight * scrollPos / dropDownOptions.length;
drawRect(skinX + skinWidth - 4, skinY + scrollerPos + 1, skinX + skinWidth - 1, skinY + scrollerPos + scrollerSize, 0xff888888);
}
int xx = width / 2 - 80;
int yy = height / 6 + 130;
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, model, true);
}
protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 200) {
mc.displayGuiScreen((GuiScreen) parent);
}
}
public void updateScreen() {
if(dropDownOpen) {
if(Mouse.isButtonDown(0)) {
int skinX = this.width / 2 - 20;
int skinY = this.height / 6 + 74;
int skinWidth = 140;
if(mousex >= (skinX + skinWidth - 10) && mousex < (skinX + skinWidth) && mousey >= skinY && mousey < (skinY + skinsHeight)) {
dragging = true;
}
if(dragging) {
int scrollerSize = skinsHeight * slotsVisible / dropDownOptions.length;
scrollPos = (mousey - skinY - (scrollerSize / 2)) * dropDownOptions.length / skinsHeight;
}
} else {
dragging = false;
}
} else {
dragging = false;
}
}
private int[] grabPiece(int[] input, int w, int h, int sw) {
int[] ret = new int[w * h];
for(int i = 0; i < h; ++i) {
System.arraycopy(input, i * sw, ret, i * w, w);
}
return ret;
}
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(dropDownOpen) {
int var1 = Mouse.getEventDWheel();
if(var1 < 0) {
scrollPos += 3;
}
if(var1 > 0) {
scrollPos -= 3;
if(scrollPos < 0) {
scrollPos = 0;
}
}
}
}
protected void keyTyped(char par1, int par2) {
if(par2 == 200 && selectedSlot > 0) {
--selectedSlot;
scrollPos = selectedSlot - 2;
}
if(par2 == 208 && selectedSlot < (dropDownOptions.length - 1)) {
++selectedSlot;
scrollPos = selectedSlot - 2;
}
}
protected void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3);
if (par3 == 0) {
int skinX = this.width / 2 + 140 - 40;
int skinY = this.height / 6 + 53;
if(par1 >= skinX && par1 < (skinX + 20) && par2 >= skinY && par2 < (skinY + 22)) {
dropDownOpen = !dropDownOpen;
}
skinX = this.width / 2 - 20;
skinY = this.height / 6 + 53;
int skinWidth = 140;
int skinHeight = skinsHeight;
if(!(par1 >= skinX && par1 < (skinX + skinWidth) && par2 >= skinY && par2 < (skinY + skinHeight + 22))) {
dropDownOpen = false;
dragging = false;
}
skinY += 21;
if(dropDownOpen && !dragging) {
for(int i = 0; i < slotsVisible; i++) {
if(i + scrollPos < dropDownOptions.length) {
if(selectedSlot != i + scrollPos) {
if(par1 >= skinX && par1 < (skinX + skinWidth - 10) && par2 >= (skinY + i*10 + 5) && par2 < (skinY + i*10 + 15) && selectedSlot != i + scrollPos) {
selectedSlot = i + scrollPos;
dropDownOpen = false;
dragging = false;
}
}
}
}
}
}
}
}

View File

@ -7,7 +7,9 @@ import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.internal.FileChooserResult; import net.lax1dude.eaglercraft.v1_8.internal.FileChooserResult;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData; import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
@ -16,6 +18,13 @@ import net.minecraft.util.ResourceLocation;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import org.teavm.jso.JSBody;
import org.teavm.jso.dom.events.Event;
import org.teavm.jso.dom.events.EventListener;
import org.teavm.jso.dom.events.MessageEvent;
import org.teavm.jso.websocket.WebSocket;
/** /**
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved. * Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
@ -44,6 +53,8 @@ public class GuiScreenEditProfile extends GuiScreen {
private boolean dragging = false; private boolean dragging = false;
private int mousex = 0; private int mousex = 0;
private int mousey = 0; private int mousey = 0;
private String cape = "noCape";
private SkinModel globalModel = null;
private boolean newSkinWaitSteveOrAlex = false; private boolean newSkinWaitSteveOrAlex = false;
@ -57,6 +68,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
public void initGui() { public void initGui() {
startWebsocketConnection(configureServerIP());
Keyboard.enableRepeatEvents(true); Keyboard.enableRepeatEvents(true);
screenTitle = I18n.format("editProfile.title"); screenTitle = I18n.format("editProfile.title");
usernameField = new GuiTextField(0, fontRendererObj, width / 2 - 20 + 1, height / 6 + 24 + 1, 138, 20); usernameField = new GuiTextField(0, fontRendererObj, width / 2 - 20 + 1, height / 6 + 24 + 1, 138, 20);
@ -66,6 +78,7 @@ public class GuiScreenEditProfile extends GuiScreen {
buttonList.add(new GuiButton(0, width / 2 - 100, height / 6 + 168, I18n.format("gui.done"))); buttonList.add(new GuiButton(0, width / 2 - 100, height / 6 + 168, I18n.format("gui.done")));
buttonList.add(new GuiButton(1, width / 2 - 21, height / 6 + 110, 71, 20, I18n.format("editProfile.addSkin"))); buttonList.add(new GuiButton(1, width / 2 - 21, height / 6 + 110, 71, 20, I18n.format("editProfile.addSkin")));
buttonList.add(new GuiButton(2, width / 2 - 21 + 71, height / 6 + 110, 72, 20, I18n.format("editProfile.clearSkin"))); buttonList.add(new GuiButton(2, width / 2 - 21 + 71, height / 6 + 110, 72, 20, I18n.format("editProfile.clearSkin")));
buttonList.add(new GuiButton(3, width / 2 - 100, height / 6 + 128, I18n.format("Capes")));
} }
private void updateOptions() { private void updateOptions() {
@ -197,7 +210,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(newSkin.getResource()); mc.getTextureManager().bindTexture(newSkin.getResource());
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.STEVE); SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.STEVE, false);
skinX = width / 2 + 20; skinX = width / 2 + 20;
skinY = height / 4; skinY = height / 4;
@ -222,7 +235,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(newSkin.getResource()); mc.getTextureManager().bindTexture(newSkin.getResource());
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.ALEX); SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.ALEX, false);
}else { }else {
skinX = this.width / 2 - 120; skinX = this.width / 2 - 120;
skinY = this.height / 6 + 8; skinY = this.height / 6 + 8;
@ -242,7 +255,8 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(texture); mc.getTextureManager().bindTexture(texture);
SkinPreviewRenderer.renderBiped(xx, yy, newSkinWaitSteveOrAlex ? width / 2 : mx, newSkinWaitSteveOrAlex ? height / 2 : my, model); globalModel = model;
SkinPreviewRenderer.renderBiped(xx, yy, newSkinWaitSteveOrAlex ? width / 2 : mx, newSkinWaitSteveOrAlex ? height / 2 : my, model, false);
} }
} }
@ -266,7 +280,9 @@ public class GuiScreenEditProfile extends GuiScreen {
if(!dropDownOpen) { if(!dropDownOpen) {
if(par1GuiButton.id == 0) { if(par1GuiButton.id == 0) {
safeProfile(); safeProfile();
CustomSky.update(); if(cape != "noCape") {
socket.send("login:" + EaglerProfile.getName() + ":" + cape);
}
this.mc.displayGuiScreen((GuiScreen) parent); this.mc.displayGuiScreen((GuiScreen) parent);
}else if(par1GuiButton.id == 1) { }else if(par1GuiButton.id == 1) {
EagRuntime.displayFileChooser("image/png", "png"); EagRuntime.displayFileChooser("image/png", "png");
@ -275,6 +291,9 @@ public class GuiScreenEditProfile extends GuiScreen {
safeProfile(); safeProfile();
updateOptions(); updateOptions();
selectedSlot = 0; selectedSlot = 0;
} else if(par1GuiButton.id == 3) {
safeProfile();
this.mc.displayGuiScreen(new GuiScreenEditCape(this, selectedSlot, globalModel));
} }
} }
} }
@ -461,5 +480,87 @@ public class GuiScreenEditProfile extends GuiScreen {
EaglerProfile.setName(name); EaglerProfile.setName(name);
EaglerProfile.write(); EaglerProfile.write();
} }
public static String configureServerIP() {
String uri = "play.mrpolog.tk:25565";
String uria = null;
if(!uri.contains("://")){
uri = ( isSSLPage() ? "wss://" : "ws://") + uri;
uria = uri;
} else {
System.err.println("Invalid URI WebSocket Protocol!");
}
int i = uria.lastIndexOf(':');
int port = -1;
if(i > 0 && uria.startsWith("[") && uria.charAt(i - 1) != ']') {
i = -1;
}
if(i == -1) port = uri.startsWith("wss") ? 443 : 80;
if(uria.endsWith("/")) uria = uria.substring(0, uria.length() - 1);
if(port == -1) {
try {
int i2 = uria.indexOf('/');
port = Integer.parseInt(uria.substring(i + 1, i2 == -1 ? uria.length() : i2 - 1));
}catch(Throwable t) {
System.err.println("Invalid Port!");
}
}
return uria;
}
public static WebSocket socket;
public static boolean isConnected = false;
public static HashMap<String, String> capes = new HashMap<String, String>();
@SuppressWarnings("unchecked")
public static final void startWebsocketConnection(String s) {
socket = WebSocket.create(s);
socket.onOpen(new EventListener() {
@Override
public void handleEvent(Event event) {
isConnected = true;
}
});
socket.onMessage(new EventListener() {
@Override
public void handleEvent(Event event) {
MessageEvent messageEvent = (MessageEvent) event;
String message = messageEvent.getData().toString();
String[] message1 = message.split(":");
capes.put(message1[0], message1[1]);
}
});
socket.onClose(new EventListener() {
@Override
public void handleEvent(Event event) {
isConnected = false;
}
});
socket.onError(new EventListener() {
@Override
public void handleEvent(Event event) {
socket.close();
isConnected = false;
System.err.println("WebSocket error occurred");
}
});
}
@JSBody(params = { }, script = "return window.location.href;")
private static native String getLocationString();
public static final boolean isSSLPage() {
return getLocationString().startsWith("https");
}
} }

View File

@ -1,10 +1,13 @@
package net.lax1dude.eaglercraft.v1_8.profile; package net.lax1dude.eaglercraft.v1_8.profile;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelZombie; import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.util.ResourceLocation;
/** /**
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved. * Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
@ -25,6 +28,30 @@ public class SkinPreviewRenderer {
private static ModelPlayer playerModelAlex = null; private static ModelPlayer playerModelAlex = null;
private static ModelZombie playerModelZombie = null; private static ModelZombie playerModelZombie = null;
public static final ResourceLocation[] defaultVanillaCapes = new ResourceLocation[] {
null,
new ResourceLocation("/capes/c01.minecon_2011.png"),
new ResourceLocation("/capes/c02.minecon_2012.png"),
new ResourceLocation("/capes/c03.minecon_2013.png"),
new ResourceLocation("/capes/c04.minecon_2015.png"),
new ResourceLocation("/capes/c05.minecon_2016.png"),
new ResourceLocation("/capes/c06.microsoft_account.png"),
new ResourceLocation("/capes/c07.mapmaker.png"),
new ResourceLocation("/capes/c08.mojang_old.png"),
new ResourceLocation("/capes/c09.mojang_new.png"),
new ResourceLocation("/capes/c10.jira_mod.png"),
new ResourceLocation("/capes/c11.mojang_very_old.png"),
new ResourceLocation("/capes/c12.scrolls.png"),
new ResourceLocation("/capes/c13.cobalt.png"),
new ResourceLocation("/capes/c14.translator.png"),
new ResourceLocation("/capes/c15.millionth_account.png"),
new ResourceLocation("/capes/c16.prismarine.png"),
new ResourceLocation("/capes/c17.snowman.png"),
new ResourceLocation("/capes/c18.spade.png"),
new ResourceLocation("/capes/c19.birthday.png"),
new ResourceLocation("/capes/c20.db.png")
};
public static void initialize() { public static void initialize() {
playerModelSteve = new ModelPlayer(0.0f, false); playerModelSteve = new ModelPlayer(0.0f, false);
playerModelSteve.isChild = false; playerModelSteve.isChild = false;
@ -34,7 +61,7 @@ public class SkinPreviewRenderer {
playerModelZombie.isChild = false; playerModelZombie.isChild = false;
} }
public static void renderBiped(int x, int y, int mx, int my, SkinModel skinModel) { public static void renderBiped(int x, int y, int mx, int my, SkinModel skinModel, boolean showCape) {
ModelBiped model; ModelBiped model;
switch(skinModel) { switch(skinModel) {
case STEVE: case STEVE:
@ -63,12 +90,39 @@ public class SkinPreviewRenderer {
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
GlStateManager.translate(0.0f, 1.0f, 0.0f); GlStateManager.translate(0.0f, 1.0f, 0.0f);
GlStateManager.rotate(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f); if(showCape) {
GlStateManager.rotate(140.0f, 0.0f, 1.0f, 0.0f);
mx = x - (x - mx) - 20;
GlStateManager.rotate(((y - my) * -0.02f), 1.0f, 0.0f, 0.0f);
} else {
GlStateManager.rotate(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f);
}
GlStateManager.rotate(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f); GlStateManager.rotate(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f);
GlStateManager.translate(0.0f, -1.0f, 0.0f); GlStateManager.translate(0.0f, -1.0f, 0.0f);
model.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 2000000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625f); model.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 2000000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625f);
if(showCape && !(EaglerProfile.presetCapeId >= 0 && defaultVanillaCapes[EaglerProfile.presetCapeId] == null)) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.150F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-6.0F, 1.0F, 0.0F, 0.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(defaultVanillaCapes[EaglerProfile.presetCapeId]);
new ModelBiped(0.0F, 0.0F, 64, 32).bipedCloak.render(0.0625F);
if(EaglerProfile.presetCapeId < 0) {
GlStateManager.matrixMode(RealOpenGLEnums.GL_TEXTURE);
GlStateManager.popMatrix();
GlStateManager.matrixMode(RealOpenGLEnums.GL_MODELVIEW);
}
GlStateManager.popMatrix();
}
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.disableLighting(); GlStateManager.disableLighting();
} }

View File

@ -1237,11 +1237,21 @@ public class Minecraft implements IThreadListener {
public MusicTicker func_181535_r() { public MusicTicker func_181535_r() {
return this.mcMusicTicker; return this.mcMusicTicker;
} }
public int lastKeepAlive = 0;
public int keepAlive = 0;
GuiScreenEditProfile profile;
/**+ /**+
* Runs the current tick. * Runs the current tick.
*/ */
public void runTick() throws IOException { public void runTick() throws IOException {
lastKeepAlive++;
if(lastKeepAlive > (keepAlive + 300) && profile.isConnected) {
profile.socket.send("keepAlivePacket");
keepAlive = lastKeepAlive;
}
Controller.controllerTick(); Controller.controllerTick();

View File

@ -34,6 +34,7 @@ public class ModelBiped extends ModelBase {
public int heldItemRight; public int heldItemRight;
public boolean isSneak; public boolean isSneak;
public boolean aimedBow; public boolean aimedBow;
public ModelRenderer bipedCloak;
public ModelBiped() { public ModelBiped() {
this(0.0F); this(0.0F);
@ -46,6 +47,8 @@ public class ModelBiped extends ModelBase {
public ModelBiped(float modelSize, float parFloat1, int textureWidthIn, int textureHeightIn) { public ModelBiped(float modelSize, float parFloat1, int textureWidthIn, int textureHeightIn) {
this.textureWidth = textureWidthIn; this.textureWidth = textureWidthIn;
this.textureHeight = textureHeightIn; this.textureHeight = textureHeightIn;
this.bipedCloak = new ModelRenderer(this, 0, 0);
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, modelSize);
this.bipedHead = new ModelRenderer(this, 0, 0); this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize); this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize);
this.bipedHead.setRotationPoint(0.0F, 0.0F + parFloat1, 0.0F); this.bipedHead.setRotationPoint(0.0F, 0.0F + parFloat1, 0.0F);
@ -249,4 +252,11 @@ public class ModelBiped extends ModelBase {
public void postRenderArm(float f) { public void postRenderArm(float f) {
this.bipedRightArm.postRender(f); this.bipedRightArm.postRender(f);
} }
/**
* Renders the cloak of the current biped (in most cases, it's a player)
*/
public void renderCloak(float par1) {
this.bipedCloak.render(par1);
}
} }