This commit is contained in:
ThisIsALegitUsername 2023-02-21 21:58:21 +00:00
parent 7cf3516828
commit 8340aff338
5 changed files with 27281 additions and 27256 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,7 @@
package dev.resent.cape;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.FileChooserResult;
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
public class CapeManager {
@ -15,7 +12,7 @@ public class CapeManager {
public static ResourceLocation capeLocation;
public static void loadCape(){
/*public static void loadCape(){
CapeManager.free();
if (EagRuntime.fileChooserHasResult()) {
FileChooserResult result = EagRuntime.getFileChooserResult();
@ -29,7 +26,7 @@ public class CapeManager {
}
}
}
}
}*/
public static void free(){
Minecraft.getMinecraft().getTextureManager().deleteTexture(capeLocation);

View File

@ -1,16 +1,19 @@
package dev.resent.cape;
import dev.resent.client.Resent;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.ClickGUI;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.internal.FileChooserResult;
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.DynamicTexture;
public class CapeUi extends GuiScreen {
public void initGui() {
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 148, "Back"));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 6 + 168, "Choose cape"));
}
public void onGuiClosed() {
@ -19,14 +22,30 @@ public class CapeUi extends GuiScreen {
}
public void drawScreen(int mx, int my, float par3) {
this.drawDefaultBackground();
Resent.INSTANCE.modManager.modules.stream().filter(m -> m.isEnabled() && m instanceof RenderMod).forEach(rm -> ((RenderMod)rm).renderLayout(mx, my));
super.drawScreen(mx, my, par3);
}
public void updateScreen(){
if (EagRuntime.fileChooserHasResult()) {
CapeManager.free();
FileChooserResult result = EagRuntime.getFileChooserResult();
if (result != null) {
ImageData loadedCape = ImageData.loadImageFile(result.fileData);
if(loadedCape != null){
CapeManager.capeLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcape", new DynamicTexture(loadedCape));
//Minecraft.getMinecraft().getTextureManager().bindTexture(CapeManager.capeLocation);
} else {
EagRuntime.showPopup("The selected file '" + result.fileName + "' is not a PNG file!");
}
}
}
}
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 200) {
this.mc.displayGuiScreen(new ClickGUI());
this.mc.displayGuiScreen(null);
}else if(par1GuiButton.id == 1){
CapeManager.displayChooser();
}
}
}

View File

@ -1,5 +1,6 @@
package net.minecraft.client.renderer.entity.layers;
import dev.resent.cape.CapeManager;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
@ -35,10 +36,14 @@ public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
}
public void doRenderLayer(AbstractClientPlayer abstractclientplayer, float var2, float var3, float f, float var5, float var6, float var7, float var8) {
if (abstractclientplayer.hasPlayerInfo() && !abstractclientplayer.isInvisible() && this.playerRenderer.getMainModel() instanceof ModelPlayer || abstractclientplayer.getName().equals(Minecraft.getMinecraft().thePlayer.getName())) {
if (abstractclientplayer.hasPlayerInfo() && !abstractclientplayer.isInvisible() && this.playerRenderer.getMainModel() instanceof ModelPlayer || abstractclientplayer == Minecraft.getMinecraft().thePlayer) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
//this.playerRenderer.bindTexture(Cape.getCapeLocation());
this.playerRenderer.bindTexture(new ResourceLocation("eagler:gui/unnamed.png"));
if(CapeManager.capeLocation == null){
this.playerRenderer.bindTexture(new ResourceLocation("eagler:gui/unnamed.png"));
}else {
this.playerRenderer.bindTexture(CapeManager.capeLocation);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.125F);
double d0 = abstractclientplayer.prevChasingPosX + (abstractclientplayer.chasingPosX - abstractclientplayer.prevChasingPosX) * (double) f - (abstractclientplayer.prevPosX + (abstractclientplayer.posX - abstractclientplayer.prevPosX) * (double) f);