From 6d9f8ec011fc58fe42eadb16a3f46fe41fa500c2 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 14 Oct 2023 16:06:03 +0600 Subject: [PATCH] New Shield --- .../client/admin/AdminRender.java | 12 +- .../cosmetics/AbstractShieldRenderer.java | 3 +- .../silentclient/models/shield_v4.obj | 232 ++++++++++++++++++ 3 files changed, 242 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/assets/minecraft/silentclient/models/shield_v4.obj diff --git a/src/main/java/net/silentclient/client/admin/AdminRender.java b/src/main/java/net/silentclient/client/admin/AdminRender.java index 5a2d0d5..bc064d5 100644 --- a/src/main/java/net/silentclient/client/admin/AdminRender.java +++ b/src/main/java/net/silentclient/client/admin/AdminRender.java @@ -406,25 +406,28 @@ public class AdminRender extends GuiScreen { ((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(null); this.frames = 0; this.currentFrame = 0; + + File [] pngFiles = adminRenderPath.listFiles(file -> file.isFile() && file.getName().toLowerCase().endsWith(".png")); + switch(type) { case "cape": - ((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150)); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(new TestAnimatedResourceLocation(pngFiles.length - 1, 150)); ((AbstractClientPlayerExt) mc.thePlayer).silent$setCapeShoulders(new StaticResourceLocation(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png")).getResourcePath())); this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getCape().getFrames(); this.currentFrame = 0; break; case "wings": - ((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length, 150)); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(new TestAnimatedResourceLocation(pngFiles.length, 150)); this.frames = 1; this.currentFrame = 0; break; case "bandana": - ((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length, 150)); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(new TestAnimatedResourceLocation(pngFiles.length, 150)); this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getBandana().getFrames(); this.currentFrame = 0; break; case "shield": - ((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(new ShieldData(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length, 150), model)); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(new ShieldData(new TestAnimatedResourceLocation(pngFiles.length, 150), model)); this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getShield().getTexture().getFrames(); this.currentFrame = 0; break; @@ -438,6 +441,7 @@ public class AdminRender extends GuiScreen { textures = new ResourceLocation[frames]; for(int i = 0; i < frames; i++) { + Client.logger.info(new File(adminRenderPath, i + ".png").toString()); textures[i] = FileUtils.fileToResourceLocation(new File(adminRenderPath, i + ".png")); } } diff --git a/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java b/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java index 6d1e85c..6821cea 100644 --- a/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java +++ b/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java @@ -62,7 +62,7 @@ public class AbstractShieldRenderer extends ModelBase implements LayerRenderer