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

Commit

Permalink
Release 2.9.1 (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc authored Oct 26, 2024
1 parent 5aaaa62 commit 34028c9
Show file tree
Hide file tree
Showing 39 changed files with 937 additions and 449 deletions.
13 changes: 0 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,10 @@ dependencies {
implementation files('libraries/fastutil-core-8.5.14-javadoc.jar')
implementation files('libraries/json-20220924.jar')
implementation files('libraries/discord-rpc.jar')
// implementation files('libraries/ViaAprilFools-3.0.2-SNAPSHOT.jar')
// implementation files('libraries/ViaBackwards-5.0.4-SNAPSHOT.jar')
// implementation files('libraries/ViaLegacy-3.0.3-SNAPSHOT.jar')
// implementation files('libraries/ViaLoader-3.0.3-SNAPSHOT.jar')
// implementation files('libraries/ViaRewind-4.0.3-SNAPSHOT.jar')
// implementation files('libraries/ViaVersion-5.0.4-SNAPSHOT.jar')

embed files('libraries/fastutil-core-8.5.14.jar')
embed files('libraries/discord-rpc.jar')
embed files('libraries/json-20220924.jar')
// embed files('libraries/viaforge-1.8.9-3.3.3.jar')
// embed files('libraries/ViaAprilFools-3.0.2-SNAPSHOT.jar')
// embed files('libraries/ViaBackwards-5.0.4-SNAPSHOT.jar')
// embed files('libraries/ViaLegacy-3.0.3-SNAPSHOT.jar')
// embed files('libraries/ViaLoader-3.0.3-SNAPSHOT.jar')
// embed files('libraries/ViaRewind-4.0.3-SNAPSHOT.jar')
// embed files('libraries/ViaVersion-5.0.4-SNAPSHOT.jar')
}

processResources {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/keystrokesmod/Raven.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import keystrokesmod.utility.*;
import keystrokesmod.utility.clicks.CPSCalculator;
import keystrokesmod.utility.i18n.I18nManager;
import keystrokesmod.utility.interact.moveable.MoveableManager;
import keystrokesmod.utility.profile.Profile;
import keystrokesmod.utility.profile.ProfileManager;
import keystrokesmod.utility.render.progress.ProgressManager;
Expand Down Expand Up @@ -86,6 +87,7 @@ public void init(FMLInitializationEvent ignored) {
MinecraftForge.EVENT_BUS.register(ModuleManager.rotationHandler);
MinecraftForge.EVENT_BUS.register(ModuleManager.slotHandler);
MinecraftForge.EVENT_BUS.register(ModuleManager.dynamicManager);
MinecraftForge.EVENT_BUS.register(new MoveableManager());

I18nManager.init();
AutoUpdate.init();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/keystrokesmod/event/PreUpdateEvent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keystrokesmod.event;

import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;

@Cancelable
public class PreUpdateEvent extends Event {
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Objects;

import static keystrokesmod.utility.movement.Direction.*;

@Mixin(value = EntityPlayerSP.class, priority = 999)
Expand Down Expand Up @@ -110,12 +112,15 @@ public MixinEntityPlayerSP(World p_i45074_1_, GameProfile p_i45074_2_) {

@Shadow protected abstract boolean isOpenBlockSpace(BlockPos p_isOpenBlockSpace_1_);

@Inject(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;onUpdate()V"))
@Inject(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;onUpdate()V"), cancellable = true)
public void onPreUpdate(CallbackInfo ci) {
RotationUtils.prevRenderPitch = RotationUtils.renderPitch;
RotationUtils.prevRenderYaw = RotationUtils.renderYaw;

MinecraftForge.EVENT_BUS.post(new PreUpdateEvent());
PreUpdateEvent event = new PreUpdateEvent();
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
ci.cancel();
}

@Inject(method = "onUpdate", at = @At("RETURN"))
Expand Down Expand Up @@ -294,18 +299,22 @@ public void onLivingUpdate() {
this.movementInput.updatePlayerMoveState();

// no slow
boolean usingItemModified = this.isUsingItem() || (ModuleManager.killAura != null && ModuleManager.killAura.isEnabled() && ModuleManager.killAura.block.get() && ((Object) this) == Minecraft.getMinecraft().thePlayer && ModuleManager.killAura.rmbDown && ModuleManager.killAura.manualBlock.isToggled());
boolean stopSprint = (this.isUsingItem() && ModuleManager.noSlow != null && ModuleManager.noSlow.isEnabled() && NoSlow.getForwardSlowed() == 0.8);

if (!stopSprint) {
stopSprint = Sprint.stopSprint();
}
@SuppressWarnings("EqualsBetweenInconvertibleTypes")
final boolean autoBlocking = ModuleManager.killAura != null
&& ModuleManager.killAura.isEnabled()
&& ModuleManager.killAura.block.get()
&& Objects.equals(this, Minecraft.getMinecraft().thePlayer)
&& ModuleManager.killAura.autoBlockMode.getInput() != 0;
final boolean usingItemModified = this.isUsingItem() || autoBlocking;
boolean stopSprint = Sprint.stopSprint() || this.isUsingItem()
&& (ModuleManager.noSlow != null && ModuleManager.noSlow.isEnabled() && NoSlow.getForwardSlowed() <= 0.8)
|| (autoBlocking && ModuleManager.killAura.slowdown.getInput() <= 0.8);

if (usingItemModified && !this.isRiding()) {
MovementInput var10000 = this.movementInput;
var10000.moveStrafe *= NoSlow.getStrafeSlowed();
var10000.moveStrafe *= autoBlocking ? (float) ModuleManager.killAura.slowdown.getInput() : NoSlow.getStrafeSlowed();
var10000 = this.movementInput;
var10000.moveForward *= NoSlow.getForwardSlowed();
var10000.moveForward *= autoBlocking ? (float) ModuleManager.killAura.slowdown.getInput() : NoSlow.getForwardSlowed();
if (stopSprint) {
this.sprintToggleTimer = 0;
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiChat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package keystrokesmod.mixins.impl.gui;


import keystrokesmod.utility.interact.moveable.MoveableManager;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(GuiChat.class)
public abstract class MixinGuiChat extends GuiScreen {

@Override
protected void mouseClickMove(int x, int y, int p_mouseClickMove_3_, long p_mouseClickMove_4_) {
super.mouseClickMove(x, y, p_mouseClickMove_3_, p_mouseClickMove_4_);
if (p_mouseClickMove_3_ == 0)
MoveableManager.onMouseDrag(x, y);
}

@Override
protected void mouseReleased(int x, int y, int p_mouseReleased_3_) {
super.mouseReleased(x, y, p_mouseReleased_3_);
MoveableManager.onMouseRelease();
}
}
2 changes: 2 additions & 0 deletions src/main/java/keystrokesmod/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public class ModuleManager {
public static RemoteShop remoteShop;
public static Regen regen;
public static ChatAI chatAI;
public static keystrokesmod.module.impl.render.ArrayList arrayList;

public void register() {

Expand Down Expand Up @@ -282,6 +283,7 @@ public void register() {
this.addModule(new Explosions());
this.addModule(new KillMessage());
this.addModule(clientTheme = new ClientTheme());
this.addModule(arrayList = new keystrokesmod.module.impl.render.ArrayList());

// world
this.addModule(antiBot = new AntiBot());
Expand Down
122 changes: 17 additions & 105 deletions src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
public class AutoGapple extends Module {
private final SliderSetting minHealth;
private final SliderSetting delayBetweenHeal;
private final SliderSetting releaseTicksAfterVelocity;
public final ButtonSetting disableKillAura;
private final ButtonSetting airStuck;
private final ButtonSetting visual;
Expand All @@ -47,7 +46,6 @@ public class AutoGapple extends Module {
private int foodSlot;

private final Queue<Packet<?>> delayedSend = new ConcurrentLinkedQueue<>();
private final Queue<Packet<INetHandlerPlayClient>> delayedReceive = new ConcurrentLinkedQueue<>();
private final HashMap<Integer, RealPositionData> realPositions = new HashMap<>();

private final Animation animation = new Animation(Easing.EASE_OUT_CIRC, 500);
Expand All @@ -57,7 +55,6 @@ public AutoGapple() {
super("AutoGapple", category.combat, "Made for QuickMacro.");
this.registerSetting(minHealth = new SliderSetting("Min health", 10, 1, 20, 1));
this.registerSetting(delayBetweenHeal = new SliderSetting("Delay between heal", 5, 0, 20, 1));
this.registerSetting(releaseTicksAfterVelocity = new SliderSetting("Release ticks after velocity", 0, 0, 5, 1));
this.registerSetting(disableKillAura = new ButtonSetting("Disable killAura", false));
this.registerSetting(airStuck = new ButtonSetting("Air stuck", false));
this.registerSetting(visual = new ButtonSetting("Visual", true));
Expand All @@ -78,33 +75,24 @@ public void onDisable() {
public void onPreUpdate(PreUpdateEvent event) {
if (eatingTicksLeft == 0 && working) {
working = false;
if (airStuck.isToggled()) {
int lastSlot = SlotHandler.getCurrentSlot();
if (foodSlot != lastSlot)
PacketUtils.sendPacketNoEvent(new C09PacketHeldItemChange(foodSlot));
PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
PacketUtils.sendPacketNoEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.mainInventory[foodSlot]));
Utils.sendMessage("send.");
mc.thePlayer.moveForward *= 0.2f;
mc.thePlayer.moveStrafing *= 0.2f;
release();
if (foodSlot != lastSlot)
PacketUtils.sendPacketNoEvent(new C09PacketHeldItemChange(lastSlot));
releaseLeft = (int) delayBetweenHeal.getInput();
foodSlot = -1;
} else {
Utils.sendClick(1, false);
}
int lastSlot = SlotHandler.getCurrentSlot();
if (foodSlot != lastSlot)
PacketUtils.sendPacketNoEvent(new C09PacketHeldItemChange(foodSlot));
PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
PacketUtils.sendPacketNoEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.mainInventory[foodSlot]));
Utils.sendMessage("send.");
release();
if (foodSlot != lastSlot)
PacketUtils.sendPacketNoEvent(new C09PacketHeldItemChange(lastSlot));
releaseLeft = (int) delayBetweenHeal.getInput();
foodSlot = -1;
}

if (releaseLeft > 0) {
releaseLeft--;
}

if (!Utils.nullCheck() || mc.thePlayer.getHealth() >= minHealth.getInput() || (onlyWhileKillAura.isToggled() && KillAura.target == null)) {
if (!airStuck.isToggled() && eatingTicksLeft > 0) {
Utils.sendClick(1, false);
}
eatingTicksLeft = 0;
return;
}
Expand All @@ -113,10 +101,6 @@ public void onPreUpdate(PreUpdateEvent event) {
working = true;
eatingTicksLeft--;

if (!airStuck.isToggled()) {
SlotHandler.setCurrentSlot(foodSlot);
Utils.sendClick(1, true);
}
return;
}

Expand All @@ -128,40 +112,21 @@ public void onPreUpdate(PreUpdateEvent event) {
animation.reset();
eatingTicksLeft = 36;
animation.setValue(eatingTicksLeft);
if (airStuck.isToggled()) {
mc.theWorld.playerEntities.parallelStream()
.filter(p -> p != mc.thePlayer)
.forEach(p -> realPositions.put(p.getEntityId(), new RealPositionData(p)));
} else {
SlotHandler.setCurrentSlot(foodSlot);
Utils.sendClick(1, true);
}
mc.theWorld.playerEntities.parallelStream()
.filter(p -> p != mc.thePlayer)
.forEach(p -> realPositions.put(p.getEntityId(), new RealPositionData(p)));
}
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void onSendPacket(SendPacketEvent event) {
if (airStuck.isToggled() && working) {
if (working) {
delayedSend.add(event.getPacket());
event.setCanceled(true);
}
}

@SubscribeEvent
public void onSprint(SprintEvent event) {
if (airStuck.isToggled() && working) {
// to fix NoSlowD
event.setSprint(false);
}
}

private void release() {
synchronized (delayedReceive) {
for (Packet<INetHandlerPlayClient> p : delayedReceive) {
PacketUtils.receivePacket(p);
}
delayedReceive.clear();
}
synchronized (delayedSend) {
for (Packet<?> p : delayedSend) {
PacketUtils.sendPacket(p);
Expand All @@ -170,64 +135,11 @@ private void release() {
}
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void onReceivePacket(ReceivePacketEvent event) {
if (airStuck.isToggled() && working) {
if (event.isCanceled())
return;

final Packet<INetHandlerPlayClient> p = event.getPacket();

if (p instanceof S19PacketEntityStatus
|| p instanceof S02PacketChat
|| p instanceof S0BPacketAnimation
|| p instanceof S06PacketUpdateHealth
)
return;

if (p instanceof S08PacketPlayerPosLook || p instanceof S40PacketDisconnect) {
onDisable();
return;

} else if (p instanceof S13PacketDestroyEntities) {
S13PacketDestroyEntities wrapper = (S13PacketDestroyEntities) p;
for (int id : wrapper.getEntityIDs()) {
realPositions.remove(id);
}
} else if (p instanceof S14PacketEntity) {
S14PacketEntity wrapper = (S14PacketEntity) p;
final int id = ((S14PacketEntityAccessor) wrapper).getEntityId();
if (realPositions.containsKey(id)) {
final RealPositionData data = realPositions.get(id);
data.vec3 = data.vec3.add(wrapper.func_149062_c() / 32.0D, wrapper.func_149061_d() / 32.0D,
wrapper.func_149064_e() / 32.0D);
}
} else if (p instanceof S18PacketEntityTeleport) {
S18PacketEntityTeleport wrapper = (S18PacketEntityTeleport) p;
final int id = wrapper.getEntityId();
if (realPositions.containsKey(id)) {
final RealPositionData data = realPositions.get(id);
data.vec3 = new Vec3(wrapper.getX() / 32.0D, wrapper.getY() / 32.0D, wrapper.getZ() / 32.0D);
}
} else if (p instanceof S12PacketEntityVelocity) {
S12PacketEntityVelocity velo = (S12PacketEntityVelocity) p;
if (velo.getEntityID() == mc.thePlayer.getEntityId()) {
if (releaseTicksAfterVelocity.getInput() > 0) {
releaseLeft = (int) releaseTicksAfterVelocity.getInput();
}
return;
}
}

event.setCanceled(true);
delayedReceive.add(p);
}
}

@SubscribeEvent
public void onMove(PreMoveEvent event) {
if (working && airStuck.isToggled() && releaseLeft == 0) {
if (working && releaseLeft == 0 && airStuck.isToggled()) {
event.setCanceled(true);
delayedSend.add(new C03PacketPlayer(mc.thePlayer.onGround));
}
}

Expand Down
Loading

0 comments on commit 34028c9

Please sign in to comment.