From cd44999f7ced71f37b22ae67b6a07de2a17a223b Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Wed, 28 Jun 2023 18:08:46 +0600 Subject: [PATCH] Cosmetics --- .../java/net/silentclient/client/Client.java | 2 + .../client/admin/AdminRender.java | 52 ++--- .../cosmetics/AbstractShieldRenderer.java | 14 +- .../client/cosmetics/BandanaRenderer.java | 14 +- .../client/cosmetics/CapeRenderer.java | 26 +-- .../client/cosmetics/Cosmetics.java | 41 ++-- .../client/cosmetics/HatRenderer.java | 8 +- .../cosmetics/StaticResourceLocation.java | 20 ++ .../client/cosmetics/gui/CosmeticsGui.java | 2 +- .../client/cosmetics/wings/WingsModel.java | 20 +- .../gui/friends/FriendsListOverlay.java | 6 +- .../mixin/accessors/ModelBaseAccessor.java | 7 +- .../RendererLivingEntityAccessor.java | 13 -- .../mixin/ducks/AbstractClientPlayerExt.java | 38 ++++ .../mixins/AbstractClientPlayerMixin.java | 194 ++++++++++++++++- .../mixin/mixins/RenderPlayerMixin.java | 23 +- .../utils/CustomAbstractClientPlayer.java | 199 ------------------ .../silentclient/client/utils/Players.java | 60 +++--- .../client/utils/types/FriendsResponse.java | 5 +- .../client/utils/types/PlayerResponse.java | 6 +- src/main/resources/mixins.SilentClient.json | 1 - 21 files changed, 386 insertions(+), 365 deletions(-) create mode 100644 src/main/java/net/silentclient/client/cosmetics/StaticResourceLocation.java delete mode 100644 src/main/java/net/silentclient/client/mixin/accessors/RendererLivingEntityAccessor.java create mode 100644 src/main/java/net/silentclient/client/mixin/ducks/AbstractClientPlayerExt.java delete mode 100644 src/main/java/net/silentclient/client/utils/CustomAbstractClientPlayer.java diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 507d5dc..b082f2c 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -244,6 +244,8 @@ public class Client { public void shutdown() { logger.info("---------[ Silent Client Stopping ]--------------"); + logger.info("STOPPING > silent-socket"); + silentSocket.Disconnect(); logger.info("-------------------------------------------------"); } diff --git a/src/main/java/net/silentclient/client/admin/AdminRender.java b/src/main/java/net/silentclient/client/admin/AdminRender.java index 3f2d2ab..04eb1e4 100644 --- a/src/main/java/net/silentclient/client/admin/AdminRender.java +++ b/src/main/java/net/silentclient/client/admin/AdminRender.java @@ -6,7 +6,9 @@ import java.io.IOException; import java.net.URI; import java.text.DecimalFormat; -import net.silentclient.client.utils.CustomAbstractClientPlayer; +import net.minecraft.client.Minecraft; +import net.silentclient.client.cosmetics.StaticResourceLocation; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import org.lwjgl.Sys; import org.lwjgl.input.Mouse; @@ -70,16 +72,16 @@ public class AdminRender extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); super.drawDefaultBackground(); - CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).setCapeShoulders(true); - CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).setCapeType("Rectangle"); - if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationSilentCape() != null) { - CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationSilentCape().setCurrentFrame(this.currentFrame); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(true); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType("Rectangle"); + if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getCape() != null) { + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getCape().setCurrentFrame(this.currentFrame); } - if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getBandana() != null) { - CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getBandana().setCurrentFrame(this.currentFrame); + if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getBandana() != null) { + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getBandana().setCurrentFrame(this.currentFrame); } - if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield() != null && CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield().getTexture() != null) { - CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield().getTexture().setCurrentFrame(this.currentFrame); + if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield() != null && ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield().getTexture() != null) { + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getShield().getTexture().setCurrentFrame(this.currentFrame); } CustomFontRenderer font = new CustomFontRenderer(); @@ -208,7 +210,7 @@ public class AdminRender extends GuiScreen { twoColumn = false; - if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationOfWings() == null) { + if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getWings() == null) { settingY += 20; font.drawString("Frames: " + this.frames, 2, settingY, -1, true); settingY += 10; @@ -365,7 +367,7 @@ public class AdminRender extends GuiScreen { loadTextureCosmetic("shield", "hexagon_shield"); } twoColumn = false; - if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationOfWings() == null) { + if(((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getWings() == null) { settingY += 45; if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) { this.currentFrame = (this.currentFrame - 1 >= 0 ? this.currentFrame - 1 : this.frames - 1); @@ -397,34 +399,34 @@ public class AdminRender extends GuiScreen { } private void loadTextureCosmetic(String type, String model) { - CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationSilentCape(null); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setShoulders(null); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setBandana(null); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setHat(null); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setShield(null); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationOfWings(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setCapeShoulders(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setHat(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(null); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(null); this.frames = 0; this.currentFrame = 0; switch(type) { case "cape": - CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationSilentCape(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150)); - CustomAbstractClientPlayer.players.get(mc.thePlayer).setShoulders(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png"))); - this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getLocationSilentCape().getFrames(); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setCape(new TestAnimatedResourceLocation(adminRenderPath.listFiles().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": - CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationOfWings(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png"))); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setWings(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150)); this.frames = 1; this.currentFrame = 0; break; case "bandana": - CustomAbstractClientPlayer.players.get(mc.thePlayer).setBandana(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150)); - this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getBandana().getFrames(); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setBandana(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150)); + this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getBandana().getFrames(); this.currentFrame = 0; break; case "shield": - CustomAbstractClientPlayer.players.get(mc.thePlayer).setShield(new ShieldData(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150), model)); - this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getShield().getTexture().getFrames(); + ((AbstractClientPlayerExt) mc.thePlayer).silent$setShield(new ShieldData(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150), model)); + this.frames = ((AbstractClientPlayerExt) mc.thePlayer).silent$getShield().getTexture().getFrames(); this.currentFrame = 0; break; } diff --git a/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java b/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java index 28f0c8a..23beeed 100644 --- a/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java +++ b/src/main/java/net/silentclient/client/cosmetics/AbstractShieldRenderer.java @@ -7,8 +7,8 @@ import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.silentclient.client.Client; import net.silentclient.client.blc.BlcGlStateManager; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import net.silentclient.client.mods.settings.CosmeticsMod; -import net.silentclient.client.utils.CustomAbstractClientPlayer; public class AbstractShieldRenderer extends ModelBase implements LayerRenderer { private final RenderPlayer playerRenderer; @@ -21,7 +21,7 @@ public class AbstractShieldRenderer extends ModelBase implements LayerRenderer { private final RenderPlayer playerRenderer; @@ -37,7 +37,7 @@ public class BandanaRenderer extends ModelBase implements LayerRenderer capes = new HashMap<>(); - public Map capesShoulders = new HashMap<>(); - public Map wings = new HashMap<>(); + public Map capesShoulders = new HashMap<>(); + public Map wings = new HashMap<>(); public Map bandanas = new HashMap<>(); public Map hats = new HashMap<>(); public Map shields = new HashMap<>(); - public Map icons = new HashMap<>(); + public Map icons = new HashMap<>(); public ArrayList myIcons = new ArrayList(); public ArrayList myWings = new ArrayList(); @@ -41,9 +41,8 @@ public class Cosmetics { public ArrayList myHats = new ArrayList(); public ArrayList myShields = new ArrayList(); - public ArrayList bindTextures = new ArrayList(); - - public ResourceLocation defaultIcon; + + public StaticResourceLocation defaultIcon; private ModelBuffer bandana; public Map hatModels = new HashMap<>(); @@ -62,7 +61,7 @@ public class Cosmetics { e.printStackTrace(); } Client.logger.info("STARTING > cosmeitcs > default_icon"); - defaultIcon = new ResourceLocation("silentclient/icons/player_icon.png"); + defaultIcon = new StaticResourceLocation("silentclient/icons/player_icon.png"); if(!Client.getInstance().isDebug()) { CosmeticsResponse allCosmetics = getAllCosmetics(); Client.logger.info("STARTING > cosmeitcs > capes"); @@ -72,7 +71,7 @@ public class Cosmetics { if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getCapes() != null) { allCosmetics.getCosmetics().getCapes().forEach((cape) -> { capes.put(cape.getId(), new AnimatedResourceLocation("silentclient/cosmetics/capes/"+cape.getId(), cape.getFrames(), cape.getFrameDelay(), false, cape.getId() == Client.getInstance().getAccount().getSelectedCape())); - capesShoulders.put(cape.getId(), new ResourceLocation("silentclient/cosmetics/capes/"+cape.getId()+"/shoulders.png")); + capesShoulders.put(cape.getId(), new StaticResourceLocation("silentclient/cosmetics/capes/"+cape.getId()+"/shoulders.png")); }); } @@ -80,7 +79,7 @@ public class Cosmetics { wings.clear(); if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getWings() != null) { allCosmetics.getCosmetics().getWings().forEach((wing) -> { - wings.put(wing.getId(), new ResourceLocation("silentclient/cosmetics/wings/"+ wing.getId() + "/0.png")); + wings.put(wing.getId(), new AnimatedResourceLocation("silentclient/cosmetics/wings/"+ wing.getId(), wing.getFrames(), wing.getFrameDelay())); }); } @@ -133,7 +132,7 @@ public class Cosmetics { icons.clear(); if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getIcons() != null) { allCosmetics.getCosmetics().getIcons().forEach((icon) -> { - icons.put(icon.getId(), new ResourceLocation("silentclient/cosmetics/icons/"+ icon.getId() + "/0.png")); + icons.put(icon.getId(), new StaticResourceLocation("silentclient/cosmetics/icons/"+ icon.getId() + "/0.png")); }); } } @@ -163,8 +162,8 @@ public class Cosmetics { Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders()); Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle"); if(Minecraft.getMinecraft().thePlayer != null) { - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeType(cosmetics.getAccount().getCapeType()); - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeShoulders(cosmetics.getAccount().getCapeShoulders()); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType()); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(cosmetics.getAccount().getCapeShoulders()); } } } else { @@ -184,8 +183,8 @@ public class Cosmetics { Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders()); Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle"); if(Minecraft.getMinecraft().thePlayer != null) { - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeType(cosmetics.getAccount().getCapeType()); - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeShoulders(cosmetics.getAccount().getCapeShoulders()); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(cosmetics.getAccount().getCapeType()); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(cosmetics.getAccount().getCapeShoulders()); } } } @@ -279,7 +278,7 @@ public class Cosmetics { } } - public ResourceLocation getWingsById(int id) { + public AnimatedResourceLocation getWingsById(int id) { return wings.get(id); } @@ -299,16 +298,16 @@ public class Cosmetics { return shields.get(id); } - public ResourceLocation getCapeShoulders(int id) { + public StaticResourceLocation getCapeShoulders(int id) { return capesShoulders.get(id); } - public ResourceLocation getIconById(int id) { - ResourceLocation icon = icons.get(id); + public StaticResourceLocation getIconById(int id) { + StaticResourceLocation icon = icons.get(id); return icon != null ? icon : getDefaultIcon(); } - public ResourceLocation getDefaultIcon() { + public StaticResourceLocation getDefaultIcon() { return defaultIcon; } @@ -333,6 +332,6 @@ public class Cosmetics { Minecraft.getMinecraft().refreshResources(); Client.getInstance().getCosmetics().update(true); Players.reload(); - Players.getPlayerStatus(false, CustomAbstractClientPlayer.players.get(player).getNameClear(), EntityPlayer.getUUID(player.getGameProfile()), player); + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) player).silent$getNameClear(), EntityPlayer.getUUID(player.getGameProfile()), player); } } diff --git a/src/main/java/net/silentclient/client/cosmetics/HatRenderer.java b/src/main/java/net/silentclient/client/cosmetics/HatRenderer.java index 306fa8f..1690101 100644 --- a/src/main/java/net/silentclient/client/cosmetics/HatRenderer.java +++ b/src/main/java/net/silentclient/client/cosmetics/HatRenderer.java @@ -11,7 +11,7 @@ import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; import net.silentclient.client.mixin.accessors.MinecraftAccessor; -import net.silentclient.client.utils.CustomAbstractClientPlayer; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; @@ -48,13 +48,13 @@ public class HatRenderer extends ModelBase implements LayerRenderer { private static ModelRenderer wing; @@ -23,10 +21,7 @@ public class WingsModel implements LayerRenderer { public WingsModel(RenderPlayer player) { this.flying = false; - ((ModelBaseAccessor) (this.modelDragonWings = new ModelDragonWings(player))).setTextureOffset("wingTip.bone", 112, 136); - ((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wing.skin", -56, 88); - ((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wing.bone", 112, 88); - ((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wingTip.skin", -56, 144); + this.modelDragonWings = new ModelDragonWings(player); final int bw = this.modelDragonWings.textureWidth; final int bh = this.modelDragonWings.textureHeight; this.modelDragonWings.textureWidth = 256; @@ -46,7 +41,10 @@ public class WingsModel implements LayerRenderer { private class ModelDragonWings extends ModelBase { public ModelDragonWings(RenderPlayer player) { - // TODO Auto-generated constructor stub + this.setTextureOffset("wingTip.bone", 112, 136); + this.setTextureOffset("wing.skin", -56, 88); + this.setTextureOffset("wing.bone", 112, 88); + this.setTextureOffset("wingTip.skin", -56, 144); } @Override @@ -63,7 +61,7 @@ public class WingsModel implements LayerRenderer { else { f1 = ageInTicks / 80.0f; } - Minecraft.getMinecraft().getTextureManager().bindTexture(CustomAbstractClientPlayer.players.get(entityIn).getLocationOfWings()); + ((AbstractClientPlayerExt) entityIn).silent$getWings().bindTexture(); if (!entityIn.onGround || flying) { flying = true; } @@ -104,7 +102,7 @@ public class WingsModel implements LayerRenderer { @Override public void doRenderLayer(final AbstractClientPlayer player, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float HeadYaw, final float headPitch, final float scale) { - if (CustomAbstractClientPlayer.players.get(player).getLocationOfWings() != null && Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean()) { + if (((AbstractClientPlayerExt) player).silent$getWings() != null && Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean()) { if (!player.isInvisible()) { GlStateManager.pushMatrix(); this.modelDragonWings.render(player, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, scale); diff --git a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java index 8aaafc1..f0cf9a6 100644 --- a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java +++ b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java @@ -58,7 +58,7 @@ public class FriendsListOverlay extends GuiScreen { GlStateManager.translate(this.introAnimation.getValue(), 0, 0); this.introAnimation.setAnimation(0, 30); RenderUtils.drawRect(0, 0, width, height, Theme.backgroundColor().getRGB()); - RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()) : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), 3, 5, 18, 18, false); + RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()).getLocation() : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), 3, 5, 18, 18, false); ColorUtils.setColor(new Color(9, 165, 51).getRGB()); font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 2, 12, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); @@ -74,7 +74,7 @@ public class FriendsListOverlay extends GuiScreen { GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s); if(!showRequests) { for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) { - RenderUtil.drawImage(friend.getIcon(), 3, friendY, 18, 18, false); + RenderUtil.drawImage(friend.getIcon().getLocation(), 3, friendY, 18, 18, false); if(friend.isOnline()) { ColorUtils.setColor(new Color(9, 165, 51).getRGB()); } else { @@ -88,7 +88,7 @@ public class FriendsListOverlay extends GuiScreen { } } else { for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) { - RenderUtil.drawImage(request.getIcon(), 3, friendY, 18, 18, false); + RenderUtil.drawImage(request.getIcon().getLocation(), 3, friendY, 18, 18, false); ColorUtils.setColor(new Color(255, 255, 255).getRGB()); font.drawString(request.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); diff --git a/src/main/java/net/silentclient/client/mixin/accessors/ModelBaseAccessor.java b/src/main/java/net/silentclient/client/mixin/accessors/ModelBaseAccessor.java index a98a44a..75320b8 100644 --- a/src/main/java/net/silentclient/client/mixin/accessors/ModelBaseAccessor.java +++ b/src/main/java/net/silentclient/client/mixin/accessors/ModelBaseAccessor.java @@ -1,12 +1,15 @@ package net.silentclient.client.mixin.accessors; import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.TextureOffset; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; +import java.util.Map; + @Mixin(ModelBase.class) public interface ModelBaseAccessor { - @Invoker("setTextureOffset") - void setTextureOffset(String partName, int x, int y); + @Accessor + Map getModelTextureMap(); } diff --git a/src/main/java/net/silentclient/client/mixin/accessors/RendererLivingEntityAccessor.java b/src/main/java/net/silentclient/client/mixin/accessors/RendererLivingEntityAccessor.java deleted file mode 100644 index 2361a72..0000000 --- a/src/main/java/net/silentclient/client/mixin/accessors/RendererLivingEntityAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.silentclient.client.mixin.accessors; - -import net.minecraft.client.renderer.entity.RendererLivingEntity; -import net.minecraft.client.renderer.entity.layers.LayerRenderer; -import net.minecraft.entity.EntityLivingBase; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(RendererLivingEntity.class) -public interface RendererLivingEntityAccessor { -// @Invoker("addLayer") -// > boolean silent$addLayer(U layer); -} diff --git a/src/main/java/net/silentclient/client/mixin/ducks/AbstractClientPlayerExt.java b/src/main/java/net/silentclient/client/mixin/ducks/AbstractClientPlayerExt.java new file mode 100644 index 0000000..7391d5c --- /dev/null +++ b/src/main/java/net/silentclient/client/mixin/ducks/AbstractClientPlayerExt.java @@ -0,0 +1,38 @@ +package net.silentclient.client.mixin.ducks; + +import net.minecraft.util.ResourceLocation; +import net.silentclient.client.cosmetics.*; +import net.silentclient.client.cosmetics.dynamiccurved.DynamicCape; +import net.silentclient.client.utils.types.PlayerResponse; + +public interface AbstractClientPlayerExt { + void silent$setShield(ShieldData a); + ShieldData silent$getShield(); + void silent$setNeck(HatData a); + HatData silent$getNeck(); + void silent$setHat(HatData a); + HatData silent$getHat(); + void silent$setMask(HatData a); + HatData silent$getMask(); + void silent$setAccount(PlayerResponse.Account a); + PlayerResponse.Account silent$getAccount(); + void silent$setCapeType(String a); + String silent$getCapeType(); + void silent$setShoulders(boolean a); + boolean silent$getShoulders(); + void silent$setCapeShoulders(StaticResourceLocation a); + StaticResourceLocation silent$getCapeShoulders(); + void silent$setBandana(AnimatedResourceLocation a); + AnimatedResourceLocation silent$getBandana(); + StaticCape silent$getCurvedCape(); + StaticCape silent$getStaticCape(); + DynamicCape silent$getDynamicCape(); + void silent$setPlayerIcon(StaticResourceLocation a); + StaticResourceLocation silent$getPlayerIcon(); + void silent$setWings(AnimatedResourceLocation a); + AnimatedResourceLocation silent$getWings(); + void silent$setCape(AnimatedResourceLocation a); + AnimatedResourceLocation silent$getCape(); + String silent$getNameClear(); + void silent$setNameClear(String a); +} diff --git a/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java index 3fe2f5e..3847092 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java @@ -2,21 +2,197 @@ package net.silentclient.client.mixin.mixins; import com.mojang.authlib.GameProfile; import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; import net.minecraft.world.World; -import net.silentclient.client.Client; -import net.silentclient.client.utils.CustomAbstractClientPlayer; +import net.silentclient.client.cosmetics.*; +import net.silentclient.client.cosmetics.dynamiccurved.DynamicCape; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; +import net.silentclient.client.utils.Players; +import net.silentclient.client.utils.types.PlayerResponse; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(AbstractClientPlayer.class) -public abstract class AbstractClientPlayerMixin { +@Mixin(value = AbstractClientPlayer.class, priority = 2000) +public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerExt { + @Unique private AnimatedResourceLocation silent$cape; + @Unique private AnimatedResourceLocation silent$bandana; + @Unique private HatData silent$hat; + @Unique private HatData silent$mask; + @Unique private HatData silent$neck; + @Unique private AnimatedResourceLocation silent$wings; + @Unique private StaticResourceLocation silent$playerIcon; + @Unique private StaticResourceLocation silent$shoulders; + @Unique private String silent$nameClear; + @Unique private DynamicCape silent$dynamicCape; + @Unique private StaticCape silent$staticCape; + @Unique private StaticCape silent$curvedCape; + @Unique private ShieldData silent$shield; + @Unique private PlayerResponse.Account silent$account; + @Unique private String silent$capeType = "dynamic_curved"; + @Unique private boolean silent$shouldersBool = true; + @Inject(method = "", at = @At("RETURN")) - public void initTest(World worldIn, GameProfile playerProfile, CallbackInfo ci) { - CustomAbstractClientPlayer.players.put(((AbstractClientPlayer) (Object) this), new CustomAbstractClientPlayer(worldIn, playerProfile)); + public void initCustom(World worldIn, GameProfile playerProfile, CallbackInfo ci) { + this.silent$nameClear = playerProfile.getName(); + + if (this.silent$nameClear != null && !this.silent$nameClear.isEmpty()) + { + this.silent$nameClear = StringUtils.stripControlCodes(this.silent$nameClear); + } + + this.silent$dynamicCape = new DynamicCape(); + this.silent$staticCape = new StaticCape(1.0F, 0.0F, 0.0F); + this.silent$curvedCape = new StaticCape(6.0F, 5.0F, 0.0F); + + Players.getPlayerStatus(false, silent$nameClear, playerProfile.getId(), ((AbstractClientPlayer) (Object) this)); + } + + @Override + public String silent$getCapeType() { + return silent$capeType; + } + + @Override + public void silent$setCapeType(String a) { + this.silent$capeType = a; + } + + @Override + public boolean silent$getShoulders() { + return silent$shouldersBool; + } + + @Override + public void silent$setShoulders(boolean a) { + this.silent$shouldersBool = a; + } + + @Override + public PlayerResponse.Account silent$getAccount() { + return silent$account; + } + + @Override + public void silent$setAccount(PlayerResponse.Account a) { + this.silent$account = a; + } + + @Override + public AnimatedResourceLocation silent$getBandana() { + return silent$bandana; + } + + @Override + public void silent$setBandana(AnimatedResourceLocation a) { + this.silent$bandana = a; + } + + @Override + public AnimatedResourceLocation silent$getCape() { + return silent$cape; + } + + @Override + public void silent$setCape(AnimatedResourceLocation a) { + this.silent$cape = a; + } + + @Override + public DynamicCape silent$getDynamicCape() { + return silent$dynamicCape; + } + + @Override + public StaticCape silent$getCurvedCape() { + return silent$curvedCape; + } + + @Override + public StaticCape silent$getStaticCape() { + return silent$staticCape; + } + + @Override + public HatData silent$getHat() { + return silent$hat; + } + + @Override + public void silent$setHat(HatData a) { + this.silent$hat = a; + } + + @Override + public HatData silent$getMask() { + return silent$mask; + } + + @Override + public void silent$setMask(HatData a) { + this.silent$mask = a; + } + + @Override + public HatData silent$getNeck() { + return silent$neck; + } + + @Override + public void silent$setNeck(HatData a) { + this.silent$neck = a; + } + + @Override + public ShieldData silent$getShield() { + return silent$shield; + } + + @Override + public void silent$setShield(ShieldData a) { + this.silent$shield = a; + } + + @Override + public AnimatedResourceLocation silent$getWings() { + return silent$wings; + } + + @Override + public void silent$setWings(AnimatedResourceLocation a) { + this.silent$wings = a; + } + + @Override + public String silent$getNameClear() { + return silent$nameClear; + } + + @Override + public void silent$setNameClear(String a) { + this.silent$nameClear = a; + } + + @Override + public StaticResourceLocation silent$getCapeShoulders() { + return silent$shoulders; + } + + @Override + public void silent$setCapeShoulders(StaticResourceLocation a) { + this.silent$shoulders = a; + } + + @Override + public StaticResourceLocation silent$getPlayerIcon() { + return silent$playerIcon; + } + + @Override + public void silent$setPlayerIcon(StaticResourceLocation a) { + this.silent$playerIcon = a; } } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/RenderPlayerMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/RenderPlayerMixin.java index ee582d9..49c684e 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/RenderPlayerMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/RenderPlayerMixin.java @@ -5,29 +5,30 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.entity.RendererLivingEntity; -import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.silentclient.client.cosmetics.AbstractShieldRenderer; import net.silentclient.client.cosmetics.BandanaRenderer; import net.silentclient.client.cosmetics.CapeRenderer; import net.silentclient.client.cosmetics.HatRenderer; import net.silentclient.client.cosmetics.wings.WingsModel; -import net.silentclient.client.mixin.accessors.RendererLivingEntityAccessor; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(RenderPlayer.class) -public class RenderPlayerMixin { +public abstract class RenderPlayerMixin extends RendererLivingEntity { + public RenderPlayerMixin(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + @Inject(method = "(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V", at = @At("RETURN")) public void initComsetics(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) { -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new WingsModel(((RenderPlayer) (Object) this))); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new CapeRenderer(((RenderPlayer) (Object) this))); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new BandanaRenderer(((RenderPlayer) (Object) this))); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new HatRenderer(((RenderPlayer) (Object) this), "hat")); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new HatRenderer(((RenderPlayer) (Object) this), "neck")); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new HatRenderer(((RenderPlayer) (Object) this), "mask")); -// ((RendererLivingEntityAccessor) (Object) this).silent$addLayer(new AbstractShieldRenderer(((RenderPlayer) (Object) this))); + addLayer(new WingsModel(((RenderPlayer) (Object) this))); + addLayer(new CapeRenderer(((RenderPlayer) (Object) this))); + addLayer(new BandanaRenderer(((RenderPlayer) (Object) this))); + addLayer(new HatRenderer(((RenderPlayer) (Object) this), "hat")); + addLayer(new HatRenderer(((RenderPlayer) (Object) this), "neck")); + addLayer(new HatRenderer(((RenderPlayer) (Object) this), "mask")); + addLayer(new AbstractShieldRenderer(((RenderPlayer) (Object) this))); } } diff --git a/src/main/java/net/silentclient/client/utils/CustomAbstractClientPlayer.java b/src/main/java/net/silentclient/client/utils/CustomAbstractClientPlayer.java deleted file mode 100644 index 0dc4923..0000000 --- a/src/main/java/net/silentclient/client/utils/CustomAbstractClientPlayer.java +++ /dev/null @@ -1,199 +0,0 @@ -package net.silentclient.client.utils; - -import com.mojang.authlib.GameProfile; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StringUtils; -import net.minecraft.world.World; -import net.silentclient.client.cosmetics.AnimatedResourceLocation; -import net.silentclient.client.cosmetics.HatData; -import net.silentclient.client.cosmetics.ShieldData; -import net.silentclient.client.cosmetics.StaticCape; -import net.silentclient.client.cosmetics.dynamiccurved.DynamicCape; -import net.silentclient.client.utils.types.PlayerResponse; - -import java.util.HashMap; -import java.util.Map; - -public class CustomAbstractClientPlayer { - public static final Map players = new HashMap<>(); - - private AnimatedResourceLocation locationSilentCape = null; - private AnimatedResourceLocation bandana = null; - private HatData hat = null; - private HatData mask = null; - private HatData neck = null; - private ResourceLocation locationCustomCape = null; - private ResourceLocation locationOfWings = null; - private ResourceLocation playerIcon = null; - private ResourceLocation shoulders = null; - private boolean isSilentPlayer = false; - private String nameClear = null; - private DynamicCape dynamicCape; - private StaticCape staticCape; - private StaticCape curvedCape; - - private String capeType = "dynamic_curved"; - private boolean capeShoulders = true; - private boolean isSilentStaff = false; - - private ShieldData shield = null; - - private PlayerResponse.Account silentAccount; - - public CustomAbstractClientPlayer(World worldIn, GameProfile playerProfile) { - this.nameClear = playerProfile.getName(); - - if (this.nameClear != null && !this.nameClear.isEmpty()) - { - this.nameClear = StringUtils.stripControlCodes(this.nameClear); - } - - this.dynamicCape = new DynamicCape(); - this.staticCape = new StaticCape(1.0F, 0.0F, 0.0F); - this.curvedCape = new StaticCape(6.0F, 5.0F, 0.0F); - } - - public void setShield(ShieldData shield) { - this.shield = shield; - } - - public HatData getNeck() { - return neck; - } - - public void setNeck(HatData neck) { - this.neck = neck; - } - - public HatData getMask() { - return mask; - } - - public String getNameClear() { - return nameClear; - } - - public void setMask(HatData mask) { - this.mask = mask; - } - - public ShieldData getShield() { - return shield; - } - - public PlayerResponse.Account getSilentAccount() { - return silentAccount; - } - - public void setSilentAccount(PlayerResponse.Account silentAccount) { - this.silentAccount = silentAccount; - } - - public HatData getHat() { - return hat; - } - - public void setHat(HatData hat) { - this.hat = hat; - } - - public String getCapeType() { - return capeType; - } - - public void setCapeType(String capeType) { - this.capeType = capeType; - } - - public boolean capeShoulders() { - return capeShoulders; - } - - public void setCapeShoulders(boolean capeShoulders) { - this.capeShoulders = capeShoulders; - } - - public AnimatedResourceLocation getBandana() { - return bandana; - } - - public void setSilentStaff(boolean silentStaff) { - isSilentStaff = silentStaff; - } - - public boolean isSilentStaff() { - return isSilentStaff; - } - - public void setBandana(AnimatedResourceLocation bandana) { - this.bandana = bandana; - } - - public StaticCape getCurvedCape() { - return curvedCape; - } - - public StaticCape getStaticCape() { - return staticCape; - } - - public DynamicCape getDynamicCape() { - return dynamicCape; - } - - public void setSilentPlayer(boolean isSilent) { - this.isSilentPlayer = isSilent; - } - - public void setLocationCustomCape(ResourceLocation locationCustomCape) { - this.locationCustomCape = locationCustomCape; - } - - public ResourceLocation getLocationCustomCape() { -// if(!Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean()) { -// return null; -// } - return locationCustomCape; - } - - public boolean isSilentPlayer() { - return isSilentPlayer; - } - - public void setPlayerIcon(ResourceLocation playerIcon) { - this.playerIcon = playerIcon; - } - - public ResourceLocation getPlayerIcon() { - return playerIcon; - } - - public void setLocationOfWings(ResourceLocation locationOfWings) { - this.locationOfWings = locationOfWings; - } - - public ResourceLocation getLocationOfWings() { - return locationOfWings; - } - - public AnimatedResourceLocation getLocationSilentCape() { -// if(!Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean()) { -// return null; -// } - - return locationSilentCape; - } - - public void setLocationSilentCape(AnimatedResourceLocation locationSilentCape) { - this.locationSilentCape = locationSilentCape; - } - - public void setShoulders(ResourceLocation shoulders) { - this.shoulders = shoulders; - } - - public ResourceLocation getShoulders() { - return shoulders; - } -} diff --git a/src/main/java/net/silentclient/client/utils/Players.java b/src/main/java/net/silentclient/client/utils/Players.java index eb8ce14..83906a2 100644 --- a/src/main/java/net/silentclient/client/utils/Players.java +++ b/src/main/java/net/silentclient/client/utils/Players.java @@ -7,6 +7,7 @@ import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.entity.player.EntityPlayer; import net.silentclient.client.Client; import net.silentclient.client.cosmetics.HatData; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import net.silentclient.client.mods.settings.CosmeticsMod; import net.silentclient.client.utils.types.PlayerResponse; @@ -28,8 +29,8 @@ public class Players { } public static String getPlayerStatus(boolean isMainPlayer, String name, UUID id, AbstractClientPlayer playerRow) { - CustomAbstractClientPlayer player = CustomAbstractClientPlayer.players.get(playerRow); - if(player.getNameClear().toLowerCase().equals(Client.getInstance().getAccount().getUsername()) && !playersCache.containsKey(name.toLowerCase())) { + AbstractClientPlayerExt player = (AbstractClientPlayerExt) playerRow; + if(player.silent$getNameClear().toLowerCase().equals(Client.getInstance().getAccount().getUsername()) && !playersCache.containsKey(name.toLowerCase())) { playersCache.put(name.toLowerCase(), Client.getInstance().getAccount()); } if(playersCache.containsKey(name.toLowerCase())) { @@ -39,68 +40,61 @@ public class Players { } if(result.getSelectedCape() != 0) { - player.setLocationSilentCape(Client.getInstance().getCosmetics().getCapeById(result.getSelectedCape())); - player.setShoulders(Client.getInstance().getCosmetics().getCapeShoulders(result.getSelectedCape())); + player.silent$setCape(Client.getInstance().getCosmetics().getCapeById(result.getSelectedCape())); + player.silent$setCapeShoulders(Client.getInstance().getCosmetics().getCapeShoulders(result.getSelectedCape())); } else { - player.setLocationSilentCape(null); - player.setShoulders(null); + player.silent$setCape(null); + player.silent$setCapeShoulders(null); } if(result.getSelectedWings() != 0) { - player.setLocationOfWings(Client.getInstance().getCosmetics().getWingsById(result.getSelectedWings())); + player.silent$setWings(Client.getInstance().getCosmetics().getWingsById(result.getSelectedWings())); } else { - player.setLocationOfWings(null); + player.silent$setWings(null); } if(result.getSelectedHat() != 0 && Client.getInstance().getCosmetics().getHatById(result.getSelectedHat()) != null) { - player.setHat(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedHat()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedHat()).getModel())); + player.silent$setHat(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedHat()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedHat()).getModel())); } else { - player.setHat(null); + player.silent$setHat(null); } if(result.getSelectedNeck() != 0 && Client.getInstance().getCosmetics().getHatById(result.getSelectedNeck()) != null) { - player.setNeck(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedNeck()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedNeck()).getModel())); + player.silent$setNeck(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedNeck()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedNeck()).getModel())); } else { - player.setNeck(null); + player.silent$setNeck(null); } if(result.getSelectedMask() != 0 && Client.getInstance().getCosmetics().getHatById(result.getSelectedMask()) != null) { - player.setMask(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedMask()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedMask()).getModel())); + player.silent$setMask(new HatData(Client.getInstance().getCosmetics().getHatById(result.getSelectedMask()).getTexture(), Client.getInstance().getCosmetics().getHatById(result.getSelectedMask()).getModel())); } else { - player.setMask(null); + player.silent$setMask(null); } if(result.getSelectedShield() != 0 && Client.getInstance().getCosmetics().getShieldById(result.getSelectedShield()) != null) { - player.setShield(Client.getInstance().getCosmetics().getShieldById(result.getSelectedShield())); + player.silent$setShield(Client.getInstance().getCosmetics().getShieldById(result.getSelectedShield())); } else { - player.setShield(null); + player.silent$setShield(null); } if(result.getSelectedIcon() != 0) { - player.setPlayerIcon(Client.getInstance().getCosmetics().getIconById(result.getSelectedIcon())); + player.silent$setPlayerIcon(Client.getInstance().getCosmetics().getIconById(result.getSelectedIcon())); } else { - player.setPlayerIcon(Client.getInstance().getCosmetics().getDefaultIcon()); + player.silent$setPlayerIcon(Client.getInstance().getCosmetics().getDefaultIcon()); } if(result.getSelectedBandana() != 0) { - player.setBandana(Client.getInstance().getCosmetics().getBandanaById(result.getSelectedBandana())); + player.silent$setBandana(Client.getInstance().getCosmetics().getBandanaById(result.getSelectedBandana())); } else { - player.setBandana(null); + player.silent$setBandana(null); } - player.setCapeShoulders(result.getCapeShoulders()); - player.setCapeType(result.getCapeType()); + player.silent$setShoulders(result.getCapeShoulders()); + player.silent$setCapeType(result.getCapeType()); - - if(result.isStaff() || result.isAdmin() || result.isTester()) { - player.setSilentStaff(true); - } else { - player.setSilentStaff(false); - } - - player.setSilentAccount(result); + player.silent$setAccount(result); return result.isOnline() ? "true" : "false"; } else { @@ -124,9 +118,9 @@ public class Players { Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(account.getCapeShoulders()); Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(account.getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : account.getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle"); if(Minecraft.getMinecraft().thePlayer != null) { - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeType(account.getCapeType()); - CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeShoulders(account.getCapeShoulders()); - Players.getPlayerStatus(false, CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setCapeType(account.getCapeType()); + ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$setShoulders(account.getCapeShoulders()); + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); } } if(playersCache.containsKey(account.getUsername())) { diff --git a/src/main/java/net/silentclient/client/utils/types/FriendsResponse.java b/src/main/java/net/silentclient/client/utils/types/FriendsResponse.java index 9ce3e68..35bc763 100644 --- a/src/main/java/net/silentclient/client/utils/types/FriendsResponse.java +++ b/src/main/java/net/silentclient/client/utils/types/FriendsResponse.java @@ -12,6 +12,7 @@ import javax.net.ssl.HttpsURLConnection; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; +import net.silentclient.client.cosmetics.StaticResourceLocation; import net.silentclient.client.utils.reply.AbstractReply; public class FriendsResponse extends AbstractReply { @@ -54,7 +55,7 @@ public class FriendsResponse extends AbstractReply { return username; } - public ResourceLocation getIcon() { + public StaticResourceLocation getIcon() { if(selected_icon == 0) { return Client.getInstance().getCosmetics().getDefaultIcon(); } @@ -115,7 +116,7 @@ public class FriendsResponse extends AbstractReply { return username; } - public ResourceLocation getIcon() { + public StaticResourceLocation getIcon() { if(selected_icon == 0) { return Client.getInstance().getCosmetics().getDefaultIcon(); } diff --git a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java index 67e3182..1d93ea2 100644 --- a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java +++ b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java @@ -17,7 +17,7 @@ import javax.net.ssl.HttpsURLConnection; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.silentclient.client.Client; -import net.silentclient.client.utils.CustomAbstractClientPlayer; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import net.silentclient.client.utils.Players; import net.silentclient.client.utils.reply.AbstractReply; @@ -117,7 +117,7 @@ public class PlayerResponse extends AbstractReply { this.plus_icon_color = plus_icon_color; Players.reload(); if(Minecraft.getMinecraft().thePlayer != null) { - Players.getPlayerStatus(false, CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); } } catch (IOException e) { e.printStackTrace(); @@ -331,7 +331,7 @@ public class PlayerResponse extends AbstractReply { this.cape_shoulders = shoulders ? 1 : 0; Players.reload(); if(Minecraft.getMinecraft().thePlayer != null) { - Players.getPlayerStatus(false, CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); } (new Thread("setShoulders") { public void run() { diff --git a/src/main/resources/mixins.SilentClient.json b/src/main/resources/mixins.SilentClient.json index 27dd06d..29e4db3 100644 --- a/src/main/resources/mixins.SilentClient.json +++ b/src/main/resources/mixins.SilentClient.json @@ -22,6 +22,5 @@ "mixins.EffectRendererMixin", "accessors.RenderManagerAccessor", "mixins.RenderPlayerMixin", - "accessors.RendererLivingEntityAccessor" ] } \ No newline at end of file