Cape stuffs

This commit is contained in:
ThisIsALegitUsername 2023-02-21 23:05:55 +00:00
parent 140185f62b
commit 8ba300f063
5 changed files with 25 additions and 63 deletions

View File

@ -2,35 +2,32 @@ package dev.resent.cape;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class CapeManager { public class CapeManager {
public static ResourceLocation capeLocation;
public static void displayChooser(){ public static void displayChooser(){
EagRuntime.displayFileChooser("image/png", "png"); EagRuntime.displayFileChooser("image/png", "png");
} }
public static ResourceLocation capeLocation; public static ResourceLocation getCapeLocation(){
return capeLocation;
/*public static void loadCape(){ }
CapeManager.free();
if (EagRuntime.fileChooserHasResult()) {
FileChooserResult result = EagRuntime.getFileChooserResult();
if (result != null) {
ImageData loadedCape = ImageData.loadImageFile(result.fileData);
if(loadedCape != null){
capeLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcape", new DynamicTexture(loadedCape));
Minecraft.getMinecraft().getTextureManager().bindTexture(capeLocation);
} else {
EagRuntime.showPopup("The selected file '" + result.fileName + "' is not a PNG file!");
}
}
}
}*/
public static void free(){ public static void free(){
Minecraft.getMinecraft().getTextureManager().deleteTexture(capeLocation); Minecraft.getMinecraft().getTextureManager().deleteTexture(capeLocation);
capeLocation = null; capeLocation = null;
} }
public static boolean shouldRender(AbstractClientPlayer player){
if(player == Minecraft.getMinecraft().thePlayer){
return true;
}
return false;
}
} }

View File

@ -12,8 +12,8 @@ import net.minecraft.client.renderer.texture.DynamicTexture;
public class CapeUi extends GuiScreen { public class CapeUi extends GuiScreen {
public void initGui() { public void initGui() {
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 148, "Back")); buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 128, "Back"));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 6 + 168, "Choose cape")); buttonList.add(new GuiButton(1, width / 2 - 100, height / 6 + 150, "Choose cape"));
} }
public void onGuiClosed() { public void onGuiClosed() {
@ -43,7 +43,7 @@ public class CapeUi extends GuiScreen {
protected void actionPerformed(GuiButton par1GuiButton) { protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 200) { if (par1GuiButton.id == 200) {
this.mc.displayGuiScreen(null); mc.displayGuiScreen(null);
}else if(par1GuiButton.id == 1){ }else if(par1GuiButton.id == 1){
CapeManager.displayChooser(); CapeManager.displayChooser();
} }

View File

@ -5,36 +5,8 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import dev.resent.module.base.Mod.Category; import dev.resent.module.base.Mod.Category;
import dev.resent.module.impl.hud.ArmorHud; import dev.resent.module.impl.hud.*;
import dev.resent.module.impl.hud.CPS; import dev.resent.module.impl.misc.*;
import dev.resent.module.impl.hud.Cape;
import dev.resent.module.impl.hud.ComboCounter;
import dev.resent.module.impl.hud.FPS;
import dev.resent.module.impl.hud.Freelook;
import dev.resent.module.impl.hud.Hitboxes;
import dev.resent.module.impl.hud.Info;
import dev.resent.module.impl.hud.KeyStrokes;
import dev.resent.module.impl.hud.PotCounter;
import dev.resent.module.impl.hud.PotionHUD;
import dev.resent.module.impl.hud.ReachDisplay;
import dev.resent.module.impl.misc.Animations;
import dev.resent.module.impl.misc.AutoGG;
import dev.resent.module.impl.misc.AutoRespawn;
import dev.resent.module.impl.misc.ClearChat;
import dev.resent.module.impl.misc.Cosmetics;
import dev.resent.module.impl.misc.CrystalOptimizer;
import dev.resent.module.impl.misc.DynamicFOV;
import dev.resent.module.impl.misc.FPSB;
import dev.resent.module.impl.misc.Fullbright;
import dev.resent.module.impl.misc.HUD;
import dev.resent.module.impl.misc.MinimalViewBobbing;
import dev.resent.module.impl.misc.NoParticles;
import dev.resent.module.impl.misc.NoRain;
import dev.resent.module.impl.misc.NoSwingDelay;
import dev.resent.module.impl.misc.Scoreboard;
import dev.resent.module.impl.misc.SelfNametag;
import dev.resent.module.impl.misc.Sprint;
import dev.resent.module.impl.misc.TabGui;
public class ModManager { public class ModManager {
@ -69,7 +41,7 @@ public class ModManager {
public static CrystalOptimizer crystalOptimizer = new CrystalOptimizer(); public static CrystalOptimizer crystalOptimizer = new CrystalOptimizer();
public static TabGui tabGui = new TabGui(); public static TabGui tabGui = new TabGui();
public static SelfNametag selfNametag = new SelfNametag(); public static SelfNametag selfNametag = new SelfNametag();
public Cape cape = new Cape(); public static Cape cape = new Cape();
public ModManager() { public ModManager() {
//Hud //Hud

View File

@ -1,4 +1,4 @@
package dev.resent.module.impl.hud; package dev.resent.module.impl.misc;
import dev.resent.annotation.Module; import dev.resent.annotation.Module;
import dev.resent.cape.CapeUi; import dev.resent.cape.CapeUi;
@ -8,7 +8,4 @@ import dev.resent.module.base.Mod.Category;
@Module(name = "Cape", category = Category.MISC) @Module(name = "Cape", category = Category.MISC)
public class Cape extends Mod{ public class Cape extends Mod{
public void onEnable(){
mc.displayGuiScreen(new CapeUi());
}
} }

View File

@ -1,13 +1,12 @@
package net.minecraft.client.renderer.entity.layers; package net.minecraft.client.renderer.entity.layers;
import dev.resent.cape.CapeManager; import dev.resent.cape.CapeManager;
import dev.resent.module.base.ModManager;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -36,12 +35,9 @@ 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) { 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 == Minecraft.getMinecraft().thePlayer) { if (abstractclientplayer.hasPlayerInfo() && !abstractclientplayer.isInvisible() && this.playerRenderer.getMainModel() instanceof ModelPlayer && ModManager.cape.isEnabled() && CapeManager.shouldRender(abstractclientplayer)) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
//this.playerRenderer.bindTexture(Cape.getCapeLocation()); if(CapeManager.capeLocation != null){
if(CapeManager.capeLocation == null){
this.playerRenderer.bindTexture(new ResourceLocation("eagler:gui/unnamed.png"));
}else {
this.playerRenderer.bindTexture(CapeManager.capeLocation); this.playerRenderer.bindTexture(CapeManager.capeLocation);
} }
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();