diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 548005c..323bc90 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -22,6 +22,7 @@ import net.silentclient.client.gui.modmenu.ModMenu; import net.silentclient.client.gui.silentmainmenu.MainMenuConcept; import net.silentclient.client.gui.util.BackgroundPanorama; import net.silentclient.client.keybinds.KeyBindManager; +import net.silentclient.client.mixin.SilentClientTweaker; import net.silentclient.client.mixin.accessors.MinecraftAccessor; import net.silentclient.client.mods.ModInstances; import net.silentclient.client.mods.SettingsManager; @@ -156,6 +157,10 @@ public class Client { } logger.info("-------------------------------------------------"); memoryDebug("CLIENT_PRE_INIT"); + if(SilentClientTweaker.hasOptifine) { + logger.info("INITIALISING > optifine-patch"); + OptifinePatch.init(); + } logger.info("INITIALISING > gson-builder"); this.gson = (new GsonBuilder()).registerTypeAdapterFactory(new EnumAdapterFactory()).setPrettyPrinting() .enableComplexMapKeySerialization().create(); @@ -190,11 +195,6 @@ public class Client { if(acc != null) { Client.getInstance().setAccount(acc.getAccount()); } - if(OSUtil.isWindows()) { - logger.info("STARTING > raw-mouse-input"); - Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); - RawInputHandler.init(); - } logger.info("STARTING > settings-manager"); settingsManager = new SettingsManager(); logger.info("STARTING > mod-instances"); @@ -235,6 +235,12 @@ public class Client { } logger.info("STARTING > config-manager"); configManager = new ConfigManager(); + if(OSUtil.isWindows()) { + logger.info("STARTING > raw-mouse-input"); + Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); + RawInputHandler.init(); + RawInputHandler.toggleRawInput(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Raw Mouse Input").getValBoolean()); + } logger.info("STARTING > texture-manager"); this.textureManager = new SCTextureManager(Minecraft.getMinecraft().getResourceManager()); logger.info("STARTING > font-renderer"); diff --git a/src/main/java/net/silentclient/client/cosmetics/gui/OutfitsGui.java b/src/main/java/net/silentclient/client/cosmetics/gui/OutfitsGui.java index a2962b3..fe396bc 100644 --- a/src/main/java/net/silentclient/client/cosmetics/gui/OutfitsGui.java +++ b/src/main/java/net/silentclient/client/cosmetics/gui/OutfitsGui.java @@ -104,63 +104,63 @@ public class OutfitsGui extends SilentScreen { RenderUtil.drawRoundedOutline(outfitX, outfitY, 80, 80, 3, 1, Theme.borderColor().getRGB()); Client.getInstance().getSilentFontRenderer().drawString(outfit.name, outfitX + 3, (int) (outfitY + 3), 12, SilentFontRenderer.FontType.TITLE, 64); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/trash-icon.png"), outfitX + 80 - 3 - 10, outfitY + 3, 10, 10); - int cosmeticY = (int) (outfitY + 18); - if(outfit.selected_cape != 0 && Client.getInstance().getCosmetics().getMyCapes().stream().filter((c) -> c.id == outfit.selected_cape).findFirst().isPresent()) { + if(outfit.selected_cape != 0 && Client.getInstance().getCosmetics().getMyCapes().stream().filter((c) -> c.id == outfit.selected_cape).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyCapes().stream().filter((c) -> c.id == outfit.selected_cape).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_wings != 0 && Client.getInstance().getCosmetics().getMyWings().stream().filter((c) -> c.id == outfit.selected_wings).findFirst().isPresent()) { + if(outfit.selected_wings != 0 && Client.getInstance().getCosmetics().getMyWings().stream().filter((c) -> c.id == outfit.selected_wings).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyWings().stream().filter((c) -> c.id == outfit.selected_wings).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_bandana != 0 && Client.getInstance().getCosmetics().getMyBandanas().stream().filter((c) -> c.id == outfit.selected_bandana).findFirst().isPresent()) { + if(outfit.selected_bandana != 0 && Client.getInstance().getCosmetics().getMyBandanas().stream().filter((c) -> c.id == outfit.selected_bandana).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyBandanas().stream().filter((c) -> c.id == outfit.selected_bandana).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_hat != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_hat).findFirst().isPresent()) { + if(outfit.selected_hat != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_hat).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_hat).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_neck != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_neck).findFirst().isPresent()) { + if(outfit.selected_neck != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_neck).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_neck).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_mask != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_mask).findFirst().isPresent()) { + if(outfit.selected_mask != 0 && Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_mask).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyHats().stream().filter((c) -> c.id == outfit.selected_mask).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_shield != 0 && Client.getInstance().getCosmetics().getMyShields().stream().filter((c) -> c.id == outfit.selected_shield).findFirst().isPresent()) { + if(outfit.selected_shield != 0 && Client.getInstance().getCosmetics().getMyShields().stream().filter((c) -> c.id == outfit.selected_shield).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyShields().stream().filter((c) -> c.id == outfit.selected_shield).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); cosmeticY += 10; } - if(outfit.selected_icon != 0 && Client.getInstance().getCosmetics().getMyIcons().stream().filter((c) -> c.id == outfit.selected_icon).findFirst().isPresent()) { + if(outfit.selected_icon != 0 && Client.getInstance().getCosmetics().getMyIcons().stream().filter((c) -> c.id == outfit.selected_icon).findFirst().isPresent() && (cosmeticY - outfitY) <= 62) { PlayerResponse.Account.Cosmetics.CosmeticItem item = Client.getInstance().getCosmetics().getMyIcons().stream().filter((c) -> c.id == outfit.selected_icon).findFirst().get(); Client.getInstance().getSilentFontRenderer().drawString(item.name, outfitX + 3, cosmeticY, 10, SilentFontRenderer.FontType.TITLE, 75); } + this.outfitIndex += 1; outfitIndex += 1; if(outfitIndex == 3) { diff --git a/src/main/java/net/silentclient/client/gui/hud/Watermark.java b/src/main/java/net/silentclient/client/gui/hud/Watermark.java index 336a9c2..372da9a 100644 --- a/src/main/java/net/silentclient/client/gui/hud/Watermark.java +++ b/src/main/java/net/silentclient/client/gui/hud/Watermark.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; +import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.mods.settings.GeneralMod; public class Watermark { @@ -34,6 +35,35 @@ public class Watermark { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("silentclient/logos/logo.png")); Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 110, 21, 110.0F, 21.0F); + + versionRender(); + } + + public void versionRender() { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int x = 0; + int y = 0; + int width = Client.getInstance().getSilentFontRenderer().getStringWidth(Client.getInstance().getFullVersion(), 10, SilentFontRenderer.FontType.TITLE) + 5; + switch (Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Logo Location").getValString()) { + case "Bottom Right Corner": + x = 5; + y = scaledResolution.getScaledHeight() - 23; + break; + case "Bottom Left Corner": + x = scaledResolution.getScaledWidth() - width; + y = scaledResolution.getScaledHeight() - 23; + break; + case "Top Right Corner": + x = 5; + y = 3; + break; + case "Top Left Corner": + x = scaledResolution.getScaledWidth() - width; + y = 3; + break; + } + + Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().getFullVersion(), x, y + (21 / 2) - 5 + 3, 10, SilentFontRenderer.FontType.TITLE); } public void render(int x, int y) { diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java index 268f2c6..c0f9515 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java @@ -216,7 +216,10 @@ public class ClickGUI extends SilentScreen { RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15); if(selectedCategory == ModCategory.PLUS) { - PremiumGui.drawScreen(x, y, width, height, mouseX, mouseY, partialTicks, nametagMessageInput); + MouseCursorHandler.CursorType premiumCursor = PremiumGui.drawScreen(x, y, width, height, mouseX, mouseY, partialTicks, nametagMessageInput); + if(premiumCursor != null) { + cursorType = premiumCursor; + } } super.drawScreen(mouseX, mouseY, partialTicks); @@ -233,11 +236,13 @@ public class ClickGUI extends SilentScreen { mc.displayGuiScreen(null); } loaded = false; + Client.getInstance().getMouseCursorHandler().disableCursor(); + } else { + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); } if(introAnimation.isDone() && !close) { loaded = true; } - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); GlUtils.stopScale(); GlStateManager.popMatrix(); diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java index c7e8285..d5c117b 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java @@ -146,8 +146,6 @@ public class GuiColorPicker extends SilentScreen { cursorType = MouseCursorHandler.CursorType.POINTER; } - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); - GL11.glPopMatrix(); RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15); @@ -161,7 +159,10 @@ public class GuiColorPicker extends SilentScreen { if(ClickGUI.introAnimation.isDone(Direction.BACKWARDS)) { mc.displayGuiScreen(null); } - } + Client.getInstance().getMouseCursorHandler().disableCursor(); + } else { + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); + } GlUtils.stopScale(); GlStateManager.popMatrix(); diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java index cb267af..499f585 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java @@ -224,7 +224,6 @@ public class ModSettings extends SilentScreen { settingY += settingHeight; } - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glPopMatrix(); @@ -275,7 +274,10 @@ public class ModSettings extends SilentScreen { if(ClickGUI.introAnimation.isDone(Direction.BACKWARDS)) { mc.displayGuiScreen(null); } - } + Client.getInstance().getMouseCursorHandler().disableCursor(); + } else { + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); + } GlUtils.stopScale(); GlStateManager.popMatrix(); diff --git a/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java index 33330c6..13e681b 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java @@ -25,6 +25,7 @@ import net.silentclient.client.mods.render.NewMotionBlurMod; import net.silentclient.client.mods.settings.RenderMod; import net.silentclient.client.utils.CloudRenderer; import net.silentclient.client.utils.HUDCaching; +import net.silentclient.client.utils.OptifinePatch; import net.silentclient.client.utils.culling.EntityCulling; import net.silentclient.client.utils.shader.MotionBlurUtils; import org.spongepowered.asm.mixin.Mixin; @@ -205,6 +206,9 @@ public abstract class EntityRendererMixin implements EntityRendererExt { if(Client.getInstance().getModInstances().getModByClass(NewMotionBlurMod.class).isEnabled() && !Client.getInstance().getModInstances().getModByClass(NewMotionBlurMod.class).isForceDisabled()) { if (motionBlur != null){ + if(OptifinePatch.needPatch()) { + OptifinePatch.patch(); + } shaders.add(motionBlur); } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/GuiPlayerTabOverlayMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/GuiPlayerTabOverlayMixin.java index 8e3dedb..c00cd55 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/GuiPlayerTabOverlayMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/GuiPlayerTabOverlayMixin.java @@ -9,6 +9,9 @@ import net.minecraft.client.gui.GuiPlayerTabOverlay; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EnumPlayerModelParts; @@ -62,15 +65,21 @@ public abstract class GuiPlayerTabOverlayMixin { List list = field_175252_a.sortedCopy(nethandlerplayclient.getPlayerInfoMap()); int i = 0; int j = 0; - boolean isSilent = false; for (NetworkPlayerInfo networkplayerinfo : list) { - int k = this.mc.fontRendererObj.getStringWidth(this.getPlayerName(networkplayerinfo)); - i = Math.max(i, k); + boolean isSilent = false; + try { + EntityPlayer entityplayer = networkplayerinfo.getGameProfile().getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()) ? this.mc.thePlayer : this.mc.theWorld.getPlayerEntityByUUID(networkplayerinfo.getGameProfile().getId()); + if(entityplayer != null) { + isSilent = Boolean.parseBoolean(Players.getPlayerStatus(networkplayerinfo.getGameProfile().getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()), networkplayerinfo.getGameProfile().getName(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer)); + } + } catch (Exception err) { - if (scoreObjectiveIn != null && scoreObjectiveIn.getRenderType() != IScoreObjectiveCriteria.EnumRenderType.HEARTS) - { + } + int k = this.mc.fontRendererObj.getStringWidth(this.getPlayerName(networkplayerinfo)) + (isSilent && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean() ? 9 : 0); + i = Math.max(i, k); + if (scoreObjectiveIn != null && scoreObjectiveIn.getRenderType() != IScoreObjectiveCriteria.EnumRenderType.HEARTS) { k = this.mc.fontRendererObj.getStringWidth(" " + scoreboardIn.getValueFromObjective(networkplayerinfo.getGameProfile().getName(), scoreObjectiveIn).getScorePoints()); j = Math.max(j, k); } @@ -174,29 +183,35 @@ public abstract class GuiPlayerTabOverlayMixin { String s1 = this.getPlayerName(networkplayerinfo1); GameProfile gameprofile = networkplayerinfo1.getGameProfile(); + boolean isSilent = false; + try { + EntityPlayer entityplayer = gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()) ? this.mc.thePlayer : this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId()); + if(entityplayer != null) { + isSilent = Boolean.parseBoolean(Players.getPlayerStatus(gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()), gameprofile.getName(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer)); + } + if(isSilent && entityplayer != null && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean()) { + this.mc.getTextureManager().bindTexture(((AbstractClientPlayerExt) entityplayer).silent$getPlayerIcon().getLocation()); + GlStateManager.color(1.0f, 1.0f, 1.0f); + drawModalRectWithCustomSizedTexture(j2 + 0.5F, k2, 0.0f, 0.0f, 8.0f, 8.0f, 8.0f, 8.0f); + j2 += 9; + } + } catch (Exception err) { + + } + if (flag) { EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId()); - try { - isSilent = Boolean.parseBoolean(Players.getPlayerStatus(entityplayer == mc.thePlayer, entityplayer.getName().toString(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer)) && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean(); - } catch (Exception e) { - isSilent = false; - } boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE) && (gameprofile.getName().equals("Dinnerbone") || gameprofile.getName().equals("Grumm")); - if(!isSilent) { - ((TextureManagerExt) this.mc.getTextureManager()).waitBindTexture(new StaticResourceLocation(networkplayerinfo1.getLocationSkin().getResourcePath()), new StaticResourceLocation(DefaultPlayerSkin.getDefaultSkinLegacy().getResourcePath())); - int l2 = 8 + (flag1 ? 8 : 0); - int i3 = 8 * (flag1 ? -1 : 1); - Gui.drawScaledCustomSizeModalRect(j2, k2, 8.0F, (float)l2, 8, i3, 8, 8, 64.0F, 64.0F); - if (entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.HAT)) - { - int j3 = 8 + (flag1 ? 8 : 0); - int k3 = 8 * (flag1 ? -1 : 1); - Gui.drawScaledCustomSizeModalRect(j2, k2, 40.0F, (float)j3, 8, k3, 8, 8, 64.0F, 64.0F); - } - } else { - this.mc.getTextureManager().bindTexture(((AbstractClientPlayerExt) entityplayer).silent$getPlayerIcon().getLocation()); - Gui.drawModalRectWithCustomSizedTexture(j2, k2, 8, 8, 8, 8, 8, 8); + ((TextureManagerExt) this.mc.getTextureManager()).waitBindTexture(new StaticResourceLocation(networkplayerinfo1.getLocationSkin().getResourcePath()), new StaticResourceLocation(DefaultPlayerSkin.getDefaultSkinLegacy().getResourcePath())); + int l2 = 8 + (flag1 ? 8 : 0); + int i3 = 8 * (flag1 ? -1 : 1); + Gui.drawScaledCustomSizeModalRect(j2, k2, 8.0F, (float)l2, 8, i3, 8, 8, 64.0F, 64.0F); + if (entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.HAT)) + { + int j3 = 8 + (flag1 ? 8 : 0); + int k3 = 8 * (flag1 ? -1 : 1); + Gui.drawScaledCustomSizeModalRect(j2, k2, 40.0F, (float)j3, 8, k3, 8, 8, 64.0F, 64.0F); } j2 += 9; @@ -223,7 +238,7 @@ public abstract class GuiPlayerTabOverlayMixin { } } - this.drawPing(i1, j2 - (flag ? 9 : 0), k2, networkplayerinfo1); + this.drawPing(i1, j2 - (flag ? 9 : 0) - (isSilent && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean() ? 9 : 0), k2, networkplayerinfo1); } } @@ -242,10 +257,42 @@ public abstract class GuiPlayerTabOverlayMixin { } } } catch(Exception err) { - Client.logger.error("TAB RENDERER ERROR: " + err.getMessage()); + Client.logger.catching(err); } } + public void drawModalRectWithCustomSizedTexture(final float x, final float y, final float u, final float v, final float width, final float height, final float textureWidth, final float textureHeight) { + final float f = 1.0f / textureWidth; + final float f2 = 1.0f / textureHeight; + final Tessellator tessellator = Tessellator.getInstance(); + final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(4, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(x, y + height, 0.0).tex(u * f, (v + height) * f2).endVertex(); + worldrenderer.pos(x + width, y + height, 0.0).tex((u + width) * f, (v + height) * f2).endVertex(); + worldrenderer.pos(x + width, y, 0.0).tex((u + width) * f, v * f2).endVertex(); + worldrenderer.pos(x + width, y, 0.0).tex((u + width) * f, v * f2).endVertex(); + worldrenderer.pos(x, y, 0.0).tex(u * f, v * f2).endVertex(); + worldrenderer.pos(x, y + height, 0.0).tex(u * f, (v + height) * f2).endVertex(); + tessellator.draw(); + } + + private int getPingWidth(NetworkPlayerInfo networkPlayerInfoIn) { + if(!Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Ping Numbers").getValBoolean()) { + return 10; + } + int ping = 0; + EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(networkPlayerInfoIn.getGameProfile().getId()); + if(entityplayer == null || entityplayer != mc.thePlayer) { + ping = networkPlayerInfoIn.getResponseTime(); + } + + if(entityplayer != null && entityplayer == mc.thePlayer) { + ping = Client.getInstance().ping; + } + + return mc.fontRendererObj.getStringWidth(String.valueOf(ping)); + } + @Inject(method = "drawPing", at = @At("HEAD"), cancellable = true) public void numbersPing(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn, CallbackInfo ci) { if(Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Ping Numbers").getValBoolean()) { diff --git a/src/main/java/net/silentclient/client/mods/Mod.java b/src/main/java/net/silentclient/client/mods/Mod.java index daa4ba9..a6a33fa 100644 --- a/src/main/java/net/silentclient/client/mods/Mod.java +++ b/src/main/java/net/silentclient/client/mods/Mod.java @@ -75,7 +75,7 @@ public class Mod implements IMod { mc.renderGlobal.loadRenderers(); } if(setting.getName() == "Raw Mouse Input") { - RawInputHandler.toggleRawInput(setting.getValBoolean() ? "disable" : "enable"); + RawInputHandler.toggleRawInput(setting.getValBoolean()); } if(setting.getName() == "Menu Background Blur") { if(setting.getValBoolean()) { diff --git a/src/main/java/net/silentclient/client/mods/render/NewMotionBlurMod.java b/src/main/java/net/silentclient/client/mods/render/NewMotionBlurMod.java index 319f2f3..0d6bbc1 100644 --- a/src/main/java/net/silentclient/client/mods/render/NewMotionBlurMod.java +++ b/src/main/java/net/silentclient/client/mods/render/NewMotionBlurMod.java @@ -1,12 +1,10 @@ package net.silentclient.client.mods.render; -import java.lang.reflect.Field; - import net.minecraft.client.settings.GameSettings; -import net.silentclient.client.Client; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; -import net.silentclient.client.utils.NotificationUtils; + +import java.lang.reflect.Field; public class NewMotionBlurMod extends Mod { private Field cachedFastRender; diff --git a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java index 4d5a1f1..3c3a495 100644 --- a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java @@ -48,7 +48,7 @@ public class GeneralMod extends Mod { public void onChangeSettingValue(Setting setting) { switch(setting.getName()) { case "Raw Mouse Input": - RawInputHandler.toggleRawInput(setting.getValBoolean() ? "enable" : "disable"); + RawInputHandler.toggleRawInput(setting.getValBoolean()); break; case "Menu Background Blur": if(setting.getValBoolean()) { diff --git a/src/main/java/net/silentclient/client/premium/PremiumGui.java b/src/main/java/net/silentclient/client/premium/PremiumGui.java index abb8f35..2a2802e 100644 --- a/src/main/java/net/silentclient/client/premium/PremiumGui.java +++ b/src/main/java/net/silentclient/client/premium/PremiumGui.java @@ -32,35 +32,60 @@ import java.net.URI; import java.util.ArrayList; public class PremiumGui { - public static void drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { + public static MouseCursorHandler.CursorType drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { + MouseCursorHandler.CursorType cursorType = null; + if(!Client.getInstance().getAccount().isPlus()) { RenderUtil.drawImage(new ResourceLocation("silentclient/premium/promo.png"), x + 95, y + 40, width - 100, (int) ((width - 100) / 1.777777777777778)); StaticButton.render(x + 132, y + 148, 65, 12, "BUY PREMIUM"); StaticButton.render(x + 272, y + 148, 65, 12, "BUY PREMIUM+"); - return; + if(StaticButton.isHovered(mouseX, mouseY, x + 132, y + 148, 65, 12) || StaticButton.isHovered(mouseX, mouseY, x + 272, y + 148, 65, 12)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } + return cursorType; } int settingY = y + 25; int days = Client.getInstance().getAccount().getPlusExpiration(); Client.getInstance().getSilentFontRenderer().drawString(days != -1 ? days + " days left" : "Unknown Time Remaining", x + width - (Client.getInstance().getSilentFontRenderer().getStringWidth(days != -1 ? days + " days left" : "Unknown Time Remaining", 10, SilentFontRenderer.FontType.TITLE)) - 8, y + 8, 10, SilentFontRenderer.FontType.TITLE); ColorPicker.render(x, settingY, width, "Chroma Bandana Color", Client.getInstance().getAccount().getBandanaColor() == 50 ? ColorUtils.getChromaColor(0, 0, 1).getRGB() : Client.getInstance().getAccount().getBandanaColor()); + if(ColorPicker.isHovered(mouseX, mouseY, x, settingY, width)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } settingY += 15; Client.getInstance().getSilentFontRenderer().drawString("Custom Capes", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); StaticButton.render(x + 310, settingY, 65, 12, Client.getInstance().getAccount().isPremiumPlus() ? "OPEN MENU" : "BUY PREMIUM+"); - settingY += 15; + if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } + settingY += 15; if(Client.getInstance().getAccount().isPremiumPlus()) { ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); settingY += 15; Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Show Nametag Message", Client.getInstance().getAccount().showNametagMessage()); - settingY += 15; + if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } + settingY += 15; Client.getInstance().getSilentFontRenderer().drawString("Nametag Message:", x + 100, settingY + (1), 12, SilentFontRenderer.FontType.TITLE); input.render(mouseX, mouseY, x + 100 + ((190 * 2) - 108) / 2, settingY, ((190 * 2) - 108) / 2, true); - settingY += 20; + if(input.isHovered()) { + cursorType = MouseCursorHandler.CursorType.EDIT_TEXT; + } + settingY += 20; StaticButton.render(x + 322, settingY, 50, 12, "Save"); + if(StaticButton.isHovered(mouseX, mouseY, x + 322, settingY, 50, 12)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } } else { Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); StaticButton.render(x + 310, settingY, 65, 12, "BUY PREMIUM+"); - } + if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) { + cursorType = MouseCursorHandler.CursorType.POINTER; + } + } + + return cursorType; } public static void mouseClicked(int x, int y, int width, int height, int mouseX, int mouseY, int mouseButton, GuiScreen instance, Input input) { diff --git a/src/main/java/net/silentclient/client/utils/OptifinePatch.java b/src/main/java/net/silentclient/client/utils/OptifinePatch.java new file mode 100644 index 0000000..0590f2d --- /dev/null +++ b/src/main/java/net/silentclient/client/utils/OptifinePatch.java @@ -0,0 +1,39 @@ +package net.silentclient.client.utils; + +import net.minecraft.client.Minecraft; +import net.silentclient.client.Client; + +import java.io.File; +import java.io.FileInputStream; + +public class OptifinePatch { + public static final File optifineConfig = new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"); + public static boolean fastRenderEnabled = false; + public static boolean fastRenderPatched = false; + + public static void init() { + try { + if(optifineConfig.exists()) { + String ofConfig = FileUtils.readInputStream(new FileInputStream(optifineConfig)); + + if(ofConfig.contains("ofFastRender:true")) { + fastRenderEnabled = true; + } + } else { + fastRenderEnabled = true; + } + } catch (Exception err) { + Client.logger.catching(err); + } + } + + public static boolean needPatch() { + return fastRenderEnabled && !fastRenderPatched; + } + + public static void patch() { + Minecraft.getMinecraft().toggleFullscreen(); + Minecraft.getMinecraft().toggleFullscreen(); + fastRenderPatched = true; + } +} diff --git a/src/main/java/net/silentclient/client/utils/RawInputHandler.java b/src/main/java/net/silentclient/client/utils/RawInputHandler.java index d04a777..e1bc887 100644 --- a/src/main/java/net/silentclient/client/utils/RawInputHandler.java +++ b/src/main/java/net/silentclient/client/utils/RawInputHandler.java @@ -4,9 +4,7 @@ import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; import net.java.games.input.Mouse; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.util.MouseHelper; -import net.silentclient.client.Client; public class RawInputHandler { public static Controller[] controllers; @@ -16,7 +14,6 @@ public class RawInputHandler { public static void init() { controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); - startThread(); } public static void getMouse() { @@ -30,49 +27,37 @@ public class RawInputHandler { } } - public static void toggleRawInput(String mode) { - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - float saveYaw = player.rotationYaw; - float savePitch = player.rotationPitch; - - if (Minecraft.getMinecraft().mouseHelper instanceof RawMouseHelper && mode == "disable") { - Client.logger.info("[SC]: Disabling Raw Mouse Input"); - Minecraft.getMinecraft().mouseHelper = new MouseHelper(); - Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); - } else { - Client.logger.info("[SC]: Enabling Raw Mouse Input"); + public static void toggleRawInput(boolean enable) { + if(enable) { Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); - Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); + controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); + + Thread inputThread = new Thread(() -> { + while (true) { + RawInputHandler.getMouse(); + if (mouse != null) { + mouse.poll(); + + dx += (int) mouse.getX().getPollData(); + dy += (int) mouse.getY().getPollData(); + } else { + RawInputHandler.rescan(); + } + try { + Thread.sleep(1); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + inputThread.setName("inputThread"); + inputThread.start(); + } else { + Minecraft.getMinecraft().mouseHelper = new MouseHelper(); } - player.rotationYaw = saveYaw; - player.rotationPitch = savePitch; } public static void rescan() { RawInputHandler.getMouse(); } - - public static void startThread() { - Thread inputThread = new Thread(() -> { - while(true){ - if (mouse != null && Minecraft.getMinecraft().currentScreen == null) { - mouse.poll(); - dx += (int)mouse.getX().getPollData(); - dy += (int)mouse.getY().getPollData(); - } else if (mouse != null) { - mouse.poll(); - } else { - getMouse(); - } - - try { - Thread.sleep(1); - } catch(InterruptedException e) { - e.printStackTrace(); - } - } - }); - inputThread.setName("inputThread"); - inputThread.start(); - } } diff --git a/src/main/java/net/silentclient/client/utils/RawMouseHelper.java b/src/main/java/net/silentclient/client/utils/RawMouseHelper.java index 784ed68..81b6dcf 100644 --- a/src/main/java/net/silentclient/client/utils/RawMouseHelper.java +++ b/src/main/java/net/silentclient/client/utils/RawMouseHelper.java @@ -1,7 +1,5 @@ package net.silentclient.client.utils; -import org.lwjgl.input.Mouse; - import net.minecraft.util.MouseHelper; public class RawMouseHelper extends MouseHelper { @@ -13,14 +11,4 @@ public class RawMouseHelper extends MouseHelper { this.deltaY = -RawInputHandler.dy; RawInputHandler.dy = 0; } - @Override - public void grabMouseCursor() - { - if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; - Mouse.setGrabbed(true); - this.deltaX = 0; - RawInputHandler.dx = 0; - this.deltaY = 0; - RawInputHandler.dy = 0; - } }