Skip to content

Commit

Permalink
performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Sep 9, 2023
1 parent abef08a commit 3c987eb
Show file tree
Hide file tree
Showing 65 changed files with 1,588 additions and 831 deletions.
93 changes: 78 additions & 15 deletions NightX.iws

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions src/main/java/net/aspw/client/features/api/PacketManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
import net.aspw.client.features.module.impl.other.ClientSpoof;
import net.aspw.client.features.module.impl.visual.Animations;
import net.aspw.client.features.module.impl.visual.Cape;
import net.aspw.client.util.EntityUtils;
import net.aspw.client.util.MinecraftInstance;
import net.aspw.client.util.PacketUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.*;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C0APacketAnimation;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;

import java.util.Objects;

Expand Down Expand Up @@ -58,6 +60,25 @@ public void onMotion(MotionEvent event) {
}
if (GameSettings.isKeyDown(mc.gameSettings.keyBindDrop) && mc.thePlayer.getHeldItem() != null && mc.currentScreen == null)
mc.thePlayer.isSwingInProgress = true;
for (Object en : mc.theWorld.loadedEntityList) {
Entity entity = (Entity) en;
if (shouldStopRender(entity)) {
entity.renderDistanceWeight = 0.0;
} else {
entity.renderDistanceWeight = 1.0;
}
}
}

public static boolean shouldStopRender(Entity entity) {
return (EntityUtils.isMob(entity) ||
EntityUtils.isAnimal(entity) ||
entity instanceof EntityBoat ||
entity instanceof EntityMinecart ||
entity instanceof EntityItemFrame ||
entity instanceof EntityTNTPrimed ||
entity instanceof EntityArmorStand) &&
entity != mc.thePlayer && mc.thePlayer.getDistanceToEntity(entity) > 40.0f;
}

@EventTarget
Expand All @@ -67,8 +88,6 @@ public void onPacket(PacketEvent event) {
final KillAura killAura = Objects.requireNonNull(Client.moduleManager.getModule(KillAura.class));

if (!Minecraft.getMinecraft().isIntegratedServerRunning()) {
if (Objects.requireNonNull(clientSpoof).blockModsCheck.get() && packet instanceof FMLProxyPacket)
event.cancelEvent();
if (packet instanceof C17PacketCustomPayload) {
if (((C17PacketCustomPayload) event.getPacket()).getChannelName().equalsIgnoreCase("MC|Brand")) {
if (Objects.requireNonNull(clientSpoof).modeValue.get().equals("Vanilla"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.element.elements.Notification

class ClipCommand : Command("clip", emptyArray()) {
Expand All @@ -15,7 +15,7 @@ class ClipCommand : Command("clip", emptyArray()) {
val y = args[1].toDouble()
val entity = if (mc.thePlayer.isRiding) mc.thePlayer.ridingEntity else mc.thePlayer

if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
entity.setPosition(entity.posX, entity.posY + y, entity.posZ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.util.SettingsUtils
import net.aspw.client.util.misc.MiscUtils
import net.aspw.client.util.misc.StringUtils
Expand All @@ -26,7 +26,7 @@ class ConfigCommand : Command("config", arrayOf("c")) {
try {
val settings = scriptFile.readText()
SettingsUtils.executeScript(settings)
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Config updated successfully!")
Expand Down Expand Up @@ -70,7 +70,7 @@ class ConfigCommand : Command("config", arrayOf("c")) {
}
val settingsScript = SettingsUtils.generateScript(values, binds, states)
scriptFile.writeText(settingsScript)
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§aSuccessfully saved new config!")
Expand All @@ -94,7 +94,7 @@ class ConfigCommand : Command("config", arrayOf("c")) {

if (scriptFile.exists()) {
scriptFile.delete()
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Config deleted successfully!")
Expand Down Expand Up @@ -144,7 +144,7 @@ class ConfigCommand : Command("config", arrayOf("c")) {
}
val settingsScript = SettingsUtils.generateScript(values, binds, states)
scriptFile.writeText(settingsScript)
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Config fixed successfully!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.element.elements.Notification
import java.awt.Toolkit
import java.awt.datatransfer.StringSelection
Expand All @@ -14,7 +14,7 @@ class IgnCommand : Command("ign", emptyArray()) {
override fun execute(args: Array<String>) {
val username = mc.thePlayer.name

if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Client.hud.addNotification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.element.elements.Notification

class LoginCommand : Command("login", arrayOf("l")) {
/**
* Execute commands with provided [args]
*/
override fun execute(args: Array<String>) {
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
mc.thePlayer.sendChatMessage("/login rrrrr")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.element.elements.Notification

class MagicTrickCommand : Command("magictrick", arrayOf("mt")) {
Expand All @@ -21,7 +21,7 @@ class MagicTrickCommand : Command("magictrick", arrayOf("mt")) {
mc.thePlayer.sendChatMessage("!助けてー!集団ストーカーに襲われてまーす!だから照らすなっつっとるだろうが糞が!無事に返してもるぁいました~アップロードしま~す。あれぇ、あれぇ!?(涙)")
mc.thePlayer.sendChatMessage("!ちょっとした観光地になっとるんですここが。どぅーらちょっと見せてみろ酒ぇ。何やってんだ一体!挟むやつ壊れるだろ!ライトテラシー!テラテラ!")
mc.thePlayer.sendChatMessage("!動画をとにかくやめる、動画。さすればそういうことにならん!だからもうインターネット切る、切らないかんな!来訪者止まらんぞこれ、やめやめやめなさいって言ってんの!")
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Client.hud.addNotification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package net.aspw.client.features.command.impl
import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.exploit.Plugins
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface

class PluginsCommand : Command("plugins", arrayOf("pl")) {
/**
* Execute commands with provided [args]
*/
override fun execute(args: Array<String>) {
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Client.moduleManager.getModule(Plugins::class.java)?.state = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.element.elements.Notification

class RegisterCommand : Command("register", arrayOf("r")) {
/**
* Execute commands with provided [args]
*/
override fun execute(args: Array<String>) {
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
mc.thePlayer.sendChatMessage("/register rrrrr rrrrr")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net.aspw.client.Client
import net.aspw.client.features.api.CombatManager
import net.aspw.client.features.command.Command
import net.aspw.client.features.command.CommandManager
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.util.misc.sound.TipSoundManager
import net.aspw.client.visual.client.clickgui.dropdown.ClickGui
import net.aspw.client.visual.client.clickgui.tab.NewUi
Expand All @@ -30,7 +30,7 @@ class ReloadCommand : Command("reload", emptyArray()) {
Client.fileManager.loadConfig(Client.fileManager.friendsConfig)
Client.clickGui = ClickGui()
NewUi.resetInstance()
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("Reloaded!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net.aspw.client.Client
import net.aspw.client.event.EventTarget
import net.aspw.client.event.PacketEvent
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.minecraft.network.play.client.C0BPacketEntityAction

class RemoteViewCommand : Command("remoteview", arrayOf("rv")) {
Expand All @@ -26,7 +26,7 @@ class RemoteViewCommand : Command("remoteview", arrayOf("rv")) {
for (entity in mc.theWorld.loadedEntityList) {
if (targetName == entity.name) {
mc.renderViewEntity = entity
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("Now viewing perspective of §8${entity.name}§3.")
Expand All @@ -39,7 +39,7 @@ class RemoteViewCommand : Command("remoteview", arrayOf("rv")) {
@EventTarget
fun onPacket(event: PacketEvent) {
val packet = event.packet
if (packet is C0BPacketEntityAction && (packet.action == C0BPacketEntityAction.Action.STOP_SPRINTING || packet.action == C0BPacketEntityAction.Action.START_SPRINTING)) {
if (packet is C0BPacketEntityAction) {
event.cancelEvent()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.util.misc.StringUtils
import net.aspw.client.visual.hud.element.elements.Notification

Expand All @@ -16,7 +16,7 @@ class RepeatCommand : Command("repeat", arrayOf("rp")) {
val amount = args[1].toInt()
for (cnt in 1..amount)
mc.thePlayer.sendChatMessage(StringUtils.toCompleteString(args, 2))
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Client.hud.addNotification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.util.misc.MiscUtils
import net.aspw.client.visual.hud.element.elements.Notification

Expand All @@ -15,7 +15,7 @@ class SkinStealerCommand : Command("skinstealer", arrayOf("steal")) {
try {
val amount = args[1]
MiscUtils.showURL("https://minecraft.tools/download-skin/" + amount)
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Client.hud.addNotification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package net.aspw.client.features.command.impl
import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.targets.AntiBots
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.util.PacketUtils
import net.aspw.client.util.pathfinder.MainPathFinder
import net.aspw.client.util.pathfinder.Vec3
Expand All @@ -26,7 +26,7 @@ class TeleportCommand : Command("tp", arrayOf("teleport")) {

// Attempt to teleport to player's position.
if (targetPlayer != null) {
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Thread {
Expand Down Expand Up @@ -69,7 +69,7 @@ class TeleportCommand : Command("tp", arrayOf("teleport")) {
val posX = if (args[1].equals("~", true)) mc.thePlayer.posX else args[1].toDouble()
val posY = if (args[2].equals("~", true)) mc.thePlayer.posY else args[2].toDouble()
val posZ = if (args[3].equals("~", true)) mc.thePlayer.posZ else args[3].toDouble()
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
Thread {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.aspw.client.features.command.impl

import net.aspw.client.Client
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Hud
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.visual.hud.Config
import net.aspw.client.visual.hud.element.elements.Notification
import java.io.File
Expand All @@ -24,7 +24,7 @@ class ThemeCommand : Command("theme", emptyArray()) {
Client.isStarting = true
Client.hud.clearElements()
Client.isStarting = false
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Theme updated successfully!")
Expand Down Expand Up @@ -57,7 +57,7 @@ class ThemeCommand : Command("theme", emptyArray()) {

val settingsTheme = Config(Client.hud).toJson()
themeFile.writeText(settingsTheme)
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Successfully saved new theme!")
Expand All @@ -82,7 +82,7 @@ class ThemeCommand : Command("theme", emptyArray()) {

if (themeFile.exists()) {
themeFile.delete()
if (Client.moduleManager.getModule(Hud::class.java)?.flagSoundValue!!.get()) {
if (Client.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Client.tipSoundManager.popSound.asyncPlay(Client.moduleManager.popSoundPower)
}
chat("§6Theme deleted successfully!")
Expand Down
Loading

0 comments on commit 3c987eb

Please sign in to comment.