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

Commit

Permalink
Release 3.13 (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc authored Dec 5, 2024
1 parent a07bfac commit 2f5708b
Show file tree
Hide file tree
Showing 22 changed files with 338 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public int gh() {
}

private void drawString(String s) {
getFont().drawStringWithShadow(s, (float) ((this.parent.categoryComponent.getX() + 4) * 2), (float) ((this.parent.categoryComponent.getY() + this.bind + 3) * 2), !this.parent.mod.hidden ? Theme.getGradient(10, 0) : Theme.getGradient(11, 0));
getFont().drawStringWithShadow(s, (float) ((this.parent.categoryComponent.getX() + 4) * 2), (float) ((this.parent.categoryComponent.getY() + this.bind + 3) * 2), Gui.getColor());
}

public void onGuiClosed() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keystrokesmod.clickgui.components.impl;

import keystrokesmod.clickgui.components.Component;
import keystrokesmod.module.impl.client.Gui;
import keystrokesmod.module.setting.Setting;
import keystrokesmod.module.setting.impl.DescriptionSetting;
import keystrokesmod.utility.Theme;
Expand Down Expand Up @@ -28,7 +29,7 @@ public DescriptionComponent(DescriptionSetting desc, ModuleComponent b, int o) {
public void render() {
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
getFont().drawString(this.desc.getPrettyDesc(), (float) ((this.parent.categoryComponent.getX() + 4) * 2), (float) ((this.parent.categoryComponent.getY() + this.o + 4) * 2), Theme.getGradient(10, 0), true);
getFont().drawString(this.desc.getPrettyDesc(), (float) ((this.parent.categoryComponent.getX() + 4) * 2), (float) ((this.parent.categoryComponent.getY() + this.o + 4) * 2), Gui.getColor(), true);
GL11.glPopMatrix();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import keystrokesmod.Raven;
import keystrokesmod.clickgui.components.Component;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.client.Gui;
import keystrokesmod.module.setting.Setting;
import keystrokesmod.module.setting.impl.SliderSetting;
import keystrokesmod.utility.Utils;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void render() {
r = l + 84;
}

RenderUtils.drawRoundedRectangle(l, this.parent.categoryComponent.getY() + this.o + 11, r, this.parent.categoryComponent.getY() + this.o + 15, 3, Color.getHSBColor((float) (System.currentTimeMillis() % 11000L) / 11000.0F, 0.75F, 0.9F).getRGB());
RenderUtils.drawRoundedRectangle(l, this.parent.categoryComponent.getY() + this.o + 11, r, this.parent.categoryComponent.getY() + this.o + 15, 3, Gui.getColor());
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
String value;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/keystrokesmod/module/impl/client/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import keystrokesmod.module.Module;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.ModeSetting;
import keystrokesmod.utility.Theme;
import keystrokesmod.utility.Utils;

public class Gui extends Module {
public static ButtonSetting removePlayerModel, resetPosition, translucentBackground, removeWatermark, rainBowOutlines, toolTip;
public static ModeSetting font;
public static ModeSetting theme;

public Gui() {
super("Gui", Module.category.client, 54);
Expand All @@ -20,6 +22,11 @@ public Gui() {
this.registerSetting(toolTip = new ButtonSetting("Tool tip", true));
this.registerSetting(resetPosition = new ButtonSetting("Reset position", ClickGui::resetPosition));
this.registerSetting(font = new ModeSetting("Font", new String[]{"Minecraft", "Product Sans", "Tenacity"}, 0));
this.registerSetting(theme = new ModeSetting("Theme", Theme.themes, 0));
}

public static int getColor() {
return Theme.getGradient((int) theme.getInput(), 12);
}

public void onEnable() {
Expand Down
197 changes: 78 additions & 119 deletions src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java
Original file line number Diff line number Diff line change
@@ -1,146 +1,140 @@
package keystrokesmod.module.impl.combat;

import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.PreMoveEvent;
import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.event.SendPacketEvent;
import keystrokesmod.event.PreVelocityEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.impl.other.SlotHandler;
import keystrokesmod.module.impl.player.Blink;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.SliderSetting;
import keystrokesmod.script.classes.Vec3;
import keystrokesmod.utility.PacketUtils;
import keystrokesmod.utility.Utils;
import keystrokesmod.utility.render.Animation;
import keystrokesmod.utility.render.Easing;
import keystrokesmod.utility.render.progress.Progress;
import keystrokesmod.utility.render.progress.ProgressManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.util.HashMap;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

public class AutoGapple extends Module {
public final ButtonSetting disableKillAura;
private final SliderSetting minHealth;
private final SliderSetting delayBetweenHeal;
private final ButtonSetting airStuck;
private final ButtonSetting blink;
private final SliderSetting eatTicks;
private final SliderSetting pauseOnVelocity;
private final SliderSetting storeDelay;
private final SliderSetting storePauseTicks;
private final ButtonSetting visual;
private final ButtonSetting onlyWhileKillAura;
private final Queue<Packet<?>> delayedSend = new ConcurrentLinkedQueue<>();
private final HashMap<Integer, RealPositionData> realPositions = new HashMap<>();

private final Animation animation = new Animation(Easing.EASE_OUT_CIRC, 500);
private final Progress progress = new Progress("AutoGapple");
public boolean working = false;
private int eatingTicksLeft = 0;
private int releaseLeft = 0;
private int foodSlot;
private int stored = 0;
private int pauseTicks = 0;
private boolean storeDelayed = false;
private boolean toCancel = false;

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, 40, 1));
this.registerSetting(disableKillAura = new ButtonSetting("Disable killAura", false));
this.registerSetting(airStuck = new ButtonSetting("Air stuck", false));
this.registerSetting(blink = new ButtonSetting("Blink", false));
this.registerSetting(eatTicks = new SliderSetting("Eat ticks", 31, 31, 35, 1));
this.registerSetting(pauseOnVelocity = new SliderSetting("Pause on velocity", 1, 0, 2, 1));
this.registerSetting(storeDelay = new SliderSetting("Store delay", 5, 0, 10, 1));
this.registerSetting(storePauseTicks = new SliderSetting("Store pause ticks", 1, 1, 3, 1, () -> storeDelay.getInput() > 0));
this.registerSetting(visual = new ButtonSetting("Visual", true));
this.registerSetting(onlyWhileKillAura = new ButtonSetting("Only while killAura", true));
}

@Override
public void onDisable() {
working = false;
eatingTicksLeft = 0;
releaseLeft = 0;
release();
realPositions.clear();
reset();
ProgressManager.remove(progress);
}

public void reset() {
working = false;
stored = 0;
pauseTicks = 0;
storeDelayed = false;
toCancel = false;
progress.setProgress(0);
}

@SubscribeEvent
public void onPreUpdate(PreUpdateEvent event) {
if (eatingTicksLeft == 0 && working) {
if (!Utils.nullCheck()
|| mc.thePlayer.isDead
|| mc.thePlayer.getHealth() >= minHealth.getInput()
|| (onlyWhileKillAura.isToggled() && KillAura.target == null)) {
working = false;
int lastSlot = SlotHandler.getCurrentSlot();
if (foodSlot != lastSlot)
PacketUtils.sendPacketNoEvent(new C09PacketHeldItemChange(foodSlot));
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;
return;
}

if (releaseLeft > 0) {
releaseLeft--;
}
if (stored >= eatTicks.getInput() && working) {
reset();

if (!Utils.nullCheck() || mc.thePlayer.getHealth() >= minHealth.getInput() || (onlyWhileKillAura.isToggled() && KillAura.target == null)) {
eatingTicksLeft = 0;
return;
int foodSlot = getFoodSlot();
int curSlot = SlotHandler.getCurrentSlot();
if (foodSlot != curSlot) {
SlotHandler.setCurrentSlot(foodSlot);
}
mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, SlotHandler.getHeldItem());
PacketUtils.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
Utils.sendMessage("send.");
for (int i = 0; i < stored; i++) {
PacketUtils.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));
}
if (foodSlot != curSlot) {
SlotHandler.setCurrentSlot(curSlot);
}
}

if (eatingTicksLeft > 0) {
if (getFoodSlot() != -1) {
working = true;
eatingTicksLeft--;

return;
} else {
reset();
}
}

if (releaseLeft > 0)
return;

foodSlot = eat();
if (foodSlot != -1) {
animation.reset();
eatingTicksLeft = 35;
animation.setValue(eatingTicksLeft);
mc.theWorld.playerEntities.parallelStream()
.filter(p -> p != mc.thePlayer)
.forEach(p -> realPositions.put(p.getEntityId(), new RealPositionData(p)));
}
@SubscribeEvent
public void onPreVelocity(PreVelocityEvent event) {
pauseTicks += (int) pauseOnVelocity.getInput();
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void onSendPacket(SendPacketEvent event) {
if (working) {
delayedSend.add(event.getPacket());
event.setCanceled(true);
@SubscribeEvent
public void onPreMove(PreMoveEvent event) {
if (!working) return;

if (!storeDelayed && stored % (int) storeDelay.getInput() == 1) {
storeDelayed = true;
pauseTicks = (int) storePauseTicks.getInput();
}
}

private void release() {
synchronized (delayedSend) {
for (Packet<?> p : delayedSend) {
PacketUtils.sendPacket(p);
}
delayedSend.clear();
if (pauseTicks > 0) {
pauseTicks--;
} else {
event.setCanceled(true);
stored++;
storeDelayed = false;
toCancel = true;
}
}

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

private int eat() {
public int getFoodSlot() {
int slot = -1;
for (int i = 0; i < 9; ++i) {
final ItemStack getStackInSlot = mc.thePlayer.inventory.getStackInSlot(i);
Expand All @@ -153,48 +147,13 @@ private int eat() {
}

@SubscribeEvent
public void onRender2D(TickEvent.RenderTickEvent event) {
if (!Utils.nullCheck() || mc.thePlayer.isDead) {
working = false;
eatingTicksLeft = 0;
release();
releaseLeft = (int) delayBetweenHeal.getInput();
foodSlot = -1;
}

animation.run(eatingTicksLeft);
public void onRenderTick(TickEvent.RenderTickEvent event) {
animation.run(eatTicks.getInput() - stored);
if (working && visual.isToggled()) {
progress.setProgress((32 - animation.getValue()) / 32);
progress.setProgress((eatTicks.getInput() - animation.getValue()) / eatTicks.getInput());
ProgressManager.add(progress);
} else {
ProgressManager.remove(progress);
}
}

@SubscribeEvent
public void onRender(RenderWorldLastEvent e) {
if (eatingTicksLeft == 0)
return;

for (RealPositionData data : realPositions.values()) {
data.animationX.run(data.vec3.x());
data.animationY.run(data.vec3.y());
data.animationZ.run(data.vec3.z());
Blink.drawBox(new net.minecraft.util.Vec3(data.animationX.getValue(), data.animationY.getValue(), data.animationZ.getValue()));
}
}

private static class RealPositionData {
public Vec3 vec3;
public Animation animationX = new Animation(Easing.EASE_OUT_CIRC, 150);
public Animation animationY = new Animation(Easing.EASE_OUT_CIRC, 150);
public Animation animationZ = new Animation(Easing.EASE_OUT_CIRC, 150);

public RealPositionData(EntityPlayer player) {
vec3 = new Vec3(player);
animationX.setValue(vec3.x());
animationY.setValue(vec3.y());
animationZ.setValue(vec3.z());
}
}
}
4 changes: 0 additions & 4 deletions src/main/java/keystrokesmod/module/impl/combat/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ public void onPreUpdate(PreUpdateEvent event) {
resetBlinkState(true);
return;
}
if (ModuleManager.autoGapple != null && ModuleManager.autoGapple.disableKillAura.isToggled() && ModuleManager.autoGapple.working) {
resetBlinkState(true);
return;
}

if ((mc.thePlayer.isBlocking() || block.get()) && disableWhileBlocking.isToggled()) {
resetBlinkState(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public Speed() {
.add(new BlocksMCSpeed("BlocksMC", this))
.add(new VulcanSpeed("Vulcan", this))
.add(new GrimACSpeed("GrimAC", this))
.add(new IntaveSpeed("Intave", this))
.add(new StrafeSpeed("Strafe", this))
);
this.registerSetting(liquidDisable = new ButtonSetting("Disable in liquid", true));
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/keystrokesmod/module/impl/movement/Sprint.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public Sprint() {

public static boolean omni() {
final SprintEvent event = new SprintEvent(
MoveUtil.isMoving(),
omni || ModuleManager.sprint != null && ModuleManager.sprint.isEnabled() && ModuleManager.sprint.mode.getInput() == 1
MoveUtil.canSprint(true),
omni || (ModuleManager.sprint != null && ModuleManager.sprint.isEnabled() && ModuleManager.sprint.mode.getInput() == 1)
);

return event.isSprint() && event.isOmni();
Expand All @@ -48,10 +48,9 @@ public static boolean stopSprint() {
public void p(PlayerTickEvent e) {
if (Utils.nullCheck() && mc.inGameHasFocus) {

if(ModuleManager.scaffold.isEnabled() && disableWhileScaffold.isToggled()) {
if (ModuleManager.scaffold.isEnabled() && disableWhileScaffold.isToggled()) {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), false);
}
else {
} else {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true);
}

Expand Down
Loading

0 comments on commit 2f5708b

Please sign in to comment.