Skip to content

Commit

Permalink
Add MotionCamera
Browse files Browse the repository at this point in the history
Improve Hypixel autoblock
Add 'not while invmove' to Speed
Add 'Temp disable on flag' to Speed
Improve HypixelLowHop7TickSpeed (less flags)
Improve performance
  • Loading branch information
xia-mc committed Dec 14, 2024
1 parent e4142cf commit d37ca30
Show file tree
Hide file tree
Showing 17 changed files with 286 additions and 72 deletions.
32 changes: 32 additions & 0 deletions src/main/java/keystrokesmod/event/EyeHeightEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package keystrokesmod.event;

import keystrokesmod.utility.Utils;
import lombok.*;
import net.minecraftforge.fml.common.eventhandler.Event;

import static keystrokesmod.Raven.mc;

@Getter
public class EyeHeightEvent extends Event {
private double y;
private boolean set;

public EyeHeightEvent(double eyeHeight) {
setEyeHeight(eyeHeight);
}

public double getEyeHeight() {
return 1.62 - (mc.thePlayer.lastTickPosY +
(((mc.thePlayer.posY - mc.thePlayer.lastTickPosY) * Utils.getTimer().renderPartialTicks)) - y);
}

public void setEyeHeight(double targetEyeHeight) {
this.y = targetEyeHeight - 1.62 + mc.thePlayer.lastTickPosY +
((mc.thePlayer.posY - mc.thePlayer.lastTickPosY) * (double) Utils.getTimer().renderPartialTicks);
}

public void setY(double y) {
this.y = y;
this.set = true;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package keystrokesmod.mixins.impl.entity;

import keystrokesmod.event.EyeHeightEvent;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.movement.KeepSprint;
import keystrokesmod.module.impl.render.Particles;
Expand All @@ -17,13 +18,17 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import static keystrokesmod.Raven.mc;

@SuppressWarnings("DataFlowIssue")
@Mixin(value = EntityPlayer.class)
public abstract class MixinEntityPlayer extends EntityLivingBase {
public MixinEntityPlayer(World p_i1594_1_) {
Expand All @@ -34,6 +39,7 @@ public MixinEntityPlayer(World p_i1594_1_) {
* @author strangerrrs
* @reason mixin attack target entity with current item
*/
@SuppressWarnings({"UnresolvedMixinReference", "ExtractMethodRecommender"})
@Inject(method = "attackTargetEntityWithCurrentItem", at = @At("HEAD"), cancellable = true)
public void attackTargetEntityWithCurrentItem(Entity p_attackTargetEntityWithCurrentItem_1_, CallbackInfo ci) {
if (ForgeHooks.onPlayerAttackTarget(((EntityPlayer) (Object) this), p_attackTargetEntityWithCurrentItem_1_)) {
Expand Down Expand Up @@ -72,7 +78,7 @@ public void attackTargetEntityWithCurrentItem(Entity p_attackTargetEntityWithCur
boolean flag2 = p_attackTargetEntityWithCurrentItem_1_.attackEntityFrom(DamageSource.causePlayerDamage(((EntityPlayer) (Object) this)), f);
if (flag2) {
if (i > 0) {
p_attackTargetEntityWithCurrentItem_1_.addVelocity((double) (-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1, (double) (MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
p_attackTargetEntityWithCurrentItem_1_.addVelocity(-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F, 0.1, MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F);
if (ModuleManager.keepSprint != null && ModuleManager.keepSprint.isEnabled()) {
KeepSprint.keepSprint(p_attackTargetEntityWithCurrentItem_1_);
}
Expand Down Expand Up @@ -110,13 +116,14 @@ public void attackTargetEntityWithCurrentItem(Entity p_attackTargetEntityWithCur

EnchantmentHelper.applyArthropodEnchantments(this, p_attackTargetEntityWithCurrentItem_1_);
ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
Entity entity = p_attackTargetEntityWithCurrentItem_1_;
Entity entity1 = p_attackTargetEntityWithCurrentItem_1_;
if (p_attackTargetEntityWithCurrentItem_1_ instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) p_attackTargetEntityWithCurrentItem_1_).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase) {
entity = (EntityLivingBase) ientitymultipart;
entity1 = (EntityLivingBase) ientitymultipart;
}
}
Entity entity = entity1;

if (itemstack != null && entity instanceof EntityLivingBase) {
itemstack.hitEntity((EntityLivingBase) entity, ((EntityPlayer) (Object) this));
Expand All @@ -143,4 +150,14 @@ public void attackTargetEntityWithCurrentItem(Entity p_attackTargetEntityWithCur
ci.cancel();
}

@Inject(method = "getEyeHeight", at = @At("RETURN"), cancellable = true)
public void onGetEyeHeight(@NotNull CallbackInfoReturnable<Float> cir) {
EyeHeightEvent event = new EyeHeightEvent(cir.getReturnValue());
MinecraftForge.EVENT_BUS.post(event);
if (event.isSet()) {
mc.thePlayer.cameraYaw = 0;
mc.thePlayer.cameraPitch = 0;
cir.setReturnValue((float) event.getEyeHeight());
}
}
}
5 changes: 4 additions & 1 deletion src/main/java/keystrokesmod/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ public class ModuleManager {
public static Regen regen;
public static ChatAI chatAI;
public static keystrokesmod.module.impl.render.ArrayList arrayList;
public static InvMove invMove;
public static MotionCamera motionCamera;

static List<Module> modules = new ArrayList<>();

Expand Down Expand Up @@ -203,7 +205,7 @@ public void register() {

// movement
this.addModule(fly = new Fly());
this.addModule(new InvMove());
this.addModule(invMove = new InvMove());
this.addModule(keepSprint = new KeepSprint());
this.addModule(longJump = new LongJump());
this.addModule(noSlow = new NoSlow());
Expand Down Expand Up @@ -300,6 +302,7 @@ public void register() {
this.addModule(new KillMessage());
this.addModule(clientTheme = new ClientTheme());
this.addModule(arrayList = new keystrokesmod.module.impl.render.ArrayList());
this.addModule(motionCamera = new MotionCamera());

// world
this.addModule(antiBot = new AntiBot());
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/keystrokesmod/module/impl/combat/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,13 @@ public void onPreUpdate(PreUpdateEvent event) {
case 9:
if (lag) {
blinking = true;
unBlock();
unBlock(); // unblock while blinking
lag = false;
} else {
attackAndInteract(target, true, Utils.getEyePos(target)); // attack while blinked
releasePackets(); // release
sendBlock(); // block after releasing unblock
blinking = false;
sendBlock(); // send block without blinking
lag = true;
}
break;
Expand Down Expand Up @@ -768,7 +769,7 @@ private boolean attack(EntityLivingBase target) {
}

private void sendBlock() {
mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem()));
PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem()));
}

private boolean isMining() {
Expand All @@ -779,7 +780,7 @@ private void unBlock() {
if (!Utils.holdingSword()) {
return;
}
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
PacketUtils.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
blockingTime = 0;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
package keystrokesmod.module.impl.exploit.disabler;

import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.ReceivePacketEvent;
import keystrokesmod.module.impl.exploit.Disabler;
import keystrokesmod.module.impl.exploit.disabler.hypixel.HypixelMotionDisabler;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.LiteralSubMode;
import keystrokesmod.module.setting.impl.ModeValue;
import keystrokesmod.module.setting.impl.SubMode;
import keystrokesmod.utility.PacketUtils;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import keystrokesmod.utility.MoveUtil;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.jetbrains.annotations.NotNull;

public class HypixelDisabler extends SubMode<Disabler> {
public final ModeValue motion;
private final ButtonSetting cancelSprint;
private final ButtonSetting sprint;

public HypixelDisabler(String name, @NotNull Disabler parent) {
super(name, parent);
this.registerSetting(motion = new ModeValue("Motion Disabler", this)
.add(new LiteralSubMode("Disabled", this))
.add(new HypixelMotionDisabler("Enabled", this))
);
this.registerSetting(cancelSprint = new ButtonSetting("Cancel sprint", false));
this.registerSetting(sprint = new ButtonSetting("Sprint", false));
}

@Override
Expand All @@ -42,20 +37,7 @@ public void onDisable() {

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPreMotion(PreMotionEvent event) {
if (cancelSprint.isToggled())
if (sprint.isToggled() && MoveUtil.getSpeedEffect() == 0 && !MoveUtil.canSprint(true))
event.setSprinting(false);
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onReceivePacket(@NotNull ReceivePacketEvent event) {
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
if (mc.thePlayer.isUsingItem()) {
if (mc.thePlayer.isBlocking()) {
PacketUtils.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP));
} else {
mc.playerController.onStoppedUsingItem(mc.thePlayer);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class InvMove extends Module {
private final ButtonSetting clickGui;

private boolean blinking = false;

private boolean clicked = false;

public InvMove() {
Expand Down Expand Up @@ -102,7 +101,7 @@ public void onPreUpdate(PreUpdateEvent event) {
}
}

private boolean canInvMove() {
public boolean canInvMove() {
if (!nameCheck() || !targetNearbyCheck() || scaffold.isEnabled())
return false;
if (clickGui.isToggled() && mc.currentScreen instanceof ClickGui)
Expand Down
28 changes: 25 additions & 3 deletions src/main/java/keystrokesmod/module/impl/movement/Speed.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
package keystrokesmod.module.impl.movement;

import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.event.ReceivePacketEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.movement.speed.*;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.ModeValue;
import keystrokesmod.module.setting.impl.SliderSetting;
import keystrokesmod.utility.MoveUtil;
import keystrokesmod.utility.Utils;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.jetbrains.annotations.NotNull;

public class Speed extends Module {
private final ModeValue mode;
private final ButtonSetting liquidDisable;
private final ButtonSetting sneakDisable;
private final ButtonSetting invMoveDisable;
private final SliderSetting tempDisableOnFlag;
private final ButtonSetting stopMotion;
public int offGroundTicks = 0;
private int disableTicks = 0;

public Speed() {
super("Speed", Module.category.movement);
Expand All @@ -30,6 +38,8 @@ public Speed() {
);
this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true));
this.registerSetting(sneakDisable = new ButtonSetting("Disable while sneaking", true));
this.registerSetting(invMoveDisable = new ButtonSetting("Disable while InvMove", false));
this.registerSetting(tempDisableOnFlag = new SliderSetting("Temp disable on flag", 0, 3, 5, 0.1, "s"));
this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false));
}

Expand All @@ -50,13 +60,24 @@ public void onPreUpdate(PreUpdateEvent event) {
} else {
offGroundTicks++;
}

if (disableTicks > 0)
disableTicks--;
}

@SubscribeEvent
public void onReceivePacket(@NotNull ReceivePacketEvent event) {
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
disableTicks += (int) (tempDisableOnFlag.getInput() * 20);
}
}

public boolean noAction() {
return !Utils.nullCheck()
|| ((mc.thePlayer.isInWater() || mc.thePlayer.isInLava())
&& liquidDisable.isToggled())
|| (mc.thePlayer.isSneaking() && sneakDisable.isToggled());
|| ((mc.thePlayer.isInWater() || mc.thePlayer.isInLava()) && liquidDisable.isToggled())
|| (mc.thePlayer.isSneaking() && sneakDisable.isToggled())
|| (ModuleManager.invMove.isEnabled() && ModuleManager.invMove.canInvMove() && invMoveDisable.isToggled())
|| disableTicks > 0;
}

@Override
Expand All @@ -67,5 +88,6 @@ public void onDisable() {
MoveUtil.stop();
}
Utils.resetTimer();
disableTicks = 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import keystrokesmod.event.SendPacketEvent;
import keystrokesmod.module.impl.movement.NoSlow;
import keystrokesmod.module.impl.other.SlotHandler;
import keystrokesmod.module.impl.player.blink.NormalBlink;
import keystrokesmod.utility.ContainerUtils;
import keystrokesmod.utility.PacketUtils;
import keystrokesmod.utility.Utils;
Expand All @@ -18,10 +19,15 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static net.minecraft.util.EnumFacing.DOWN;

public class HypixelNoSlow extends INoSlow {
private int offGroundTicks = 0;
private boolean send = false;

private final NormalBlink blink = new NormalBlink("Blink", this);
private boolean cycle = false;

public HypixelNoSlow(String name, @NotNull NoSlow parent) {
super(name, parent);
}
Expand All @@ -46,6 +52,31 @@ public void onPreMotion(PreMotionEvent event) {
} else if (item != null && mc.thePlayer.isUsingItem() && !(item.getItem() instanceof ItemSword)) {
event.setPosY(event.getPosY() + 1E-14);
}

if (NoSlow.sword.isToggled())
if (mc.thePlayer.isUsingItem()
&& item != null && item.getItem() instanceof ItemSword) {
if (cycle) {
blink.enable();
PacketUtils.sendPacket(new C07PacketPlayerDigging(
C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN
));
cycle = false;
} else {
blink.disable();
PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem()));
cycle = true;
}
} else {
cycle = false;
blink.disable();
}
}

@Override
public void onDisable() throws Throwable {
cycle = false;
blink.disable();
}

@SubscribeEvent
Expand Down
Loading

0 comments on commit d37ca30

Please sign in to comment.