This commit is contained in:
ThisIsALegitUsername 2023-03-03 02:50:24 +00:00
parent 6e8003bec0
commit 0c5ad30a9b
6 changed files with 20292 additions and 20254 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -108,7 +108,7 @@
</div>
<script type="text/javascript">
function updateTextProgress(event, epkSize){
document.getElementById("progresstext").innerText = Math.round(event.loaded/epkSize*10000)/100 + "%" + "(" + Math.round(event.loaded/1024/1024*100)/100 + "MB" + "/" + Math.round(epkSize/1024/1024*100)/100 + "MB )";
document.getElementById("progresstext").innerText = Math.round(event.loaded/epkSize*10000)/100 + "%" + "(" + Math.round(event.loaded/1024/1024) + "MB" + "/" + Math.round(epkSize/1024/1024) + "MB )";
}
function setVersion(version){

View File

@ -1,8 +1,10 @@
package dev.resent.visual.cape;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
public class CapeManager {
@ -22,6 +24,31 @@ public class CapeManager {
capeLocation = null;
}
public static void write(byte[] texture) {
EagRuntime.setStorage("cape", texture);
}
public static byte[] read(){
if(EagRuntime.getStorage("cape") != null){
return EagRuntime.getStorage("cape");
}
return null;
}
public static void forceLoad(byte[] texture){
try{
ImageData loadedCape = ImageData.loadImageFile(texture);
if(loadedCape != null){
CapeManager.capeLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcape", new DynamicTexture(loadedCape));
Minecraft.getMinecraft().displayGuiScreen(null);
//Minecraft.getMinecraft().getTextureManager().bindTexture(CapeManager.capeLocation);
}
}catch(Exception e){
System.out.println(e);
}
}
public static boolean shouldRender(AbstractClientPlayer player){
if(player == Minecraft.getMinecraft().thePlayer){
return true;

View File

@ -32,6 +32,9 @@ public class CapeUi extends GuiScreen {
if (result != null) {
ImageData loadedCape = ImageData.loadImageFile(result.fileData);
if(loadedCape != null){
for(int i = 0; 1 > i; i++){
CapeManager.write(result.fileData);
}
CapeManager.capeLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("uploadedcape", new DynamicTexture(loadedCape));
Minecraft.getMinecraft().displayGuiScreen(null);
//Minecraft.getMinecraft().getTextureManager().bindTexture(CapeManager.capeLocation);

View File

@ -39,6 +39,8 @@ public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
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);
if(CapeManager.capeLocation == null){
if(CapeManager.read() != null)
CapeManager.forceLoad(CapeManager.read());
this.playerRenderer.bindTexture(new ResourceLocation("eagler:gui/unnamed.png"));
}else {
this.playerRenderer.bindTexture(CapeManager.capeLocation);