From 0cf5fd52c13d09baa977c20306050663b47754c5 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 14 Sep 2023 17:16:27 +0600 Subject: [PATCH 01/15] Update HUDConfigScreen.java --- .../java/net/silentclient/client/gui/hud/HUDConfigScreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java index d55a2a9..2604ca0 100644 --- a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java +++ b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java @@ -45,7 +45,7 @@ public class HUDConfigScreen extends GuiScreen { this.mod = null; ScaledResolution scaledresolution = new ScaledResolution(this.mc); - this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 10, scaledresolution.getScaledHeight() - 80, 30, 30, 22, 22, new ResourceLocation("silentclient/icons/back.png"))); + this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 15, scaledresolution.getScaledHeight() - 80, 30, 30, 22, 22, new ResourceLocation("silentclient/icons/back.png"))); this.font = new CustomFontRenderer(); font.setRenderMode(RenderMode.CUSTOM); From d4abfa6642b23243f62fe0f451722801416e4b09 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 14 Sep 2023 17:20:49 +0600 Subject: [PATCH 02/15] Better Icon --- .../java/net/silentclient/client/gui/hud/HUDConfigScreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java index 2604ca0..0e7a3d1 100644 --- a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java +++ b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java @@ -45,7 +45,7 @@ public class HUDConfigScreen extends GuiScreen { this.mod = null; ScaledResolution scaledresolution = new ScaledResolution(this.mc); - this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 15, scaledresolution.getScaledHeight() - 80, 30, 30, 22, 22, new ResourceLocation("silentclient/icons/back.png"))); + this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 15, scaledresolution.getScaledHeight() - 80, 30, 30, 18, 18, new ResourceLocation("silentclient/icons/back.png"))); this.font = new CustomFontRenderer(); font.setRenderMode(RenderMode.CUSTOM); From 0c7bd992eebaa08234dc9812b8606812f57a8746 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 14 Sep 2023 17:26:04 +0600 Subject: [PATCH 03/15] Clock & Pack Display Mod Text After Value Fix --- .../java/net/silentclient/client/mods/HudMod.java | 12 ++++++++---- .../net/silentclient/client/mods/hud/ClockMod.java | 10 +++++----- .../silentclient/client/mods/hud/PackDisplayMod.java | 11 +++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/silentclient/client/mods/HudMod.java b/src/main/java/net/silentclient/client/mods/HudMod.java index daaeed3..24d8cfc 100644 --- a/src/main/java/net/silentclient/client/mods/HudMod.java +++ b/src/main/java/net/silentclient/client/mods/HudMod.java @@ -1,10 +1,10 @@ package net.silentclient.client.mods; -import java.awt.Color; - import net.silentclient.client.Client; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.hud.ScreenPosition; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; + +import java.awt.*; public class HudMod extends ModDraggable { @@ -21,6 +21,11 @@ public class HudMod extends ModDraggable { @Override public void setup() { + setupWithAfterValue(); + this.addInputSetting("Text After Value", this, getDefautPostText(), true); + } + + public void setupWithAfterValue() { super.setup(); this.addBooleanSetting("Background", this, true); this.addColorSetting("Background Color", this, new Color(0, 0, 0), 127); @@ -28,7 +33,6 @@ public class HudMod extends ModDraggable { this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Brackets", this, false); this.addBooleanSetting("Fancy Font", this, false); - this.addInputSetting("Text After Value", this, getDefautPostText(), true); } public String getText() { diff --git a/src/main/java/net/silentclient/client/mods/hud/ClockMod.java b/src/main/java/net/silentclient/client/mods/hud/ClockMod.java index c4b269f..1eff01b 100644 --- a/src/main/java/net/silentclient/client/mods/hud/ClockMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/ClockMod.java @@ -1,13 +1,13 @@ package net.silentclient.client.mods.hud; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; - import net.silentclient.client.Client; import net.silentclient.client.mods.HudMod; import net.silentclient.client.mods.ModCategory; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; + public class ClockMod extends HudMod { public ClockMod() { super("Clock", ModCategory.MODS, "silentclient/icons/mods/clock.png", false); @@ -15,7 +15,7 @@ public class ClockMod extends HudMod { @Override public void setup() { - super.setup(); + super.setupWithAfterValue(); this.addBooleanSetting("24 Hour Format", this, false); } diff --git a/src/main/java/net/silentclient/client/mods/hud/PackDisplayMod.java b/src/main/java/net/silentclient/client/mods/hud/PackDisplayMod.java index 672e251..18580e7 100644 --- a/src/main/java/net/silentclient/client/mods/hud/PackDisplayMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/PackDisplayMod.java @@ -1,11 +1,6 @@ package net.silentclient.client.mods.hud; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.common.collect.Lists; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; @@ -18,6 +13,10 @@ import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.HudMod; import net.silentclient.client.mods.ModCategory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + public class PackDisplayMod extends HudMod { private ResourceLocation defaultIcon; @@ -28,7 +27,7 @@ public class PackDisplayMod extends HudMod { @Override public void setup() { - super.setup(); + super.setupWithAfterValue(); this.addBooleanSetting("Pack Icon", this, true); ArrayList options = new ArrayList<>(); From 318a7a5590199fdd8af8e908b10dca134564d1b3 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 15 Sep 2023 10:49:07 +0600 Subject: [PATCH 04/15] Armor Stand Nametag Renderer --- .../client/mixin/mixins/ArmorStandRendererMixin.java | 6 ------ .../client/mixin/mixins/RendererLivingEntityMixin.java | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/ArmorStandRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/ArmorStandRendererMixin.java index c5457d5..4d30e16 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/ArmorStandRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/ArmorStandRendererMixin.java @@ -1,17 +1,11 @@ package net.silentclient.client.mixin.mixins; import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.ArmorStandRenderer; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RendererLivingEntity; -import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.mods.render.NametagsMod; 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.CallbackInfoReturnable; diff --git a/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java index 2e5550e..3af2b00 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java @@ -85,7 +85,8 @@ public class RendererLivingEntityMixin { ci.cancel(); } } - if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean() && entity instanceof EntityArmorStand) { + if(entity instanceof EntityArmorStand && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean()) { + ((RendererLivingEntity) (Object) this).renderName((EntityArmorStand) entity, x, y, z); ci.cancel(); } } From 3e796da7d987de8dd0549eb26d3472f7d551c373 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 15 Sep 2023 11:58:51 +0600 Subject: [PATCH 05/15] Featured Servers --- .../java/net/silentclient/client/Client.java | 6 +-- .../gui/multiplayer/SilentMultiplayerGui.java | 51 ++++++++++--------- .../components/ServerComponent.java | 17 +++++-- .../client/utils/FeaturedServers.java | 25 +++++++-- .../utils/types/FeaturedServersResponse.java | 26 ---------- 5 files changed, 62 insertions(+), 63 deletions(-) delete mode 100644 src/main/java/net/silentclient/client/utils/types/FeaturedServersResponse.java diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 7e97f63..992c299 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -266,10 +266,10 @@ public class Client { } }); logger.info("STARTING > servers"); - FeaturedServersResponse servers = FeaturedServers.get(); + ArrayList servers = FeaturedServers.get(); featuredServers.clear(); - if(servers != null && servers.getServers() != null) { - servers.getServers().forEach(server -> { + if(servers != null && servers != null) { + servers.forEach(server -> { featuredServers.add(new ServerDataFeature(server.getName(), server.getIp())); }); } diff --git a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java index 2da2569..0e4265d 100644 --- a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java +++ b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java @@ -9,6 +9,7 @@ import net.minecraft.client.multiplayer.ServerList; import net.minecraft.client.network.OldServerPinger; import net.minecraft.client.renderer.GlStateManager; import net.silentclient.client.Client; +import net.silentclient.client.ServerDataFeature; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.elements.Button; @@ -64,13 +65,7 @@ public class SilentMultiplayerGui extends SilentScreen { this.savedServerList = new ServerList(this.mc); this.savedServerList.loadServerList(); - servers.clear(); - for (int i = 0; i < savedServerList.countServers(); ++i) - { - ServerData serverData = savedServerList.getServerData(i); - - servers.add(new ServerComponent(this, serverData)); - } + this.getServers(); } this.silentInputs.clear(); @@ -93,6 +88,19 @@ public class SilentMultiplayerGui extends SilentScreen { this.selectServer(-1); } + public void getServers() { + servers.clear(); + for(ServerDataFeature serverDataFeature : Client.getInstance().getFeaturedServers()) { + servers.add(new ServerComponent(this, serverDataFeature)); + } + for (int i = 0; i < savedServerList.countServers(); ++i) + { + ServerData serverData = savedServerList.getServerData(i); + + servers.add(new ServerComponent(this, serverData)); + } + } + public void selectServer(int index) { this.selectedServer = index; @@ -105,8 +113,10 @@ public class SilentMultiplayerGui extends SilentScreen { if(serverComponent != null) { this.btnSelectServer.enabled = true; - this.btnEditServer.enabled = true; - this.btnDeleteServer.enabled = true; + if(!(serverComponent.getServer() instanceof ServerDataFeature)) { + this.btnEditServer.enabled = true; + this.btnDeleteServer.enabled = true; + } } else { Client.logger.info("Server " + index + " not found!"); } @@ -174,16 +184,17 @@ public class SilentMultiplayerGui extends SilentScreen { public boolean canUpSwap(int index) { - return index > 0; + return index > Client.getInstance().getFeaturedServers().size(); } public boolean canDownSwap(int index) { - return index < this.savedServerList.countServers() - 1; + return (index - Client.getInstance().getFeaturedServers().size()) < this.savedServerList.countServers() - 1; } public void swapUp(int index, boolean fullSwap) { + index = index - (Client.getInstance().getFeaturedServers().size()); int i = fullSwap ? 0 : index - 1; this.savedServerList.swapServers(index, i); @@ -192,17 +203,12 @@ public class SilentMultiplayerGui extends SilentScreen { this.selectServer(i); } - servers.clear(); - for (int i1 = 0; i1 < savedServerList.countServers(); ++i1) - { - ServerData serverData = savedServerList.getServerData(i1); - - servers.add(new ServerComponent(this, serverData)); - } + getServers(); } public void swapDown(int index, boolean fullSwap) { + index = index - (Client.getInstance().getFeaturedServers().size()); int i = fullSwap ? this.savedServerList.countServers() - 1 : index + 1; this.savedServerList.swapServers(index, i); @@ -211,13 +217,7 @@ public class SilentMultiplayerGui extends SilentScreen { this.selectServer(i); } - servers.clear(); - for (int i1 = 0; i1 < savedServerList.countServers(); ++i1) - { - ServerData serverData = savedServerList.getServerData(i1); - - servers.add(new ServerComponent(this, serverData)); - } + getServers(); } @Override @@ -273,6 +273,7 @@ public class SilentMultiplayerGui extends SilentScreen { Client.logger.info("Saving server list..."); newServerList.saveServerList(); + getServers(); } @Override diff --git a/src/main/java/net/silentclient/client/gui/multiplayer/components/ServerComponent.java b/src/main/java/net/silentclient/client/gui/multiplayer/components/ServerComponent.java index 80c5c5a..cbd52ef 100644 --- a/src/main/java/net/silentclient/client/gui/multiplayer/components/ServerComponent.java +++ b/src/main/java/net/silentclient/client/gui/multiplayer/components/ServerComponent.java @@ -16,6 +16,7 @@ import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; +import net.silentclient.client.ServerDataFeature; import net.silentclient.client.gui.elements.Tooltip; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.multiplayer.SilentMultiplayerGui; @@ -54,6 +55,7 @@ public class ServerComponent { public MouseCursorHandler.CursorType draw(int serverIndex, int mouseX, int mouseY, float x, float y, boolean isSelected) { MouseCursorHandler.CursorType cursorType = null; + boolean featured = this.server instanceof ServerDataFeature; if (!this.server.field_78841_f) { this.server.field_78841_f = true; @@ -97,7 +99,7 @@ public class ServerComponent { RenderUtil.drawImage(this.field_148305_h != null ? serverIcon : UNKNOWN_SERVER, x + 2, y + 2, 31, 31, false); - if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31)) { + if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31) && !featured) { if(this.owner.canUpSwap(serverIndex)) { RenderUtil.drawImage(new ResourceLocation("silentclient/icons/page-up.png"), x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15, true, MouseUtils.isInside(mouseX, mouseY, x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15) ? new Color(255, 255, 255).getRGB() : Theme.borderColor().getRGB()); } @@ -120,7 +122,7 @@ public class ServerComponent { boolean flag2 = flag || flag1; String s2 = flag2 ? EnumChatFormatting.DARK_RED + this.server.gameVersion : this.server.populationInfo; int j = this.mc.fontRendererObj.getStringWidth(s2); - this.mc.fontRendererObj.drawString(s2, (int) x + 240 - j - 15 - 2, (int) y + 3, -1); + this.mc.fontRendererObj.drawString(s2, (int) x + 240 - j - 15 - 2 - (featured ? 10 : 0), (int) y + 3, -1); int k = 0; String s = null; int l; @@ -184,8 +186,13 @@ public class ServerComponent { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(Gui.icons); - Gui.drawModalRectWithCustomSizedTexture((int) x + 240 - 15, (int) y + 2, (float)(k * 10), (float)(176 + l * 8), 10, 8, 256.0F, 256.0F); - Tooltip.render(mouseX, mouseY, x + 240 - 15, y + 2, 10, 8, s1); + Gui.drawModalRectWithCustomSizedTexture((int) x + 240 - 15 - (featured ? 10 : 0), (int) y + 2, (float)(k * 10), (float)(176 + l * 8), 10, 8, 256.0F, 256.0F); + Tooltip.render(mouseX, mouseY, x + 240 - 15 - (featured ? 10 : 0), y + 2, 10, 8, s1); + + if(this.server instanceof ServerDataFeature) { + RenderUtil.drawImage(new ResourceLocation("silentclient/icons/star.png"), x + 240 - 13, y + 2, 8, 8); + Tooltip.render(mouseX, mouseY, x + 240 - 13, y + 2, 8, 8, "Featured Server"); + } return cursorType; } @@ -193,7 +200,7 @@ public class ServerComponent { public boolean mouseClicked(int serverIndex, int mouseX, int mouseY, float x, float y, boolean isSelected) { boolean isHovered = MouseUtils.isInside(mouseX, mouseY, x, y, 240, 35); if(isHovered) { - if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31)) { + if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31) && !(this.server instanceof ServerDataFeature)) { if(this.owner.canUpSwap(serverIndex) && MouseUtils.isInside(mouseX, mouseY, x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15)) { Client.logger.info("Swapping server " + serverIndex + " to up"); this.owner.swapUp(serverIndex, GuiScreen.isShiftKeyDown()); diff --git a/src/main/java/net/silentclient/client/utils/FeaturedServers.java b/src/main/java/net/silentclient/client/utils/FeaturedServers.java index fd005b0..86317f0 100644 --- a/src/main/java/net/silentclient/client/utils/FeaturedServers.java +++ b/src/main/java/net/silentclient/client/utils/FeaturedServers.java @@ -1,20 +1,37 @@ package net.silentclient.client.utils; +import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import net.silentclient.client.utils.types.FeaturedServersResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; public class FeaturedServers { - public static FeaturedServersResponse get() { + public static ArrayList get() { try { - String content = Requests.get("https://api.silentclient.net/_next/servers.json"); + String content = Requests.get("https://assets.silentclient.net/client/servers.json"); GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); - FeaturedServersResponse response = gson.fromJson(content.toString(), FeaturedServersResponse.class); + Type listType = new TypeToken>(){}.getType(); + ArrayList response = gson.fromJson(content.toString(), listType); return response; } catch (Exception e) { return null; } } + + public class FeaturedServerInfo { + public String name; + public String ip; + + public String getName() { + return name; + } + + public String getIp() { + return ip; + } + } } \ No newline at end of file diff --git a/src/main/java/net/silentclient/client/utils/types/FeaturedServersResponse.java b/src/main/java/net/silentclient/client/utils/types/FeaturedServersResponse.java deleted file mode 100644 index b6c5b70..0000000 --- a/src/main/java/net/silentclient/client/utils/types/FeaturedServersResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.silentclient.client.utils.types; - -import java.util.ArrayList; - -import net.silentclient.client.utils.reply.AbstractReply; - -public class FeaturedServersResponse extends AbstractReply { - public ArrayList servers = new ArrayList(); - - public ArrayList getServers() { - return servers; - } - - public class FeaturedServerInfo { - public String name; - public String ip; - - public String getName() { - return name; - } - - public String getIp() { - return ip; - } - } -} From eb960ab990fbbb11ad08d2134d3eec7705495f88 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 15 Sep 2023 12:07:53 +0600 Subject: [PATCH 06/15] Fix --- .../client/gui/multiplayer/SilentMultiplayerGui.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java index 0e4265d..1c01220 100644 --- a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java +++ b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java @@ -168,9 +168,9 @@ public class SilentMultiplayerGui extends SilentScreen { } public void connectToSelected() { - ServerData server = savedServerList.getServerData(selectedServer); + ServerComponent server = servers.get(selectedServer); if(server != null) { - this.connect(new ServerData(server.serverName, server.serverIP, false)); + this.connect(new ServerData(server.getServer().serverName, server.getServer().serverIP, false)); } } From cfa86cd8ce04920e621f32ae934083e7c6b4d89f Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 16 Sep 2023 12:29:51 +0600 Subject: [PATCH 07/15] Always Render Nametag --- .../mixins/RendererLivingEntityMixin.java | 5 ++ .../client/utils/culling/EntityCulling.java | 48 ++++++++----------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java index 3af2b00..60a8230 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/RendererLivingEntityMixin.java @@ -71,18 +71,23 @@ public class RendererLivingEntityMixin { event.call(); if(event.isCancelable()) { ci.cancel(); + return; } final float entityDistance = entity.getDistanceToEntity(Minecraft.getMinecraft().thePlayer); if (EntityCulling.shouldPerformCulling) { if (entity instanceof IMob && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hostile Entity Render Distance").getValInt()) { ci.cancel(); + return; } else if ((entity instanceof EntityAnimal || entity instanceof EntityAmbientCreature || entity instanceof EntityWaterMob) && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Passive Entity Render Distance").getValInt()) { ci.cancel(); + return; } else if (entity instanceof EntityPlayer && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Player Render Distance").getValInt()) { ci.cancel(); + return; } else if (entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Misc. Entity Render Distance").getValInt()) { ci.cancel(); + return; } } if(entity instanceof EntityArmorStand && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean()) { diff --git a/src/main/java/net/silentclient/client/utils/culling/EntityCulling.java b/src/main/java/net/silentclient/client/utils/culling/EntityCulling.java index 50bd953..7086db8 100644 --- a/src/main/java/net/silentclient/client/utils/culling/EntityCulling.java +++ b/src/main/java/net/silentclient/client/utils/culling/EntityCulling.java @@ -1,18 +1,5 @@ package net.silentclient.client.utils.culling; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; - -import net.silentclient.client.mixin.accessors.RenderManagerAccessor; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL15; -import org.lwjgl.opengl.GL33; - import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; @@ -33,7 +20,15 @@ import net.silentclient.client.event.EventTarget; import net.silentclient.client.event.impl.ClientTickEvent; import net.silentclient.client.event.impl.RenderLivingEvent; import net.silentclient.client.event.impl.RenderTickEvent; +import net.silentclient.client.mixin.accessors.RenderManagerAccessor; import net.silentclient.client.mods.settings.FPSBoostMod; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL33; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; public class EntityCulling { private static final Minecraft mc = Minecraft.getMinecraft(); @@ -191,22 +186,19 @@ public class EntityCulling { return; } - if (entity instanceof EntityPlayer) { + //#if MC==10809 + double x = event.x; + double y = event.y; + double z = event.z; + RendererLivingEntity renderer = event.getRenderer(); + //#else + //$$ double x = event.getX(); + //$$ double y = event.getY(); + //$$ double z = event.getZ(); + //$$ RenderLivingBase renderer = event.getRenderer(); + //#endif - //#if MC==10809 - double x = event.x; - double y = event.y; - double z = event.z; - RendererLivingEntity renderer = event.getRenderer(); - //#else - //$$ double x = event.getX(); - //$$ double y = event.getY(); - //$$ double z = event.getZ(); - //$$ RenderLivingBase renderer = event.getRenderer(); - //#endif - - renderer.renderName(entity, x, y, z); - } + renderer.renderName(entity, x, y, z); } } From 43af05e4f286b675b89bc60226aed6f06938198c Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Wed, 20 Sep 2023 01:08:16 +0600 Subject: [PATCH 08/15] test --- .../mixins/LoadingScreenRendererMixin.java | 11 +- .../mixins/NetHandlerPlayClientMixin.java | 62 +++++----- src/main/resources/mixins.SilentClient.json | 114 +----------------- 3 files changed, 30 insertions(+), 157 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java index 22d6f49..d3de571 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java @@ -6,17 +6,10 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MinecraftError; -import net.minecraft.util.ResourceLocation; -import net.silentclient.client.Client; -import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mixin.accessors.MinecraftAccessor; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; 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; import java.awt.*; @@ -67,8 +60,8 @@ public class LoadingScreenRendererMixin { Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), new Color(19, 19, 19).getRGB()); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - RenderUtil.drawCentredImage(new ResourceLocation("silentclient/logos/logo.png"), scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 3, 300, 58); - Client.getInstance().getSilentFontRenderer().drawCenteredString((currentlyDisplayedText != "" ? currentlyDisplayedText : "Loading") + "...", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() - 100, 14, SilentFontRenderer.FontType.TITLE); +// RenderUtil.drawCentredImage(new ResourceLocation("silentclient/logos/logo.png"), scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 3, 300, 58); +// Client.getInstance().getSilentFontRenderer().drawCenteredString((currentlyDisplayedText != "" ? currentlyDisplayedText : "Loading") + "...", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() - 100, 14, SilentFontRenderer.FontType.TITLE); this.mc.updateDisplay(); diff --git a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java index 45f5d69..1f3719b 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java @@ -1,30 +1,22 @@ package net.silentclient.client.mixin.mixins; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.network.play.server.S19PacketEntityStatus; -import net.minecraft.network.play.server.S48PacketResourcePackSend; -import net.minecraft.util.IChatComponent; -import net.silentclient.client.event.impl.EntityDamageEvent; -import net.silentclient.client.hooks.NetHandlerPlayClientHook; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.*; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; @Mixin(NetHandlerPlayClient.class) public class NetHandlerPlayClientMixin { - @Shadow private WorldClient clientWorldController; - - @Inject(method = "handleEntityStatus", at = @At("RETURN")) - public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) { - if(packetIn.getOpCode() == 2) { - EntityDamageEvent event = new EntityDamageEvent(packetIn.getEntity(clientWorldController)); - event.call(); - } - } +// @Shadow private WorldClient clientWorldController; +// +// @Inject(method = "handleEntityStatus", at = @At("RETURN")) +// public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) { +// if(packetIn.getOpCode() == 2) { +// EntityDamageEvent event = new EntityDamageEvent(packetIn.getEntity(clientWorldController)); +// event.call(); +// } +// } @ModifyArg( method = {"handleJoinGame", "handleRespawn"}, @@ -34,20 +26,20 @@ public class NetHandlerPlayClientMixin { return null; } - //#if MC==10809 - @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) - private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { - if (!NetHandlerPlayClientHook.validateResourcePackUrl((NetHandlerPlayClient) (Object) this, packetIn)) { - ci.cancel(); - } - } - @Redirect( - method = "handleUpdateSign", - slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=Unable to locate sign at ", ordinal = 0)), - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;addChatMessage(Lnet/minecraft/util/IChatComponent;)V", ordinal = 0) - ) - private void silent$removeDebugMessage(EntityPlayerSP instance, IChatComponent component) { - // No-op - } - //#endif +// //#if MC==10809 +// @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) +// private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { +// if (!NetHandlerPlayClientHook.validateResourcePackUrl((NetHandlerPlayClient) (Object) this, packetIn)) { +// ci.cancel(); +// } +// } +// @Redirect( +// method = "handleUpdateSign", +// slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=Unable to locate sign at ", ordinal = 0)), +// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;addChatMessage(Lnet/minecraft/util/IChatComponent;)V", ordinal = 0) +// ) +// private void silent$removeDebugMessage(EntityPlayerSP instance, IChatComponent component) { +// // No-op +// } +// //#endif } diff --git a/src/main/resources/mixins.SilentClient.json b/src/main/resources/mixins.SilentClient.json index 1bab5a4..8897702 100644 --- a/src/main/resources/mixins.SilentClient.json +++ b/src/main/resources/mixins.SilentClient.json @@ -3,120 +3,8 @@ "package": "net.silentclient.client.mixin", "refmap": "mixins.SilentClient.refmap.json", "mixins": [ - "mixins.MinecraftMixin", - "mixins.AbstractClientPlayerMixin", - "mixins.GuiChatMixin", - "accessors.GuiAccessor", - "accessors.RenderItemAccessor", - "accessors.SimpleReloadableResourceManagerAccessor", - "accessors.TextureManagerAccessor", - "mixins.EntityRendererMixin", - "mixins.RenderEntityItemMixin", - "mixins.RenderItemFrameMixin", - "mixins.TileEntityMobSpawnerRendererMixin", - "mixins.EntityFXMixin", - "mixins.EffectRendererMixin", - "accessors.RenderManagerAccessor", - "mixins.RenderPlayerMixin", - "mixins.GuiInGameMixin", - "mixins.LayerCapeMixin", - "mixins.GuiAchievementMixin", - "mixins.GuiMultiplayerMixin", - "mixins.GameSettingsMixin", - "mixins.EntityPlayerMixin", "mixins.NetHandlerPlayClientMixin", - "mixins.WorldMixin", - "mixins.RendererLivingEntityMixin", - "mixins.WorldClientMixin", - "mixins.NetworkManagerMixin", - "mixins.RenderManagerMixin", - "mixins.ItemRendererMixin", - "mixins.RenderGlobalMixin", - "mixins.LayerArmorBaseMixin", - "mixins.RenderItemMixin", - "mixins.ModelBipedMixin", "mixins.LoadingScreenRendererMixin", - "accessors.MinecraftAccessor", - "accessors.ItemFoodAccessor", - "mixins.BlockGlassMixin", - "mixins.ShaderGroupMixin", - "mixins.GuiContainerMixin", - "mixins.InventoryEffectRendererMixin", - "mixins.TextureManagerMixin", - "mixins.ChunkMixin", - "mixins.ArmorStandRendererMixin", - "mixins.RenderMixin", - "accessors.FontRendererAccessor", - "mixins.FontRendererMixin", - "mixins.WorldInfoMixin", - "mixins.GuiPlayerTabOverlayMixin", - "mixins.GuiNewChatMixin", - "mixins.FramebufferMixin", - "mixins.GlStateManagerMixin", - "accessors.GuiInGameAccessor", - "mixins.TexturedQuadMixin", - "accessors.WorldRendererAccessor", - "mixins.ModelRendererMixin", - "mixins.BlockRendererDispatcherMixin", - "mixins.MobSpawnerBaseLogicMixin", - "mixins.ChunkRenderDispatcherMixin", - "mixins.LayerArrowMixin", - "mixins.BlockLiquidMixin", - "mixins.TileEntitySkullRendererMixin", - "accessors.EntityArrowAccessor", - "mixins.BlockPosMixin", - "mixins.EntityMixin", - "mixins.EntityOtherPlayerMPMixin", - "mixins.GameRulesValueMixin", - "mixins.MinecraftServerMixin", - "mixins.NBTTagStringMixin", - "mixins.NodeProcessorMixin", - "mixins.VisGraphMixin", - "mixins.BlockRedstoneTorchMixin", - "mixins.ItemStackMixin", - "mixins.C17PacketCustomPayloadMixin", - "mixins.S3FPacketCustomPayloadMixin", - "mixins.BlockFluidRendererMixin", - "mixins.BlockModelRendererAmbientOcclusionFaceMixin", - "mixins.CommandHandlerMixin", - "mixins.EntityXPOrbMixin", - "mixins.GuiGameOverMixin", - "mixins.GuiOptionsMixin", - "mixins.GuiScreenBookMixin", - "mixins.GuiScreenMixin", - "mixins.GuiScreenOptionsSoundsMixin", - "mixins.GuiScreenResourcePacksMixin", - "mixins.GuiVideoSettingsMixin", - "mixins.LayerCreeperChargeMixin", - "mixins.LayerSpiderEyesMixin", - "mixins.LayerWitherAuraMixin", - "mixins.ScoreboardMixin", - "mixins.SoundManagerMixin", - "mixins.TileEntityBannerRendererMixin", - "mixins.TileEntityRendererDispatcherMixin", - "mixins.VertexBufferMixin", - "mixins.ItemModelMesherMixin", - "mixins.EntityLivingBaseMixin", - "mixins.NBTTagCompoundMixin", - "mixins.ServerListEntryNormalMixin", - "mixins.ServerSelectionListMixin", - "mixins.WorldRendererMixin", - "mixins.ResourcePackRepositoryMixin", - "accessors.ResourcePackRepositoryAccessor", - "mixins.LazyLoadBaseMixin", - "mixins.PacketThreadUtilMixin", - "mixins.ServerAddressMixin", - "mixins.ServerListMixin", - "mixins.EntityPacketsMixin", - "mixins.ScreenShotHelperMixin", - "mixins.RenderTNTPrimedMixin", - "mixins.GuiDisconnectedMixin", - "accessors.optifine.CustomColorsAccessor", - "accessors.optifine.ConfigAccessor", - "mixins.NetworkPlayerInfoMixin", - "accessors.NetworkPlayerInfoAccessor", - "mixins.MathHelperMixin", - "mixins.GuiLanguageMixin", - "mixins.RenderArrowMixin" + "accessors.MinecraftAccessor" ] } \ No newline at end of file From be98355ab112ec07b407cdc1e01a0882f257cefe Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Wed, 20 Sep 2023 01:18:24 +0600 Subject: [PATCH 09/15] Return --- .../mixins/C17PacketCustomPayloadMixin.java | 6 +- .../mixins/LoadingScreenRendererMixin.java | 8 +- .../mixins/NetHandlerPlayClientMixin.java | 62 +++++----- src/main/resources/mixins.SilentClient.json | 114 +++++++++++++++++- 4 files changed, 157 insertions(+), 33 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java index 5477f09..d52a77c 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java @@ -17,9 +17,9 @@ public class C17PacketCustomPayloadMixin { @Inject(method = "processPacket(Lnet/minecraft/network/play/INetHandlerPlayServer;)V", at = @At("TAIL")) private void silent$releaseData(INetHandlerPlayServer handler, CallbackInfo ci) { - if (this.data != null) { - this.data.release(); - } +// if (this.data != null) { +// this.data.release(); +// } } //#endif } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java index d3de571..80b05e9 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/LoadingScreenRendererMixin.java @@ -6,6 +6,10 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MinecraftError; +import net.minecraft.util.ResourceLocation; +import net.silentclient.client.Client; +import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mixin.accessors.MinecraftAccessor; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; @@ -60,8 +64,8 @@ public class LoadingScreenRendererMixin { Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), new Color(19, 19, 19).getRGB()); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -// RenderUtil.drawCentredImage(new ResourceLocation("silentclient/logos/logo.png"), scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 3, 300, 58); -// Client.getInstance().getSilentFontRenderer().drawCenteredString((currentlyDisplayedText != "" ? currentlyDisplayedText : "Loading") + "...", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() - 100, 14, SilentFontRenderer.FontType.TITLE); + RenderUtil.drawCentredImage(new ResourceLocation("silentclient/logos/logo.png"), scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 3, 300, 58); + Client.getInstance().getSilentFontRenderer().drawCenteredString((currentlyDisplayedText != "" ? currentlyDisplayedText : "Loading") + "...", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() - 100, 14, SilentFontRenderer.FontType.TITLE); this.mc.updateDisplay(); diff --git a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java index 1f3719b..45f5d69 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java @@ -1,22 +1,30 @@ package net.silentclient.client.mixin.mixins; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S48PacketResourcePackSend; +import net.minecraft.util.IChatComponent; +import net.silentclient.client.event.impl.EntityDamageEvent; +import net.silentclient.client.hooks.NetHandlerPlayClientHook; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(NetHandlerPlayClient.class) public class NetHandlerPlayClientMixin { -// @Shadow private WorldClient clientWorldController; -// -// @Inject(method = "handleEntityStatus", at = @At("RETURN")) -// public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) { -// if(packetIn.getOpCode() == 2) { -// EntityDamageEvent event = new EntityDamageEvent(packetIn.getEntity(clientWorldController)); -// event.call(); -// } -// } + @Shadow private WorldClient clientWorldController; + + @Inject(method = "handleEntityStatus", at = @At("RETURN")) + public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) { + if(packetIn.getOpCode() == 2) { + EntityDamageEvent event = new EntityDamageEvent(packetIn.getEntity(clientWorldController)); + event.call(); + } + } @ModifyArg( method = {"handleJoinGame", "handleRespawn"}, @@ -26,20 +34,20 @@ public class NetHandlerPlayClientMixin { return null; } -// //#if MC==10809 -// @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) -// private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { -// if (!NetHandlerPlayClientHook.validateResourcePackUrl((NetHandlerPlayClient) (Object) this, packetIn)) { -// ci.cancel(); -// } -// } -// @Redirect( -// method = "handleUpdateSign", -// slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=Unable to locate sign at ", ordinal = 0)), -// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;addChatMessage(Lnet/minecraft/util/IChatComponent;)V", ordinal = 0) -// ) -// private void silent$removeDebugMessage(EntityPlayerSP instance, IChatComponent component) { -// // No-op -// } -// //#endif + //#if MC==10809 + @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) + private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { + if (!NetHandlerPlayClientHook.validateResourcePackUrl((NetHandlerPlayClient) (Object) this, packetIn)) { + ci.cancel(); + } + } + @Redirect( + method = "handleUpdateSign", + slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=Unable to locate sign at ", ordinal = 0)), + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;addChatMessage(Lnet/minecraft/util/IChatComponent;)V", ordinal = 0) + ) + private void silent$removeDebugMessage(EntityPlayerSP instance, IChatComponent component) { + // No-op + } + //#endif } diff --git a/src/main/resources/mixins.SilentClient.json b/src/main/resources/mixins.SilentClient.json index 8897702..1bab5a4 100644 --- a/src/main/resources/mixins.SilentClient.json +++ b/src/main/resources/mixins.SilentClient.json @@ -3,8 +3,120 @@ "package": "net.silentclient.client.mixin", "refmap": "mixins.SilentClient.refmap.json", "mixins": [ + "mixins.MinecraftMixin", + "mixins.AbstractClientPlayerMixin", + "mixins.GuiChatMixin", + "accessors.GuiAccessor", + "accessors.RenderItemAccessor", + "accessors.SimpleReloadableResourceManagerAccessor", + "accessors.TextureManagerAccessor", + "mixins.EntityRendererMixin", + "mixins.RenderEntityItemMixin", + "mixins.RenderItemFrameMixin", + "mixins.TileEntityMobSpawnerRendererMixin", + "mixins.EntityFXMixin", + "mixins.EffectRendererMixin", + "accessors.RenderManagerAccessor", + "mixins.RenderPlayerMixin", + "mixins.GuiInGameMixin", + "mixins.LayerCapeMixin", + "mixins.GuiAchievementMixin", + "mixins.GuiMultiplayerMixin", + "mixins.GameSettingsMixin", + "mixins.EntityPlayerMixin", "mixins.NetHandlerPlayClientMixin", + "mixins.WorldMixin", + "mixins.RendererLivingEntityMixin", + "mixins.WorldClientMixin", + "mixins.NetworkManagerMixin", + "mixins.RenderManagerMixin", + "mixins.ItemRendererMixin", + "mixins.RenderGlobalMixin", + "mixins.LayerArmorBaseMixin", + "mixins.RenderItemMixin", + "mixins.ModelBipedMixin", "mixins.LoadingScreenRendererMixin", - "accessors.MinecraftAccessor" + "accessors.MinecraftAccessor", + "accessors.ItemFoodAccessor", + "mixins.BlockGlassMixin", + "mixins.ShaderGroupMixin", + "mixins.GuiContainerMixin", + "mixins.InventoryEffectRendererMixin", + "mixins.TextureManagerMixin", + "mixins.ChunkMixin", + "mixins.ArmorStandRendererMixin", + "mixins.RenderMixin", + "accessors.FontRendererAccessor", + "mixins.FontRendererMixin", + "mixins.WorldInfoMixin", + "mixins.GuiPlayerTabOverlayMixin", + "mixins.GuiNewChatMixin", + "mixins.FramebufferMixin", + "mixins.GlStateManagerMixin", + "accessors.GuiInGameAccessor", + "mixins.TexturedQuadMixin", + "accessors.WorldRendererAccessor", + "mixins.ModelRendererMixin", + "mixins.BlockRendererDispatcherMixin", + "mixins.MobSpawnerBaseLogicMixin", + "mixins.ChunkRenderDispatcherMixin", + "mixins.LayerArrowMixin", + "mixins.BlockLiquidMixin", + "mixins.TileEntitySkullRendererMixin", + "accessors.EntityArrowAccessor", + "mixins.BlockPosMixin", + "mixins.EntityMixin", + "mixins.EntityOtherPlayerMPMixin", + "mixins.GameRulesValueMixin", + "mixins.MinecraftServerMixin", + "mixins.NBTTagStringMixin", + "mixins.NodeProcessorMixin", + "mixins.VisGraphMixin", + "mixins.BlockRedstoneTorchMixin", + "mixins.ItemStackMixin", + "mixins.C17PacketCustomPayloadMixin", + "mixins.S3FPacketCustomPayloadMixin", + "mixins.BlockFluidRendererMixin", + "mixins.BlockModelRendererAmbientOcclusionFaceMixin", + "mixins.CommandHandlerMixin", + "mixins.EntityXPOrbMixin", + "mixins.GuiGameOverMixin", + "mixins.GuiOptionsMixin", + "mixins.GuiScreenBookMixin", + "mixins.GuiScreenMixin", + "mixins.GuiScreenOptionsSoundsMixin", + "mixins.GuiScreenResourcePacksMixin", + "mixins.GuiVideoSettingsMixin", + "mixins.LayerCreeperChargeMixin", + "mixins.LayerSpiderEyesMixin", + "mixins.LayerWitherAuraMixin", + "mixins.ScoreboardMixin", + "mixins.SoundManagerMixin", + "mixins.TileEntityBannerRendererMixin", + "mixins.TileEntityRendererDispatcherMixin", + "mixins.VertexBufferMixin", + "mixins.ItemModelMesherMixin", + "mixins.EntityLivingBaseMixin", + "mixins.NBTTagCompoundMixin", + "mixins.ServerListEntryNormalMixin", + "mixins.ServerSelectionListMixin", + "mixins.WorldRendererMixin", + "mixins.ResourcePackRepositoryMixin", + "accessors.ResourcePackRepositoryAccessor", + "mixins.LazyLoadBaseMixin", + "mixins.PacketThreadUtilMixin", + "mixins.ServerAddressMixin", + "mixins.ServerListMixin", + "mixins.EntityPacketsMixin", + "mixins.ScreenShotHelperMixin", + "mixins.RenderTNTPrimedMixin", + "mixins.GuiDisconnectedMixin", + "accessors.optifine.CustomColorsAccessor", + "accessors.optifine.ConfigAccessor", + "mixins.NetworkPlayerInfoMixin", + "accessors.NetworkPlayerInfoAccessor", + "mixins.MathHelperMixin", + "mixins.GuiLanguageMixin", + "mixins.RenderArrowMixin" ] } \ No newline at end of file From 8318d253507288005aafd1d7e1b1539205eb46bb Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 22 Sep 2023 21:22:52 +0600 Subject: [PATCH 10/15] Custom FPS Limit in Silent Menu --- src/main/java/net/silentclient/client/gui/SilentScreen.java | 4 ++++ .../client/mixin/mixins/C17PacketCustomPayloadMixin.java | 6 +++--- .../silentclient/client/mixin/mixins/MinecraftMixin.java | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/silentclient/client/gui/SilentScreen.java b/src/main/java/net/silentclient/client/gui/SilentScreen.java index 6159b92..9fbc385 100644 --- a/src/main/java/net/silentclient/client/gui/SilentScreen.java +++ b/src/main/java/net/silentclient/client/gui/SilentScreen.java @@ -46,4 +46,8 @@ public class SilentScreen extends GuiScreen { super.onGuiClosed(); Client.getInstance().getMouseCursorHandler().disableCursor(); } + + public int getFpsLimit() { + return 120; + } } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java index d52a77c..5477f09 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/C17PacketCustomPayloadMixin.java @@ -17,9 +17,9 @@ public class C17PacketCustomPayloadMixin { @Inject(method = "processPacket(Lnet/minecraft/network/play/INetHandlerPlayServer;)V", at = @At("TAIL")) private void silent$releaseData(INetHandlerPlayServer handler, CallbackInfo ci) { -// if (this.data != null) { -// this.data.release(); -// } + if (this.data != null) { + this.data.release(); + } } //#endif } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java index e604880..22769b7 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java @@ -318,13 +318,13 @@ public abstract class MinecraftMixin implements MinecraftExt { @Overwrite public int getLimitFramerate() { - if (this.theWorld == null && this.currentScreen != null) return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate; + if (this.theWorld == null && this.currentScreen != null) return this.currentScreen instanceof SilentScreen ? ((SilentScreen) this.currentScreen).getFpsLimit() : 30; if(!Display.isActive()) { return 60; } - return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate; + return this.gameSettings.limitFramerate; } @Override From 7f0273016d6d36d7cf96e2cfbbab28f8ea2071a1 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 30 Sep 2023 14:56:02 +0600 Subject: [PATCH 11/15] Retry Button in Gui Disconnected --- .../java/net/silentclient/client/Client.java | 7 +++-- .../event/impl/ConnectToServerEvent.java | 11 ++++--- .../client/gui/minecraft/GuiConnecting.java | 4 +-- .../mixin/mixins/GuiDisconnectedMixin.java | 31 ++++++++++++++++++- .../optifine/OptiFineFontRendererHandler.java | 26 ---------------- 5 files changed, 43 insertions(+), 36 deletions(-) delete mode 100644 src/main/java/net/silentclient/client/mixin/optifine/OptiFineFontRendererHandler.java diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 992c299..b9677b2 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.resources.data.IMetadataSerializer; import net.minecraft.util.ResourceLocation; import net.silentclient.client.config.ConfigManager; @@ -91,6 +92,7 @@ public class Client { private GlobalSettings globalSettings; private File globalSettingsFile; private AccountManager accountManager; + public ServerData lastServerData; public static void memoryDebug(String paramString) { LogManager.getLogger().info("-- Start Memory Debug -- " + paramString); @@ -500,8 +502,9 @@ public class Client { playersCount = 0; nextPing = 10; this.updateUserInformation(); - Client.logger.info("Update Connection Server: " + event.getIp()); - silentSocket.getSocket().emit("update_information", event.getIp()); + Client.logger.info("Update Connection Server: " + event.getServerData().serverIP); + silentSocket.getSocket().emit("update_information", event.getServerData().serverIP); + lastServerData = event.getServerData(); } @EventTarget diff --git a/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java b/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java index 3e0020d..011e951 100644 --- a/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java +++ b/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java @@ -1,16 +1,17 @@ package net.silentclient.client.event.impl; +import net.minecraft.client.multiplayer.ServerData; import net.silentclient.client.event.Event; public class ConnectToServerEvent extends Event { - private final String ip; + private final ServerData serverData; - public ConnectToServerEvent(String ip) { - this.ip = ip; + public ConnectToServerEvent(ServerData serverData) { + this.serverData = serverData; } - public String getIp() { - return ip; + public ServerData getServerData() { + return serverData; } } diff --git a/src/main/java/net/silentclient/client/gui/minecraft/GuiConnecting.java b/src/main/java/net/silentclient/client/gui/minecraft/GuiConnecting.java index 2e983a4..c58526c 100644 --- a/src/main/java/net/silentclient/client/gui/minecraft/GuiConnecting.java +++ b/src/main/java/net/silentclient/client/gui/minecraft/GuiConnecting.java @@ -87,7 +87,7 @@ public class GuiConnecting extends SilentScreen GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - new ConnectToServerEvent(serverData.serverIP).call(); + new ConnectToServerEvent(serverData).call(); } catch (UnknownHostException unknownhostexception) { @@ -153,7 +153,7 @@ public class GuiConnecting extends SilentScreen GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - new ConnectToServerEvent(ip).call(); + new ConnectToServerEvent(new ServerData("Minecraft Server", ip, false)).call(); } catch (UnknownHostException unknownhostexception) { diff --git a/src/main/java/net/silentclient/client/mixin/mixins/GuiDisconnectedMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/GuiDisconnectedMixin.java index 491f38b..62a2f80 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/GuiDisconnectedMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/GuiDisconnectedMixin.java @@ -1,16 +1,27 @@ package net.silentclient.client.mixin.mixins; +import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; import net.minecraft.util.IChatComponent; +import net.silentclient.client.Client; import net.silentclient.client.event.impl.ServerLeaveEvent; +import net.silentclient.client.gui.minecraft.GuiConnecting; +import net.silentclient.client.gui.multiplayer.SilentMultiplayerGui; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; + @Mixin(GuiDisconnected.class) -public class GuiDisconnectedMixin { +public class GuiDisconnectedMixin extends GuiScreen { + @Shadow private int field_175353_i; + @Inject(method = "", at = @At("RETURN")) private void init(GuiScreen screen, String reasonLocalizationKey, @@ -18,4 +29,22 @@ public class GuiDisconnectedMixin { CallbackInfo ci) { new ServerLeaveEvent().call(); } + + @Redirect(method = "initGui", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) + public boolean addButtons(List instance, E e) { + if(Client.getInstance().lastServerData != null) { + instance.add(new GuiButton(1, this.width / 2 - 100, this.height / 2 + field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, "Retry")); + } + instance.add(new GuiButton(0, this.width / 2 - 100, this.height / 2 + field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT + (Client.getInstance().lastServerData != null ? 23 : 0), I18n.format("gui.toMenu", new Object[0]))); + + return false; + } + + @Inject(method = "actionPerformed", at = @At("HEAD"), cancellable = true) + public void reconnect(GuiButton button, CallbackInfo ci) { + if(button.id == 1 && Client.getInstance().lastServerData != null) { + this.mc.displayGuiScreen(new GuiConnecting(new SilentMultiplayerGui(Client.getInstance().getMainMenu()), this.mc, Client.getInstance().lastServerData)); + ci.cancel(); + } + } } diff --git a/src/main/java/net/silentclient/client/mixin/optifine/OptiFineFontRendererHandler.java b/src/main/java/net/silentclient/client/mixin/optifine/OptiFineFontRendererHandler.java deleted file mode 100644 index 76150d7..0000000 --- a/src/main/java/net/silentclient/client/mixin/optifine/OptiFineFontRendererHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.silentclient.client.mixin.optifine; - -import net.silentclient.client.Client; -import net.silentclient.client.mixin.SilentClientTweaker; -import net.silentclient.client.mixin.accessors.optifine.ConfigAccessor; -import net.silentclient.client.mixin.accessors.optifine.CustomColorsAccessor; - -public class OptiFineFontRendererHandler { - private static boolean caughtError = false; - public static int getTextColor(int index, int originalColor) { - if (caughtError) return originalColor; - try { - if (!SilentClientTweaker.hasOptifine) { - return originalColor; - } - if (ConfigAccessor.invokeIsCustomColors()) { - return CustomColorsAccessor.invokeGetTextColor(index, originalColor); - } - return originalColor; - } catch (Throwable t) { - caughtError = true; - Client.logger.error("Unable to get OptiFine's Custom Color", t); - return originalColor; - } - } -} \ No newline at end of file From 319f7a32ddb66019ff434c09c2e59e7cd85c6b44 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 30 Sep 2023 15:06:54 +0600 Subject: [PATCH 12/15] Fixed World Swapping --- .../net/silentclient/client/mixin/mixins/MinecraftMixin.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java index 22769b7..944774b 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java @@ -266,7 +266,6 @@ public abstract class MinecraftMixin implements MinecraftExt { at = @At(value = "INVOKE", target = "Ljava/lang/System;gc()V") ) private void optimizedWorldSwapping() { - System.gc(); } //#if MC==10809 From 7a8fd25ba838b254ccdc7a98bf26c4a11013ec90 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 30 Sep 2023 15:22:26 +0600 Subject: [PATCH 13/15] Test --- .../client/mixin/mixins/FontRendererMixin.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java index 6108d97..36a401e 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java @@ -9,9 +9,7 @@ import org.spongepowered.asm.mixin.Final; 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.ModifyVariable; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(value = FontRenderer.class, priority = 1100) public abstract class FontRendererMixin implements FontRendererExt { @@ -48,14 +46,4 @@ public abstract class FontRendererMixin implements FontRendererExt { protected abstract void resetStyles(); @Shadow @Final private ResourceLocation locationFontTexture; - - @Inject(method = "drawString(Ljava/lang/String;FFIZ)I", - at = @At( - value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;renderString(Ljava/lang/String;FFIZ)I", - ordinal = 0, shift = At.Shift.AFTER - ) - ) - private void silent$resetStyle(CallbackInfoReturnable ci) { - this.resetStyles(); - } } From ef97091bb14368a9d4d2216fa268e49b5d1ce0ac Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 30 Sep 2023 15:39:18 +0600 Subject: [PATCH 14/15] Update FontRendererMixin.java --- .../client/mixin/mixins/FontRendererMixin.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java index 36a401e..6108d97 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/FontRendererMixin.java @@ -9,7 +9,9 @@ import org.spongepowered.asm.mixin.Final; 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.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(value = FontRenderer.class, priority = 1100) public abstract class FontRendererMixin implements FontRendererExt { @@ -46,4 +48,14 @@ public abstract class FontRendererMixin implements FontRendererExt { protected abstract void resetStyles(); @Shadow @Final private ResourceLocation locationFontTexture; + + @Inject(method = "drawString(Ljava/lang/String;FFIZ)I", + at = @At( + value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;renderString(Ljava/lang/String;FFIZ)I", + ordinal = 0, shift = At.Shift.AFTER + ) + ) + private void silent$resetStyle(CallbackInfoReturnable ci) { + this.resetStyles(); + } } From ba6418e435dc507dab5164ee80371dbf120f17a8 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sat, 30 Sep 2023 16:11:04 +0600 Subject: [PATCH 15/15] Update ModDraggable.java --- .../java/net/silentclient/client/mods/ModDraggable.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/silentclient/client/mods/ModDraggable.java b/src/main/java/net/silentclient/client/mods/ModDraggable.java index c9f99d1..85811c6 100644 --- a/src/main/java/net/silentclient/client/mods/ModDraggable.java +++ b/src/main/java/net/silentclient/client/mods/ModDraggable.java @@ -32,10 +32,14 @@ public abstract class ModDraggable extends Mod implements IRenderer { private HUDConfigScreen.CornerScalingType cornerScalingType; - public ModDraggable(String name, ModCategory category, String icon) { - super(name, category, icon); + public ModDraggable(String name, ModCategory category, String icon, boolean defaultEnabled) { + super(name, category, icon, defaultEnabled); this.pos = ScreenPosition.fromRelativePosition(0, 0); } + + public ModDraggable(String name, ModCategory category, String icon) { + this(name, category, icon, false); + } @Override public void setup() {