Render capes in-game

This commit is contained in:
JessePinkman27 2023-12-10 21:06:03 +00:00
parent 776a2daafa
commit 873a3680e0
4 changed files with 32406 additions and 32373 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,6 @@ public class GuiScreenEditProfile extends GuiScreen {
private boolean dragging = false;
private int mousex = 0;
private int mousey = 0;
private String cape = "noCape";
private SkinModel globalModel = null;
private boolean newSkinWaitSteveOrAlex = false;
@ -280,8 +279,8 @@ public class GuiScreenEditProfile extends GuiScreen {
if(!dropDownOpen) {
if(par1GuiButton.id == 0) {
safeProfile();
if(cape != "noCape") {
socket.send("login:" + EaglerProfile.getName() + ":" + cape);
if(EaglerProfile.presetCapeId != 0 && !(EaglerProfile.presetCapeId < 0)) {
socket.send("login:" + EaglerProfile.getName() + ":" + EaglerProfile.presetCapeId);
}
this.mc.displayGuiScreen((GuiScreen) parent);
}else if(par1GuiButton.id == 1) {
@ -516,7 +515,7 @@ public class GuiScreenEditProfile extends GuiScreen {
public static WebSocket socket;
public static boolean isConnected = false;
public static HashMap<String, String> capes = new HashMap<String, String>();
public static HashMap<String, Integer> capes = new HashMap<String, Integer>();
@SuppressWarnings("unchecked")
public static final void startWebsocketConnection(String s) {
@ -535,7 +534,7 @@ public class GuiScreenEditProfile extends GuiScreen {
MessageEvent messageEvent = (MessageEvent) event;
String message = messageEvent.getData().toString();
String[] message1 = message.split(":");
capes.put(message1[0], message1[1]);
capes.put(message1[0], Integer.parseInt(message1[1]));
}
});

View File

@ -1,11 +1,14 @@
package net.minecraft.client.renderer.entity.layers;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
import net.lax1dude.eaglercraft.v1_8.profile.GuiScreenEditProfile;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
/**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -28,6 +31,30 @@ import net.minecraft.util.MathHelper;
public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
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 LayerCape(RenderPlayer playerRendererIn) {
this.playerRenderer = playerRendererIn;
}
@ -39,7 +66,9 @@ public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
&& abstractclientplayer.getLocationCape() != null
&& this.playerRenderer.getMainModel() instanceof ModelPlayer) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.playerRenderer.bindTexture(abstractclientplayer.getLocationCape());
if(GuiScreenEditProfile.capes.containsKey(abstractclientplayer.getName())) {
this.playerRenderer.bindTexture(defaultVanillaCapes[GuiScreenEditProfile.capes.get(abstractclientplayer.getName())]);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.125F);
double d0 = abstractclientplayer.prevChasingPosX