Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge branch 'dev' into feat/Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasLamba2006 authored Jul 18, 2024
2 parents 304572d + 7b8b29a commit 02c2822
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public void renderItemInFirstPerson(final float partialTicks, @NotNull CallbackI

ItemStack itemToRender = SlotHandler.getRenderHeldItem();
if (itemToRender != null) {
if (itemToRender != SlotHandler.getHeldItem())
animationProgression = 0.0F;

EnumAction enumaction = itemToRender.getItemUseAction();
final int itemInUseCount = thePlayer.getItemInUseCount();
boolean useItem = itemInUseCount > 0;
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/keystrokesmod/module/impl/movement/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import keystrokesmod.module.setting.impl.SliderSetting;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.util.BlockPos;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.jetbrains.annotations.NotNull;
Expand All @@ -23,6 +24,7 @@ public class Phase extends Module {
private final ButtonSetting cancelS08;
private final ButtonSetting waitingBreakBlock;
private final SliderSetting autoDisable;
private final ButtonSetting exceptGround;

private int phaseTime;

Expand All @@ -40,6 +42,7 @@ public Phase() {
this.registerSetting(cancelS08 = new ButtonSetting("Cancel S06", false));
this.registerSetting(waitingBreakBlock = new ButtonSetting("waiting break block", false));
this.registerSetting(autoDisable = new SliderSetting("Auto disable", 6, 1, 20, 1, "ticks"));
this.registerSetting(exceptGround = new ButtonSetting("Except ground", false));
}

@Override
Expand Down Expand Up @@ -94,8 +97,11 @@ public void onPreMotion(PreMotionEvent event) {

@SubscribeEvent
public void onBlockAABB(BlockAABBEvent event) {
if (this.phase)
if (this.phase) {
if (exceptGround.isToggled() && event.getBlockPos().equals(new BlockPos(mc.thePlayer).down()))
return;
event.setBoundingBox(null);
}
}

@SubscribeEvent
Expand Down
56 changes: 52 additions & 4 deletions src/main/java/keystrokesmod/module/impl/movement/Speed.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.network.play.server.S12PacketEntityVelocity;
import net.minecraft.potion.Potion;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
Expand All @@ -34,7 +35,7 @@ public class Speed extends Module {
private final ButtonSetting sneakDisable;
private final ButtonSetting stopMotion;
private final ButtonSetting stopSprint;
private final String[] modes = new String[]{"Hypixel A", "BlocksMC", "Vulcan", "GrimAC", "Hypixel B", "Hypixel C"};
private final String[] modes = new String[]{"Hypixel A", "BlocksMC", "Vulcan", "GrimAC", "Hypixel B", "Hypixel C", "Polar"};
private int offGroundTicks = 0;
public static int ticksSinceVelocity = Integer.MAX_VALUE;

Expand All @@ -46,13 +47,17 @@ public class Speed extends Module {
private boolean reset;
private double speed;

public TimerUtil timeUtil = new TimerUtil();
public int ticks = 0;
private boolean start = false;

public Speed() {
super("Speed", Module.category.movement);
this.registerSetting(mode = new ModeSetting("Mode", modes, 0));
this.registerSetting(vulcan$lowHop = new SliderSetting("Low hop", 2, 0, 4, 1, "ticks", new ModeOnly(mode, 2)));
ModeOnly grimAC = new ModeOnly(mode, 3);
this.registerSetting(grimAC$boost = new SliderSetting("Boost", 4, 0, 10, 1, grimAC));
this.registerSetting(autoJump = new ButtonSetting("Auto jump", false, grimAC));
this.registerSetting(autoJump = new ButtonSetting("Auto jump", false, new ModeOnly(mode, 3, 6)));
this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true));
this.registerSetting(sneakDisable = new ButtonSetting("Disable while sneaking", true));
this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false));
Expand Down Expand Up @@ -84,6 +89,8 @@ public void onPreMotion(PreMotionEvent event) {
@Override
public void onEnable() {
ticksSinceVelocity = Integer.MAX_VALUE;
ticks = 0;
start = false;
}

@SubscribeEvent
Expand Down Expand Up @@ -201,6 +208,30 @@ public void onUpdate() {
double boost = grimAC$boost.getInput() / 100 * collisions;
mc.thePlayer.addVelocity(-Math.sin(yaw) * boost, 0.0, Math.cos(yaw) * boost);
break;
case 6:
if (mc.thePlayer.onGround && autoJump.isToggled() && MoveUtil.isMoving()) {
mc.thePlayer.jump();
}

if (start) {

if (this.timeUtil.hasTimeElapsed(20)) {
start = false;
}

if (mc.thePlayer.motionY <= -0.10) {
ticks++;
if (ticks % 2 == 0) {
mc.thePlayer.motionY = -0.1;
} else {
mc.thePlayer.motionY = -0.16;
}
mc.thePlayer.jumpMovementFactor = 0.0265f;
} else {
ticks = 0;
}
}
break;
}
}

Expand Down Expand Up @@ -295,8 +326,25 @@ public void onPlayerInput(PrePlayerInputEvent event) {

@SubscribeEvent
public void onReceivePacket(@NotNull ReceivePacketEvent event) {
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
speed = 0;
if (noAction()) return;

switch ((int) mode.getInput()) {
case 1:
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
speed = 0;
}
break;
case 6:
if (event.getPacket() instanceof S12PacketEntityVelocity) {

S12PacketEntityVelocity s = (S12PacketEntityVelocity) event.getPacket();

if (s.getEntityID() == mc.thePlayer.getEntityId()) {
start = true;
timeUtil.reset();
}

}
}
}

Expand Down
13 changes: 3 additions & 10 deletions src/main/java/keystrokesmod/module/impl/movement/Timer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class Timer extends Module {

public Timer() {
super("Timer", Module.category.movement, 0);
this.registerSetting(mode = new ModeSetting("Mode", new String[]{"Normal", "Balance", "Hypixel"}, 0));
this.registerSetting(mode = new ModeSetting("Mode", new String[]{"Normal", "Balance", "Hypixel", "None"}, 0));
final ModeOnly mode1 = new ModeOnly(mode, 1);
this.registerSetting(speed = new SliderSetting("Speed", 1.00, 0.01, 10.0, 0.01, new ModeOnly(mode, 0, 1)));
this.registerSetting(speed = new SliderSetting("Speed", 1.00, 0.01, 10.0, 0.05, new ModeOnly(mode, 0, 1)));
this.registerSetting(slowTimer = new SliderSetting("Slow timer", 0, 0, 1, 0.01, "x", mode1));
this.registerSetting(maxBalance = new SliderSetting("Max balance", 1000, 0, 3000, 10, "ms", mode1));
this.registerSetting(costMultiplier = new SliderSetting("Cost multiplier", 1, 0.5, 5, 0.05, "x", mode1));
Expand Down Expand Up @@ -128,14 +128,7 @@ private void reset() {

@Override
public String getInfo() {
switch ((int) mode.getInput()) {
case 0:
return String.valueOf(speed.getInput());
case 1:
return String.valueOf(balance);
default:
return mode.getOptions()[(int) mode.getInput()];
}
return String.valueOf(Utils.getTimer().timerSpeed);
}

@Override
Expand Down
19 changes: 15 additions & 4 deletions src/main/java/keystrokesmod/module/impl/other/RotationHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ public static void setMovementYaw(float movementYaw) {
}

public static void setRotationYaw(float rotationYaw) {
if (AimSimulator.yawEquals(rotationYaw, mc.thePlayer.rotationYaw)) {
RotationHandler.rotationYaw = null;
return;
}
RotationHandler.rotationYaw = rotationYaw;
}

public static void setRotationPitch(float rotationPitch) {
if (rotationPitch == mc.thePlayer.rotationPitch) {
RotationHandler.rotationPitch = null;
return;
}
RotationHandler.rotationPitch = rotationPitch;
}

Expand Down Expand Up @@ -95,8 +103,8 @@ public void onPreMotion(MoveInputEvent event) {
float viewPitch = RotationUtils.normalize(mc.thePlayer.rotationPitch);
switch ((int) smoothBack.getInput()) {
case 0:
setRotationYaw(viewYaw);
setRotationPitch(viewPitch);
rotationYaw = null;
rotationPitch = null;
break;
case 1:
setRotationYaw(AimSimulator.rotMove(viewYaw, getRotationYaw(), (float) aimSpeed.getInput()));
Expand All @@ -108,7 +116,7 @@ public void onPreMotion(MoveInputEvent event) {
if (AimSimulator.yawEquals(getRotationYaw(), mc.thePlayer.rotationYaw)) rotationYaw = null;
if (getRotationPitch() == mc.thePlayer.rotationPitch) rotationPitch = null;

RotationEvent rotationEvent = new RotationEvent(getRotationYaw(), getRotationPitch(), getMoveFix());
RotationEvent rotationEvent = new RotationEvent(getRotationYaw(), getRotationPitch(), MoveFix.values()[(int) defaultMoveFix.getInput()]);
MinecraftForge.EVENT_BUS.post(rotationEvent);
isSet = rotationEvent.isSet() || rotationYaw != null || rotationPitch != null;
if (isSet) {
Expand Down Expand Up @@ -155,7 +163,10 @@ public void onPreMotion(MoveInputEvent event) {
case STRICT:
movementYaw = getRotationYaw();
break;
}
}
} else {
movementYaw = null;
moveFix = null;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/keystrokesmod/module/impl/player/NoFall.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public void onUpdate() {
public void onPacketSend(@NotNull SendPacketEvent event) {
if (mode.getInput() == 5) {
if (event.getPacket() instanceof C03PacketPlayer && mc.thePlayer.fallDistance > minFallDistance.getInput()) {
Utils.sendMessage(String.format("currentMod: %s hasMod: %s", currentModCount, hasModCount));
if (currentModCount > maxModCount.get(hasModCount % maxModCount.size())) {
return;
}
Expand Down Expand Up @@ -121,7 +120,7 @@ public void onPreMotionEvent(PreMotionEvent event) {
} catch (Exception exception) {
Utils.sendMessage("&cFailed to get fall distance.");
}
if (extra$fallDistance > minFallDistance.getInput()) {
if (extra$fallDistance - mc.thePlayer.motionY > minFallDistance.getInput()) {
Utils.getTimer().timerSpeed = (float) 0.5;
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/keystrokesmod/module/impl/render/HUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.List;

public class HUD extends Module {
public static final String VERSION = "1.16.1-Dev";
public static final String VERSION = "1.17.0";
public static final HashMap<String, ResourceLocation> WATERMARK = new HashMap<>();
public static ModeSetting theme;
// public static SliderSetting font;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package keystrokesmod.module.impl.world.tower;

import keystrokesmod.Raven;
import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.world.Tower;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.SubMode;
import keystrokesmod.script.classes.Vec3;
import keystrokesmod.utility.MoveUtil;
Expand All @@ -18,6 +20,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.Optional;
import java.util.concurrent.TimeUnit;

import static keystrokesmod.module.ModuleManager.tower;

Expand All @@ -40,8 +43,11 @@ public class HypixelBTower extends SubMode<Tower> {
private int offGroundTicks = 0;
private BlockPos deltaPlace = BlockPos.ORIGIN;

private final ButtonSetting onlyWhileMoving;

public HypixelBTower(String name, @NotNull Tower parent) {
super(name, parent);
this.registerSetting(onlyWhileMoving = new ButtonSetting("Only while moving", true));
}

@SubscribeEvent(priority = EventPriority.LOW)
Expand All @@ -51,7 +57,7 @@ public void onPreUpdate(PreUpdateEvent event) {
else
offGroundTicks++;

if (blockPlaceRequest) {
if (blockPlaceRequest && !Utils.isMoving()) {
MovingObjectPosition lastScaffoldPlace = ModuleManager.scaffold.placeBlock;
if (lastScaffoldPlace == null)
return;
Expand All @@ -62,20 +68,20 @@ public void onPreUpdate(PreUpdateEvent event) {
Triple<BlockPos, EnumFacing, Vec3> placeSide = optionalPlaceSide.get();


ModuleManager.scaffold.place(
Raven.getExecutor().schedule(() -> ModuleManager.scaffold.place(
new MovingObjectPosition(placeSide.getRight().toVec3(), placeSide.getMiddle(), placeSide.getLeft()),
false
);
), 50, TimeUnit.MILLISECONDS);
// ModuleManager.scaffold.tower$noBlockPlace = true;
blockPlaceRequest = false;
}
}

@SubscribeEvent
public void onPreMotion(PreMotionEvent event) {
if (!tower.canTower()) return;
if (onlyWhileMoving.isToggled() && !MoveUtil.isMoving()) return;

if (!Utils.jumpDown()) {
if (!tower.canTower()) {
this.Io = mc.thePlayer.rotationYaw;
this.er = 100;
} else {
Expand Down Expand Up @@ -171,6 +177,6 @@ public void onEnable() {

public void et() {
this.Iq = (int)Math.floor(mc.thePlayer.posY);
deltaPlace = new BlockPos(0, 0, 1);
deltaPlace = new BlockPos(0, 1, 1);
}
}

0 comments on commit 02c2822

Please sign in to comment.