Skip to content

Commit

Permalink
Fully Fixed API Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Apr 1, 2024
1 parent 21e6169 commit 239152e
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 87 deletions.
5 changes: 2 additions & 3 deletions src/main/java/net/aspw/client/Launch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import net.aspw.client.protocol.ProtocolMod
import net.aspw.client.utils.*
import net.aspw.client.utils.ClassUtils.hasForge
import net.aspw.client.utils.misc.sound.TipSoundManager
import net.aspw.client.utils.APIConnecter
import net.aspw.client.visual.client.clickgui.dropdown.ClickGui
import net.aspw.client.visual.font.semi.Fonts

Expand All @@ -31,9 +30,9 @@ object Launch {
// Client information
const val CLIENT_BEST = "NightX"
const val CLIENT_FOLDER = "NightX-Client"
const val CLIENT_VERSION = "B102"
const val CLIENT_PROTOCOL_RANGE = "1.8 to 1.20.5"
const val CLIENT_VERSION = "B103"
const val CLIENT_CHAT = "§c$CLIENT_BEST: §r"
const val CLIENT_PROTOCOL_RANGE = "1.8 to 1.20.5"

var isStarting = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void onUpdate(UpdateEvent event) {

@EventTarget
public void onRender3D(Render3DEvent event) {
if (RotationUtils.targetRotation != null) {
if (RotationUtils.targetRotation != null && Objects.requireNonNull(Launch.moduleManager.getModule(SilentRotations.class)).getState()) {
if (Objects.requireNonNull(Launch.moduleManager.getModule(SilentRotations.class)).getBodyTweaks().get()) {
mc.thePlayer.renderYawOffset = RotationUtils.targetRotation.getYaw();
mc.thePlayer.rotationYawHead = RotationUtils.targetRotation.getYaw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import net.aspw.client.Launch
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.utils.APIConnecter
import net.aspw.client.utils.ClientUtils
import net.aspw.client.utils.SettingsUtils
import net.aspw.client.utils.URLComponent
import net.aspw.client.utils.misc.StringUtils
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils
import java.awt.Desktop
import java.io.File
import java.io.IOException
Expand Down Expand Up @@ -172,8 +168,8 @@ class ConfigCommand : Command("config", arrayOf("c")) {

args[1].equals("onlinelist", ignoreCase = true) -> {
try {
chat("§cOnlineConfigs:")
chat(APIConnecter.configList())
chat("§cOnline Configs:")
ClientUtils.displayChatMessage(APIConnecter.configList())
} catch (e: Exception) {
chat("§cAPI Error!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Criticals : Module() {

@EventTarget
fun onAttack(event: AttackEvent) {
if (onlyAuraValue.get() && !Launch.moduleManager[KillAura::class.java]!!.state && !Launch.moduleManager[TPAura::class.java]!!.state) return
if (onlyAuraValue.get() && !Launch.moduleManager[KillAura::class.java]!!.state || Launch.moduleManager[TPAura::class.java]!!.state) return

if (event.targetEntity is EntityLivingBase) {
val entity = event.targetEntity
Expand Down Expand Up @@ -241,7 +241,7 @@ class Criticals : Module() {

@EventTarget
fun onPacket(event: PacketEvent) {
if (onlyAuraValue.get() && !Launch.moduleManager[KillAura::class.java]!!.state) return
if (onlyAuraValue.get() && !Launch.moduleManager[KillAura::class.java]!!.state || Launch.moduleManager[TPAura::class.java]!!.state) return

val packet = event.packet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ import net.minecraft.init.Items
import net.minecraft.item.ItemSword
import net.minecraft.network.Packet
import net.minecraft.network.PacketBuffer
import net.minecraft.network.play.INetHandlerPlayClient
import net.minecraft.network.play.INetHandlerPlayServer
import net.minecraft.network.play.client.*
import net.minecraft.network.play.client.C03PacketPlayer.*
import net.minecraft.network.play.server.S07PacketRespawn
import net.minecraft.network.play.server.S08PacketPlayerPosLook
import net.minecraft.network.play.server.S3EPacketTeams
import net.minecraft.network.play.server.S42PacketCombatEvent
import net.minecraft.network.play.server.*
import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
import java.awt.Color
Expand All @@ -57,6 +55,7 @@ class Disabler : Module() {
private val funcraftstaff = BoolValue("Funcraft-Staff", false)
private val blockdrop = BoolValue("BlockDrop", false)
private val grim = BoolValue("Grim", false)
private val grimspectate = BoolValue("GrimSpectate", false)
private val hycraft = BoolValue("Hycraft", false)
private val inventoryspoof = BoolValue("Inventory-Spoof", false)
private val jump = BoolValue("Jump", false)
Expand Down Expand Up @@ -188,6 +187,8 @@ class Disabler : Module() {
private var canBlink = true
private var lockRotation: Rotation? = null
private var disabling = false
private var shouldDelay = false
private val packetz = LinkedBlockingQueue<Packet<INetHandlerPlayClient>>()

// debug
private val debugValue = BoolValue("Debug", false)
Expand Down Expand Up @@ -318,6 +319,7 @@ class Disabler : Module() {
}

override fun onDisable() {
shouldDelay = false
flagged = false
pre = false
pendingFlagApplyPacket = false
Expand All @@ -327,7 +329,9 @@ class Disabler : Module() {
transactions.forEach {
PacketUtils.sendPacketNoEvent(it)
}

while (!packetz.isEmpty()) {
PacketUtils.handlePacket(packets.take() as Packet<INetHandlerPlayClient?>)
}
disabling = false
packetBuffer.clear()
keepAlives.clear()
Expand Down Expand Up @@ -574,6 +578,20 @@ class Disabler : Module() {
}
}

if (grimspectate.get()) {
if (packet is S08PacketPlayerPosLook) {
if (mc.thePlayer.capabilities.isFlying) {
shouldDelay = true
debug("Start")
}
}

if (packet is S32PacketConfirmTransaction && shouldDelay) {
event.cancelEvent()
packetz.add(packet as Packet<INetHandlerPlayClient>)
}
}

if (grim.get()) {
if (packet is C0EPacketClickWindow && c0e.get()) {
if (!pre) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ class Jesus : Module() {
arrayOf(
"Vanilla",
"NCP",
"Bounce",
"Vulcan",
"Verus",
"AAC",
"AACFly",
"AAC3.3.11",
"AAC4.2.1",
"Bounce",
"Twillight",
"MatrixFast",
"MatrixDolphin",
"Dolphin",
"Swim",
"Vulcan",
"Verus"
"Swim"
),
"NCP"
"Vanilla"
)
private val aacFlyValue = FloatValue("Motion", 0.5f, 0.1f, 1f) { modeValue.get() == "AACFly" }
private var nextTick = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ class Annoy : Module() {

"spin" -> {
yaw += spinSpeed.get()
if (yaw > 175.0f) {
yaw = -180.0f
} else if (yaw < -175.0f) {
yaw = 180.0f
}
}

"jitter" -> {
Expand All @@ -71,10 +66,10 @@ class Annoy : Module() {

"jitter" -> {
pitch += 30.0f
if (pitch > 90.0f) {
pitch = -90.0f
} else if (pitch < -90.0f) {
pitch = 90.0f
if (pitch > 80.0f) {
pitch = -80.0f
} else if (pitch < -80.0f) {
pitch = 80.0f
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ private void drawScaledCenteredString(String text, double x, double y) {
drawScaledString(text, x - FontLoaders.SF21.getStringWidth(text) / 2F * 1.0, y);
}

public static boolean shouldCancelNameTag(EntityLivingBase entity) {
return Objects.requireNonNull(Launch.moduleManager.getModule(ESP.class)).getState() && collectedEntities.contains(entity);
}

private void collectEntities() {
collectedEntities.clear();
List<Entity> playerEntities = mc.theWorld.loadedEntityList;
Expand All @@ -161,7 +165,6 @@ private void collectEntities() {
collectedEntities.add(entity);
}
}

}

private Vector3d project2D(int scaleFactor, double x, double y, double z) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void startGame(CallbackInfo callbackInfo) {

@ModifyArg(method = "createDisplay", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V", remap = false))
private String setTitle(String newTitle) {
return Launch.CLIENT_BEST + " Client 1.8.9";
return Launch.CLIENT_BEST + " Client 1.8.x";
}

@Inject(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public void renderItemInFirstPerson(final float partialTicks) {
GL11.glTranslated(Animations.blockPosX.get().doubleValue() - 0.01, Animations.blockPosY.get().doubleValue() - 0.07, Animations.blockPosZ.get().doubleValue() - 0.24);
if (Animations.cancelEquip.get())
this.transformFirstPersonItem(0.0F, f1);
else this.transformFirstPersonItem(f / 1.2f, f1);
else this.transformFirstPersonItem(f, f1);
this.doBlockTransformations();
GlStateManager.scale(Animations.scale.get() + 1, Animations.scale.get() + 1, Animations.scale.get() + 1);
break;
Expand Down Expand Up @@ -674,7 +674,7 @@ public void renderItemInFirstPerson(final float partialTicks) {
GL11.glTranslated(Animations.blockPosX.get().doubleValue(), Animations.blockPosY.get().doubleValue(), Animations.blockPosZ.get().doubleValue());
if (Animations.cancelEquip.get())
this.transformFirstPersonItem(0.0F, f1);
else this.transformFirstPersonItem(f / 1.2f, f1);
else this.transformFirstPersonItem(f, f1);
this.doBlockTransformations();
GlStateManager.scale(Animations.scale.get() + 1, Animations.scale.get() + 1, Animations.scale.get() + 1);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.aspw.client.injection.forge.mixins.render;

import net.aspw.client.utils.RotationUtils;
import net.minecraft.client.renderer.entity.RenderManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import static org.objectweb.asm.Opcodes.PUTFIELD;

@Mixin(RenderManager.class)
public class MixinRenderManager {

@Redirect(method = "cacheActiveRenderInfo", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/RenderManager;playerViewX:F", opcode = PUTFIELD))
public void getPlayerViewX(RenderManager renderManager, float value) {
renderManager.playerViewX = RotationUtils.perspectiveToggled ? RotationUtils.cameraPitch : value;
}

@Redirect(method = "cacheActiveRenderInfo", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/RenderManager;playerViewY:F", opcode = PUTFIELD))
public void getPlayerViewY(RenderManager renderManager, float value) {
renderManager.playerViewY = RotationUtils.perspectiveToggled ? RotationUtils.cameraYaw : value;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package net.aspw.client.injection.forge.mixins.render;

import net.aspw.client.Launch;
import net.aspw.client.features.api.PacketManager;
import net.aspw.client.features.module.impl.visual.ESP;
import net.aspw.client.utils.MinecraftInstance;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -20,8 +18,6 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Objects;

/**
* The type Mixin renderer living entity.
*/
Expand Down Expand Up @@ -165,7 +161,7 @@ private <T extends EntityLivingBase> void injectChamsPre(T entity, double x, dou

@Inject(method = "canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z", at = @At("HEAD"), cancellable = true)
private <T extends EntityLivingBase> void canRenderName(T entity, CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
if (Objects.requireNonNull(Launch.moduleManager.getModule(ESP.class)).getState() && entity instanceof EntityPlayer)
if (ESP.shouldCancelNameTag(entity))
callbackInfoReturnable.setReturnValue(false);
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/aspw/client/protocol/api/ProtocolSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.realmsclient.gui.ChatFormatting;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.aspw.client.protocol.ProtocolBase;
import net.aspw.client.visual.font.smooth.FontLoaders;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
Expand Down Expand Up @@ -33,9 +34,9 @@ public ProtocolSelector(final GuiScreen parent, final boolean simple, final Fini
@Override
public void initGui() {
super.initGui();
buttonList.add(new GuiButton(1, 5, height - 25, 20, 20, "<-"));
buttonList.add(new GuiButton(1, 5, height - 25, 60, 20, "Done"));

list = new SlotList(mc, width, height, -26 + (fontRendererObj.FONT_HEIGHT) * 3 /* title is 2 */, height, fontRendererObj.FONT_HEIGHT);
list = new SlotList(mc, width, height, -26 + (FontLoaders.SF21.getHeight()) * 3, height, FontLoaders.SF21.getHeight());
}

@Override
Expand Down Expand Up @@ -63,7 +64,6 @@ public void handleMouseInput() throws IOException {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
list.drawScreen(mouseX, mouseY, partialTicks);

super.drawScreen(mouseX, mouseY, partialTicks);
}

Expand All @@ -75,7 +75,7 @@ public SlotList(Minecraft client, int width, int height, int top, int bottom, in

@Override
protected int getSize() {
return ProtocolVersionList.getProtocolsNewToOld().size();
return ProtocolVersionList.getProtocolsNewToOld().size() - 2;
}

@Override
Expand Down Expand Up @@ -105,7 +105,7 @@ protected void drawSlot(int index, int x, int y, int slotHeight, int mouseX, int
color = ProtocolSelector.this.simple ? ChatFormatting.WHITE.toString() : ChatFormatting.DARK_RED.toString();
}

drawCenteredString(mc.fontRendererObj, (color) + version.getName(), width / 2, y - 3, -1);
FontLoaders.SF21.drawCenteredStringWithShadow((color) + version.getName(), width / 2F, y - 2.5f, -1);
}
}

Expand Down
Loading

0 comments on commit 239152e

Please sign in to comment.