Skip to content

Commit

Permalink
Big visual updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Mar 12, 2024
1 parent 44b65bd commit 18e8461
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 104 deletions.
56 changes: 13 additions & 43 deletions src/main/java/net/aspw/client/features/module/impl/visual/ESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
import net.aspw.client.features.module.impl.targets.AntiBots;
import net.aspw.client.features.module.impl.targets.AntiTeams;
import net.aspw.client.utils.EntityUtils;
import net.aspw.client.utils.render.BlendUtils;
import net.aspw.client.utils.render.RenderUtils;
import net.aspw.client.value.BoolValue;
import net.aspw.client.value.FloatValue;
import net.aspw.client.visual.font.smooth.FontLoaders;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.EntityRenderer;
Expand All @@ -30,7 +29,6 @@

import javax.vecmath.Vector3d;
import javax.vecmath.Vector4d;
import java.awt.*;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
Expand All @@ -41,22 +39,17 @@
@ModuleInfo(name = "ESP", category = ModuleCategory.VISUAL)
public final class ESP extends Module {
public static List collectedEntities = new ArrayList();
public final BoolValue tagsValue = new BoolValue("Tags", true);
public final BoolValue healthBar = new BoolValue("Health-Bar", true);
public final BoolValue localPlayer = new BoolValue("Local-Player", false);
private final FloatValue fontScaleValue = new FloatValue("Font-Scale", 1F, 0F, 1F, "x");
private final IntBuffer viewport;
private final FloatBuffer modelview;
private final FloatBuffer projection;
private final FloatBuffer vector;
private final int backgroundColor;

public ESP() {
this.viewport = GLAllocation.createDirectIntBuffer(16);
this.modelview = GLAllocation.createDirectFloatBuffer(16);
this.projection = GLAllocation.createDirectFloatBuffer(16);
this.vector = GLAllocation.createDirectFloatBuffer(4);
this.backgroundColor = new Color(0, 0, 0, 120).getRGB();
}

@Override
Expand All @@ -75,7 +68,6 @@ public void onRender2D(Render2DEvent event) {
GL11.glScaled(scaling, scaling, scaling);
RenderManager renderMng = mc.getRenderManager();
EntityRenderer entityRenderer = mc.entityRenderer;
boolean health = this.healthBar.get();
int i = 0;

for (int collectedEntitiesSize = collectedEntities.size(); i < collectedEntitiesSize; ++i) {
Expand Down Expand Up @@ -111,50 +103,28 @@ public void onRender2D(Render2DEvent event) {
double posX = position.x;
double posY = position.y;
double endPosX = position.z;
double endPosY = position.w;

boolean living = entity instanceof EntityLivingBase;
EntityLivingBase entityLivingBase;
float armorValue;
float itemDurability;
double durabilityWidth;
double textWidth;
if (living) {
entityLivingBase = (EntityLivingBase) entity;
if (health) {
armorValue = entityLivingBase.getHealth();
itemDurability = entityLivingBase.getMaxHealth();
if (armorValue > itemDurability)
armorValue = itemDurability;

durabilityWidth = armorValue / itemDurability;
textWidth = (endPosY - posY) * durabilityWidth;
RenderUtils.newDrawRect(posX - 3.5D, posY - 0.5D, posX - 1.5D, endPosY + 0.5D, this.backgroundColor);
if (armorValue > 0.0F) {
int healthColor = BlendUtils.getHealthColor(armorValue, itemDurability).getRGB();
RenderUtils.newDrawRect(posX - 3.0D, endPosY, posX - 2.0D, endPosY - textWidth, healthColor);
}
}
}

if (living && tagsValue.get()) {
if (living) {
final MurdererDetector murdererDetector = Objects.requireNonNull(Launch.moduleManager.getModule(MurdererDetector.class));
final AntiTeams antiTeams = Objects.requireNonNull(Launch.moduleManager.getModule(AntiTeams.class));
final AntiBots antiBots = Objects.requireNonNull(Launch.moduleManager.getModule(AntiBots.class));
entityLivingBase = (EntityLivingBase) entity;
String entName;
if (murdererDetector.getState() && (entity == murdererDetector.getMurderer1() || entity == murdererDetector.getMurderer2())) {
entName = "§c[Murderer] §7- §r" + entityLivingBase.getName();
entName = "§c[Murderer] §7- §r" + entityLivingBase.getDisplayName().getFormattedText();
} else if (EntityUtils.isFriend(entity)) {
entName = "§e[Friend] §7- §r" + entityLivingBase.getName();
entName = "§e[Friend] §7- §r" + entityLivingBase.getDisplayName().getFormattedText();
} else if (antiBots.getState() && AntiBots.isBot(entityLivingBase)) {
entName = "§c[Bot] §7- §r" + entityLivingBase.getName();
entName = "§c[Bot] §7- §r" + entityLivingBase.getDisplayName().getFormattedText();
} else if (antiTeams.getState() && antiTeams.isInYourTeam(entityLivingBase)) {
entName = "§e[Team] §7- §r" + entityLivingBase.getName();
entName = "§e[Team] §7- §r" + entityLivingBase.getDisplayName().getFormattedText();
} else {
entName = entityLivingBase.getName();
entName = entityLivingBase.getDisplayName().getFormattedText();
}
drawScaledCenteredString(entName, posX + (endPosX - posX) / 2F, posY - 1F - mc.fontRendererObj.FONT_HEIGHT * fontScaleValue.get(), fontScaleValue.get(), -1);
drawScaledCenteredString(entName, posX + (endPosX - posX) / 2F, posY - 1F - FontLoaders.SF21.getHeight() * 1F);
}
}
}
Expand All @@ -166,16 +136,16 @@ public void onRender2D(Render2DEvent event) {
entityRenderer.setupOverlayRendering();
}

private void drawScaledString(String text, double x, double y, double scale, int color) {
private void drawScaledString(String text, double x, double y) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, x);
GlStateManager.scale(scale, scale, scale);
mc.fontRendererObj.drawStringWithShadow(text, 0, 0, color);
GlStateManager.scale(1.0, 1.0, 1.0);
FontLoaders.SF21.drawStringWithShadow(text, 0, 0, -1);
GlStateManager.popMatrix();
}

private void drawScaledCenteredString(String text, double x, double y, double scale, int color) {
drawScaledString(text, x - mc.fontRendererObj.getStringWidth(text) / 2F * scale, y, scale, color);
private void drawScaledCenteredString(String text, double x, double y) {
drawScaledString(text, x - FontLoaders.SF21.getStringWidth(text) / 2F * 1.0, y);
}

private void collectEntities() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import net.aspw.client.features.module.ModuleInfo
import net.aspw.client.features.module.impl.combat.KillAura
import net.aspw.client.features.module.impl.combat.KillAuraRecode
import net.aspw.client.features.module.impl.combat.TPAura
import net.aspw.client.protocol.ProtocolBase
import net.aspw.client.utils.Access
import net.aspw.client.utils.AnimationUtils
import net.aspw.client.utils.CooldownHelper
import net.aspw.client.utils.render.ColorUtils
import net.aspw.client.utils.render.RenderUtils
import net.aspw.client.value.BoolValue
Expand All @@ -26,14 +28,18 @@ import net.aspw.client.visual.client.clickgui.tab.NewUi
import net.aspw.client.visual.font.semi.Fonts
import net.aspw.client.visual.font.smooth.FontLoaders
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Gui
import net.minecraft.client.gui.GuiChat
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.gui.inventory.GuiInventory
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.OpenGlHelper
import net.minecraft.network.play.client.C14PacketTabComplete
import net.minecraft.network.play.server.S2EPacketCloseWindow
import net.minecraft.network.play.server.S3APacketTabComplete
import net.minecraft.network.play.server.S45PacketTitle
import net.minecraft.util.ResourceLocation
import org.lwjgl.opengl.GL11.*
import java.awt.Color
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
Expand All @@ -45,18 +51,20 @@ import kotlin.math.pow
class Interface : Module() {
private val watermarkValue = BoolValue("WaterMark", true)
private val clientNameValue = TextValue("ClientName", "NightX") { watermarkValue.get() }
private val watermarkFpsValue = BoolValue("WaterMark-ShowFPS", true)
private val watermarkPacketsValue = BoolValue("WaterMark-ShowPackets", true)
private val watermarkFpsValue = BoolValue("WaterMark-ShowFPS", true) { watermarkValue.get() }
private val watermarkProtocolValue = BoolValue("WaterMark-ShowProtocol", true) { watermarkValue.get() }
private val arrayListValue = BoolValue("ArrayList", true)
private val arrayListSpeedValue = FloatValue("ArrayList-AnimationSpeed", 0.3F, 0F, 0.6F) { arrayListValue.get() }
private val targetHudValue = BoolValue("TargetHud", true)
private val targetHudSpeedValue = FloatValue("TargetHud-AnimationSpeed", 3F, 0F, 6F) { targetHudValue.get() }
private val targetHudXPosValue = FloatValue("TargetHud-XPos", 0F, -300F, 300F) { targetHudValue.get() }
private val targetHudYPosValue = FloatValue("TargetHud-YPos", 0F, -300F, 300F) { targetHudValue.get() }
private val informationValue = BoolValue("Information", true)
private val cooldownValue = BoolValue("Cooldown", true)
val noAchievement = BoolValue("No-Achievements", true)
val nof5crossHair = BoolValue("NoF5-Crosshair", true)
val tpDebugValue = BoolValue("TP-Debug", false)
val animHotbarValue = BoolValue("Hotbar-Animation", false)
val animHotbarValue = BoolValue("Hotbar-Animations", false)
private val animHotbarSpeedValue = FloatValue("Hotbar-AnimationSpeed", 0.03F, 0.01F, 0.2F) { animHotbarValue.get() }
val blackHotbarValue = BoolValue("Black-Hotbar", false)
private val noInvClose = BoolValue("NoInvClose", true)
Expand All @@ -65,7 +73,7 @@ class Interface : Module() {
val customFov = BoolValue("CustomFov", false)
val customFovModifier = FloatValue("Fov", 1.4F, 1F, 1.8F) { customFov.get() }
val chatRectValue = BoolValue("ChatRect", true)
val chatAnimationValue = BoolValue("Chat-Animation", false)
val chatAnimationValue = BoolValue("Chat-Animations", true)
val chatAnimationSpeedValue = FloatValue("Chat-AnimationSpeed", 0.06F, 0.01F, 0.5F) { chatAnimationValue.get() }
private val toggleMessageValue = BoolValue("Toggle-Notification", false)
private val toggleSoundValue = ListValue("Toggle-Sound", arrayOf("None", "Default", "Custom"), "None")
Expand All @@ -85,15 +93,15 @@ class Interface : Module() {
val inputString = clientNameValue.get()
val connectChecks = if (!Access.canConnect) " - Disconnected" else ""
val fpsChecks = if (watermarkFpsValue.get()) " [" + Minecraft.getDebugFPS() + " FPS]" else ""
val packetChecks =
if (watermarkPacketsValue.get()) " [Packets Sent: " + PacketManager.sendPacketCounts + "] [Packets Received: " + PacketManager.receivePacketCounts + "]" else ""
val protocolChecks =
if (watermarkProtocolValue.get()) " [version: " + ProtocolBase.getManager().targetVersion.getName() + "]" else ""
var firstChar = ""
var restOfString = ""
if (inputString != "") {
firstChar = inputString[0].toString()
restOfString = inputString.substring(1)
}
val showName = "$firstChar§r§f$restOfString$fpsChecks$packetChecks$connectChecks"
val showName = "$firstChar§r§f$restOfString$fpsChecks$protocolChecks$connectChecks"
fontRenderer.drawStringWithShadow(
showName,
2.0,
Expand Down Expand Up @@ -157,8 +165,8 @@ class Interface : Module() {
}

if (targetHudValue.get()) {
val xPos = targetHudXPosValue.get() + 200F
val yPos = targetHudYPosValue.get() + 170F
val xPos = (ScaledResolution(mc).scaledWidth / 2) - 54f + targetHudXPosValue.get()
val yPos = (ScaledResolution(mc).scaledHeight / 2) + 10f + targetHudYPosValue.get()
val font = Fonts.minecraftFont
val killAura = Launch.moduleManager.getModule(KillAura::class.java)
val tpAura = Launch.moduleManager.getModule(TPAura::class.java)
Expand All @@ -174,7 +182,7 @@ class Interface : Module() {
updateAnim(entity.health)

if (entity != mc.thePlayer || entity == mc.thePlayer && mc.currentScreen is GuiChat) {
RenderUtils.drawRect(xPos + 33F, yPos + 1F, xPos + 114F, yPos + 39.5F, Color(0, 0, 0, 120).rgb)
RenderUtils.drawRect(xPos - 3F, yPos + 1F, xPos + 114F, yPos + 39.5F, Color(0, 0, 0, 120).rgb)

var healthColor = 91
repeat(8) {
Expand All @@ -197,6 +205,12 @@ class Interface : Module() {
).rgb
)

RenderUtils.newDrawRect(xPos - 1, yPos + 3, xPos + 33F, yPos + 37F, Color(150, 150, 150).rgb)
RenderUtils.newDrawRect(xPos - 1, yPos + 3, xPos + 33F, yPos + 37F, Color(0, 0, 0).rgb)

if (mc.netHandler.getPlayerInfo(entity.uniqueID) != null)
drawHead(mc.netHandler.getPlayerInfo(entity.uniqueID).locationSkin, xPos.toInt(), yPos.toInt() + 4)

updateAnim(entity.health)

font.drawStringWithShadow(entity.name, xPos + 36F, yPos + 4F, Color(255, 255, 255).rgb)
Expand All @@ -219,6 +233,50 @@ class Interface : Module() {
)
} else if (easingHealth != 0F) easingHealth = 0F
}

if (informationValue.get()) {
val xPos = ScaledResolution(mc).scaledWidth
val yPos = ScaledResolution(mc).scaledHeight

fontRenderer.drawStringWithShadow(
"Ping: " + mc.netHandler.getPlayerInfo(mc.thePlayer.uniqueID).responseTime + "ms",
(xPos - 4f - fontRenderer.getStringWidth("Ping: " + mc.netHandler.getPlayerInfo(mc.thePlayer.uniqueID).responseTime + "ms")).toDouble(),
(yPos - 34f).toDouble(),
Color.WHITE.rgb
)
fontRenderer.drawStringWithShadow(
"Packets Sent: " + PacketManager.sendPacketCounts,
(xPos - 4f - fontRenderer.getStringWidth("Packets Sent: " + PacketManager.sendPacketCounts)).toDouble(),
(yPos - 23f).toDouble(),
Color.WHITE.rgb
)
fontRenderer.drawStringWithShadow(
"Packets Received: " + PacketManager.receivePacketCounts,
(xPos - 4f - fontRenderer.getStringWidth("Packets Received: " + PacketManager.receivePacketCounts)).toDouble(),
(yPos - 12f).toDouble(),
Color.WHITE.rgb
)
}

if (cooldownValue.get()) {
val xPos = (ScaledResolution(mc).scaledWidth / 2f) - 130f
val yPos = ScaledResolution(mc).scaledHeight
val progress = CooldownHelper.getAttackCooldownProgress()

RenderUtils.newDrawRect(xPos - 26f, yPos - 13f, xPos + 26f, yPos - 8f, Color(150, 150, 150).rgb)
RenderUtils.newDrawRect(xPos - 26f, yPos - 13f, xPos + 26f, yPos - 8f, Color(0, 0, 0).rgb)

if (progress < 1.0 && !mc.isIntegratedServerRunning) {
RenderUtils.drawRect(xPos - 25f, yPos - 12f, xPos + 25f, yPos - 9f, Color(0, 0, 0, 150).rgb)
RenderUtils.drawRect(
xPos - 25f,
yPos - 12f,
xPos + 25f - 50f * progress.toFloat(),
yPos - 9f,
Color(255, 255, 255, 200).rgb
)
} else RenderUtils.drawRect(xPos - 25f, yPos - 12f, xPos + 25f, yPos - 9f, Color(255, 255, 255, 200).rgb)
}
}

@EventTarget
Expand Down Expand Up @@ -249,6 +307,22 @@ class Interface : Module() {
Launch.moduleManager.toggleVolume = 83f
}

private fun drawHead(skin: ResourceLocation, x: Int = 2, y: Int = 2) {
glDisable(GL_DEPTH_TEST)
glEnable(GL_BLEND)
glDepthMask(false)
OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO)
glColor4f(1.0F, 1.0F, 1.0F, 1.0F)
mc.textureManager.bindTexture(skin)
Gui.drawScaledCustomSizeModalRect(
x, y, 8F, 8F, 8, 8, 32, 32,
64F, 64F
)
glDepthMask(true)
glDisable(GL_BLEND)
glEnable(GL_DEPTH_TEST)
}

private fun updateAnim(targetHealth: Float) {
easingHealth += ((targetHealth - easingHealth) / 2.0F.pow(10.0F - targetHudSpeedValue.get())) * RenderUtils.deltaTime
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ private void injectCooldown(final CallbackInfo callbackInfo) {
CooldownHelper.INSTANCE.incrementLastAttackedTicks();
CooldownHelper.INSTANCE.updateGenericAttackSpeed(getHeldItem());

if (cooldownStackSlot != inventory.currentItem || !ItemStack.areItemStacksEqual(cooldownStack, getHeldItem())) {
if (cooldownStackSlot != inventory.currentItem)
CooldownHelper.INSTANCE.resetLastAttackedTicks();
}

cooldownStack = getHeldItem();
cooldownStackSlot = inventory.currentItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.aspw.client.Launch;
import net.aspw.client.event.AttackEvent;
import net.aspw.client.event.ClickWindowEvent;
import net.aspw.client.utils.CooldownHelper;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -26,7 +25,6 @@ private void attackEntity(EntityPlayer entityPlayer, Entity targetEntity, Callba
return;

Launch.eventManager.callEvent(new AttackEvent(targetEntity));
CooldownHelper.INSTANCE.resetLastAttackedTicks();
}

@Inject(method = "windowClick", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private void drawScreen(CallbackInfo callbackInfo) {
Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d" + version.getName(), 6f, 16f, 0xffffff);
else Fonts.minecraftFont.drawStringWithShadow("§7Protocol: §d1.8.x", 6f, 16f, 0xffffff);

Fonts.minecraftFont.drawStringWithShadow("§7Packets Sent: §d" + PacketManager.sendPacketCounts, 6f, 26f, 0xffffff);
Fonts.minecraftFont.drawStringWithShadow("§7Packets Received: §d" + PacketManager.receivePacketCounts, 6f, 36f, 0xffffff);
Fonts.minecraftFont.drawStringWithShadow("§7Ping: §d" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms", 6f, 26f, 0xffffff);

Fonts.minecraftFont.drawStringWithShadow("§7Packets Sent: §d" + PacketManager.sendPacketCounts, 6f, 36f, 0xffffff);
Fonts.minecraftFont.drawStringWithShadow("§7Packets Received: §d" + PacketManager.receivePacketCounts, 6f, 46f, 0xffffff);
}
}
Loading

0 comments on commit 18e8461

Please sign in to comment.