From 62817f7f5f69ea741cd3c4e6199e2eeb29e97951 Mon Sep 17 00:00:00 2001 From: jackh Date: Tue, 18 Feb 2025 03:39:57 -0700 Subject: [PATCH] t --- .../components/impl/BindComponent.java | 2 +- .../components/impl/ButtonComponent.java | 14 +- .../components/impl/SliderComponent.java | 2 +- .../module/impl/combat/KillAura.java | 2 +- .../module/impl/movement/LongJump.java | 23 ++-- .../module/impl/movement/NoSlow.java | 6 +- .../module/impl/player/AutoTool.java | 51 +++++-- .../module/impl/player/BedAura.java | 7 +- .../module/impl/player/Safewalk.java | 1 + .../module/impl/player/Scaffold.java | 74 ++++++++--- .../module/impl/player/Tower.java | 67 +++++----- .../keystrokesmod/script/ScriptDefaults.java | 4 + .../keystrokesmod/script/classes/Message.java | 30 +++++ .../script/classes/WebSocket.java | 124 ++++++++++++++++++ .../keystrokesmod/utility/ModuleUtils.java | 5 +- 15 files changed, 323 insertions(+), 89 deletions(-) create mode 100644 src/main/java/keystrokesmod/script/classes/Message.java create mode 100644 src/main/java/keystrokesmod/script/classes/WebSocket.java diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java index db91012..4aaae8e 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/BindComponent.java @@ -57,7 +57,7 @@ public class BindComponent extends Component { } public boolean onClick(int x, int y, int button) { - if (this.overSetting(x, y) && this.moduleComponent.isOpened && this.moduleComponent.mod.canBeEnabled() && this.visible && (this.keySetting == null || this.keySetting.visible)) { + if (this.overSetting(x, y) && this.moduleComponent.isOpened && this.moduleComponent.mod.canBeEnabled() && this.moduleComponent.isVisible(this)) { if (button == 0) { this.isBinding = !this.isBinding; } diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java index 58e7a94..d0b8de4 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/ButtonComponent.java @@ -14,7 +14,7 @@ public class ButtonComponent extends Component { private final int enabledColor = (new Color(20, 255, 0)).getRGB(); private Module mod; public ButtonSetting buttonSetting; - private ModuleComponent p; + private ModuleComponent moduleComponent; public int o; public int x; private int y; @@ -24,7 +24,7 @@ public class ButtonComponent extends Component { public ButtonComponent(Module mod, ButtonSetting op, ModuleComponent b, int o) { this.mod = mod; this.buttonSetting = op; - this.p = b; + this.moduleComponent = b; this.x = b.categoryComponent.getX() + b.categoryComponent.getWidth(); this.y = b.categoryComponent.getY() + b.yPos; this.o = o; @@ -33,7 +33,7 @@ public class ButtonComponent extends Component { public void render() { GL11.glPushMatrix(); GL11.glScaled(0.5D, 0.5D, 0.5D); - Minecraft.getMinecraft().fontRendererObj.drawString((this.buttonSetting.isMethodButton ? "[=] " : (this.buttonSetting.isToggled() ? "[+] " : "[-] ")) + this.buttonSetting.getName(), (float) ((this.p.categoryComponent.getX() + 4) * 2) + xOffset, (float) ((this.p.categoryComponent.getY() + this.o + 4) * 2), this.buttonSetting.isToggled() ? this.enabledColor : -1, false); + Minecraft.getMinecraft().fontRendererObj.drawString((this.buttonSetting.isMethodButton ? "[=] " : (this.buttonSetting.isToggled() ? "[+] " : "[-] ")) + this.buttonSetting.getName(), (float) ((this.moduleComponent.categoryComponent.getX() + 4) * 2) + xOffset, (float) ((this.moduleComponent.categoryComponent.getY() + this.o + 4) * 2), this.buttonSetting.isToggled() ? this.enabledColor : -1, false); GL11.glScaled(1, 1, 1); if (renderLine) { //RenderUtils.drawRectangleGL((float) ((this.p.categoryComponent.getX() + 4) * 2), (float) ((this.p.categoryComponent.getY() + this.o) * 2), (float) ((this.p.categoryComponent.getX() + 4) * 2) + 1, (float) ((this.p.categoryComponent.getY() + this.o + 4) * 2) + 16, new Color(192, 192, 192).getRGB()); @@ -46,12 +46,12 @@ public class ButtonComponent extends Component { } public void drawScreen(int x, int y) { - this.y = this.p.categoryComponent.getModuleY() + this.o; - this.x = this.p.categoryComponent.getX(); + this.y = this.moduleComponent.categoryComponent.getModuleY() + this.o; + this.x = this.moduleComponent.categoryComponent.getX(); } public boolean onClick(int x, int y, int b) { - if (this.i(x, y) && b == 0 && this.p.isOpened && this.visible && this.buttonSetting.visible) { + if (this.i(x, y) && b == 0 && this.moduleComponent.isOpened && this.moduleComponent.isVisible(this)) { if (this.buttonSetting.isMethodButton) { this.buttonSetting.runMethod(); return false; @@ -66,6 +66,6 @@ public class ButtonComponent extends Component { } public boolean i(int x, int y) { - return x > this.x && x < this.x + this.p.categoryComponent.getWidth() && y > this.y && y < this.y + 11; + return x > this.x && x < this.x + this.moduleComponent.categoryComponent.getWidth() && y > this.y && y < this.y + 11; } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java index 88fb761..eb2e009 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/SliderComponent.java @@ -146,7 +146,7 @@ public class SliderComponent extends Component { @Override public boolean onClick(int mouseX, int mouseY, int button) { - if ((u(mouseX, mouseY) || i(mouseX, mouseY)) && button == 0 && this.moduleComponent.isOpened && this.visible && this.sliderSetting.visible) { + if ((u(mouseX, mouseY) || i(mouseX, mouseY)) && button == 0 && this.moduleComponent.isOpened && this.moduleComponent.isVisible(this)) { this.heldDown = true; } return false; diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index 63869f7..8f6a7b9 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -966,7 +966,7 @@ public class KillAura extends Module { if (interactTicks == 0) { firstEdge++; } - if (firstEdge > 6) { + if (firstEdge > 8) { firstEdge = 0; } interactTicks++; diff --git a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java index 9ce33bb..e2e57f0 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java @@ -157,7 +157,7 @@ public class LongJump extends Module { disabled(); } - if (spoofItem.isToggled() && lastSlot != -1) { + if (spoofItem.isToggled() && lastSlot != -1 && !manual.isToggled()) { ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(true); ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(true); } @@ -278,15 +278,14 @@ public class LongJump extends Module { fireballTime = System.currentTimeMillis(); if (!manual.isToggled()) { mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); - //((IAccessorMinecraft) mc).callRightClickMouse(); - } - if (silentSwing.isToggled()) { - mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); - } - else { - mc.thePlayer.swingItem(); - if (!spoofItem.isToggled()) { - mc.getItemRenderer().resetEquippedProgress(); + if (silentSwing.isToggled()) { + mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); + } + else { + mc.thePlayer.swingItem(); + if (!spoofItem.isToggled()) { + mc.getItemRenderer().resetEquippedProgress(); + } } } stopVelocity = true; @@ -431,7 +430,7 @@ public class LongJump extends Module { void modifyHorizontal() { if (boostSetting.getInput() != 0) { - double speed = ((boostSetting.getInput() > 1.6 && ModuleManager.scaffold.isEnabled) ? 1.6 : boostSetting.getInput()) - Utils.randomizeDouble(0.0001, 0); + double speed = boostSetting.getInput() - Utils.randomizeDouble(0.0001, 0); if (Utils.isMoving()) { Utils.setSpeed(speed); } @@ -545,4 +544,4 @@ public class LongJump extends Module { default: return -1; } } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java index 9f36044..f65e037 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java @@ -214,8 +214,10 @@ public class NoSlow extends Module { offset = false; return; } - e.setPosY(e.getPosY() + ModuleUtils.offsetValue); - offset = true; + if (mc.thePlayer.ticksExisted % 2 == 0 || mc.thePlayer.onGround) { + e.setPosY(e.getPosY() + ModuleUtils.offsetValue); + offset = true; + } if (groundSpeedOption.isToggled()) { if (!ModuleManager.killAura.isTargeting && !Utils.noSlowingBackWithBow() && !Utils.jumpDown() && mc.thePlayer.moveForward <= -0.5 && mc.thePlayer.moveStrafing == 0 && offset && Utils.isMoving() && mc.thePlayer.onGround) { float yaw = mc.thePlayer.rotationYaw; diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoTool.java b/src/main/java/keystrokesmod/module/impl/player/AutoTool.java index f1270a3..63ccc99 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoTool.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoTool.java @@ -1,5 +1,6 @@ package keystrokesmod.module.impl.player; +import keystrokesmod.Raven; import keystrokesmod.mixin.interfaces.IMixinItemRenderer; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -11,43 +12,55 @@ import org.lwjgl.input.Mouse; public class AutoTool extends Module { private SliderSetting hoverDelay; + private SliderSetting swapDelay; + private ButtonSetting rightDisable; private ButtonSetting requireCrouch; private ButtonSetting requireMouse; public ButtonSetting spoofItem; - private ButtonSetting swap; + private ButtonSetting swapBack; + + private boolean hasSwapped = false; + private int swapDelayTick = 0; public int previousSlot = -1; private long ticksHovered; public AutoTool() { super("AutoTool", category.player); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); + this.registerSetting(swapDelay = new SliderSetting("Swap delay", 0, 0, 20, 1)); this.registerSetting(rightDisable = new ButtonSetting("Disable while right click", true)); this.registerSetting(requireCrouch = new ButtonSetting("Only while crouching", false)); this.registerSetting(requireMouse = new ButtonSetting("Require mouse down", true)); this.registerSetting(spoofItem = new ButtonSetting("Spoof item", false)); - this.registerSetting(swap = new ButtonSetting("Swap to previous slot", true)); + this.registerSetting(swapBack = new ButtonSetting("Swap to previous slot", true)); this.closetModule = true; } public void onDisable() { - resetVariables(); + resetVariables(true); } - public void setSlot(final int currentItem) { - if (currentItem == -1) { + public void setSlot(int currentItem) { + if (currentItem == -1 || currentItem == mc.thePlayer.inventory.currentItem) { return; } mc.thePlayer.inventory.currentItem = currentItem; + hasSwapped = true; + swapDelayTick = (int) swapDelay.getInput(); } + public void onUpdate() { if (spoofItem.isToggled() && previousSlot != mc.thePlayer.inventory.currentItem && previousSlot != -1) { + if (Raven.debug) { + Utils.sendModuleMessage(this, "&7Modifying held item renderer"); + } ((IMixinItemRenderer) mc.getItemRenderer()).setCancelUpdate(true); ((IMixinItemRenderer) mc.getItemRenderer()).setCancelReset(true); } if (!mc.inGameHasFocus || mc.currentScreen != null || (rightDisable.isToggled() && Mouse.isButtonDown(1)) || !mc.thePlayer.capabilities.allowEdit || (requireCrouch.isToggled() && !mc.thePlayer.isSneaking())) { - resetVariables(); + resetVariables(false); return; } if (!Mouse.isButtonDown(0) && requireMouse.isToggled()) { @@ -57,7 +70,7 @@ public class AutoTool extends Module { MovingObjectPosition over = mc.objectMouseOver; if (over == null || over.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { resetSlot(); - resetVariables(); + resetVariables(true); return; } if (hoverDelay.getInput() != 0) { @@ -74,20 +87,36 @@ public class AutoTool extends Module { if (previousSlot == -1) { previousSlot = mc.thePlayer.inventory.currentItem; } - setSlot(slot); + if (!hasSwapped) { + setSlot(slot); + } + else if (slot != mc.thePlayer.inventory.currentItem) { + if (swapDelayTick-- <= 0) { + if (mc.thePlayer.inventory.currentItem != slot) { + setSlot(slot); + swapDelayTick = (int) swapDelay.getInput(); + } + } + } } - private void resetVariables() { - ticksHovered = 0; + private void resetVariables(boolean resetHover) { + if (resetHover) { + ticksHovered = 0; + } resetSlot(); previousSlot = -1; + hasSwapped = false; + swapDelayTick = 0; } private void resetSlot() { - if (previousSlot == -1 || !swap.isToggled()) { + if (previousSlot == -1 || !swapBack.isToggled()) { return; } setSlot(previousSlot); previousSlot = -1; + hasSwapped = false; + swapDelayTick = 0; } } diff --git a/src/main/java/keystrokesmod/module/impl/player/BedAura.java b/src/main/java/keystrokesmod/module/impl/player/BedAura.java index 5242c24..629579e 100644 --- a/src/main/java/keystrokesmod/module/impl/player/BedAura.java +++ b/src/main/java/keystrokesmod/module/impl/player/BedAura.java @@ -171,11 +171,12 @@ public class BedAura extends Module { @SubscribeEvent(priority = EventPriority.LOWEST) public void onPreMotion(PreMotionEvent e) { aiming = false; + if (currentBlock != null && !RotationUtils.inRange(currentBlock, range.getInput())) { + stopAutoblock = false; + return; + } if ((rotate || breakProgress >= 1 || breakProgress == 0) && (currentBlock != null || rotateLastBlock != null)) { float[] rotations = RotationUtils.getRotations(currentBlock == null ? rotateLastBlock : currentBlock, e.getYaw(), e.getPitch()); - if (currentBlock != null && !RotationUtils.inRange(currentBlock, range.getInput())) { - return; - } e.setYaw(RotationUtils.applyVanilla(rotations[0])); e.setPitch(rotations[1]); if (Raven.debug) { diff --git a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java index 65d0459..f0ffc25 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Safewalk.java +++ b/src/main/java/keystrokesmod/module/impl/player/Safewalk.java @@ -103,6 +103,7 @@ public class Safewalk extends Module { } canSneak = sneakState; mc.thePlayer.movementInput.sneak = sneakState; + mc.thePlayer.setSneaking(sneakState); this.isSneaking = sneakState; //Utils.print("Edge " + mc.thePlayer.movementInput.sneak + " " + sneakState + " " + mc.thePlayer.ticksExisted); diff --git a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java index 0cd07a5..91b47af 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java @@ -8,6 +8,7 @@ import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.movement.Bhop; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.GroupSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.*; import keystrokesmod.utility.Timer; @@ -42,6 +43,9 @@ public class Scaffold extends Module { private SliderSetting floatFirstJump; private SliderSetting fastScaffold; private SliderSetting multiPlace; + private GroupSetting multiPlaceSettings; + final private ButtonSetting mAlways, mSprint, mSprintWithSpeed, mKeepY, mKeepYWithSpeed, mTowerMove, mVerticalTower; + public ButtonSetting autoSwap; private ButtonSetting fastOnRMB; public ButtonSetting highlightBlocks; @@ -124,7 +128,17 @@ public class Scaffold extends Module { this.registerSetting(sprint = new SliderSetting("Sprint mode", 0, sprintModes)); this.registerSetting(floatFirstJump = new SliderSetting("§eFloat §rfirst jump speed", "%", 100, 50, 100, 1)); this.registerSetting(fastScaffold = new SliderSetting("Fast scaffold", 0, fastScaffoldModes)); + this.registerSetting(multiPlace = new SliderSetting("Multi-place", 0, multiPlaceModes)); + this.registerSetting(multiPlaceSettings = new GroupSetting("Multi-place settings")); + this.registerSetting(mAlways = new ButtonSetting(multiPlaceSettings, "Always", false)); + this.registerSetting(mSprint = new ButtonSetting(multiPlaceSettings, "Sprint scaffold", false)); + this.registerSetting(mSprintWithSpeed = new ButtonSetting(multiPlaceSettings, "Sprint scaffold with speed", false)); + this.registerSetting(mKeepY = new ButtonSetting(multiPlaceSettings, "Keep-Y", false)); + this.registerSetting(mKeepYWithSpeed = new ButtonSetting(multiPlaceSettings, "Keep-Y with speed", false)); + this.registerSetting(mTowerMove = new ButtonSetting(multiPlaceSettings, "Tower move", false)); + this.registerSetting(mVerticalTower = new ButtonSetting(multiPlaceSettings, "Vertical tower", false)); + this.registerSetting(autoSwap = new ButtonSetting("Auto swap", true)); this.registerSetting(fastOnRMB = new ButtonSetting("Fast on RMB", true)); this.registerSetting(highlightBlocks = new ButtonSetting("Highlight blocks", true)); @@ -141,6 +155,7 @@ public class Scaffold extends Module { public void guiUpdate() { this.floatFirstJump.setVisible(sprint.getInput() == 2, this); + this.multiPlaceSettings.setVisible(multiPlace.getInput() > 0, this); } public void onDisable() { @@ -217,7 +232,7 @@ public class Scaffold extends Module { } //Float - if (sprint.getInput() == 2 && !usingFastScaffold() && !fastScaffoldKeepY && !ModuleManager.bhop.isEnabled() && !ModuleManager.tower.canTower() && !ModuleManager.LongJump.function) { + if (sprint.getInput() == 2 && !usingFastScaffold() && !fastScaffoldKeepY && !ModuleManager.tower.canTower() && !LongJump.function) { floatWasEnabled = true; if (!floatStarted) { if (ModuleUtils.groundTicks > 8 && mc.thePlayer.onGround) { @@ -283,37 +298,37 @@ public class Scaffold extends Module { if (quad <= 5 || quad >= 85) { yawAngle = 126.50F; minOffset = 13; - minPitch = 77.08F; + minPitch = 71.08F; } if (quad > 5 && quad <= 15 || quad >= 75 && quad < 85) { yawAngle = 127.50F; minOffset = 10; - minPitch = 77.34F; + minPitch = 72.34F; } if (quad > 15 && quad <= 25 || quad >= 65 && quad < 75) { yawAngle = 128.50F; minOffset = 7; - minPitch = 77.65F; + minPitch = 73.65F; } if (quad > 25 && quad <= 32 || quad >= 58 && quad < 65) { yawAngle = 130F; minOffset = 6; - minPitch = 78.13F; + minPitch = 74.13F; } if (quad > 32 && quad <= 38 || quad >= 52 && quad < 58) { yawAngle = 131.50F; minOffset = 4; - minPitch = 78.41F; + minPitch = 75.41F; } if (quad > 38 && quad <= 42 || quad >= 48 && quad < 52) { yawAngle = 133.50F; minOffset = 2; - minPitch = 79.54F; + minPitch = 76.54F; } if (quad > 42 && quad <= 45 || quad >= 45 && quad < 48) { yawAngle = 137F; minOffset = 1; - minPitch = 79.93F; + minPitch = 77.43F; } //Utils.print("" + minOffset); //float offsetAmountD = ((((float) offsetAmount.getInput() / 10) - 10) * -2) - (((float) offsetAmount.getInput() / 10) - 10); @@ -333,7 +348,7 @@ public class Scaffold extends Module { } else { scaffoldYaw = mc.thePlayer.rotationYaw - hardcodedYaw(); - scaffoldPitch = 77f; + scaffoldPitch = 78f; } e.setRotations(scaffoldYaw, scaffoldPitch); break; @@ -395,7 +410,6 @@ public class Scaffold extends Module { was451 = false; } } - double minSwitch = (!Utils.scaffoldDiagonal(false)) ? 9 : 15; if (side >= 0) { if (yawOffset <= -minSwitch && firstStroke == 0) { @@ -558,11 +572,14 @@ public class Scaffold extends Module { } } - @SubscribeEvent - public void onPostPlayerInput(PostPlayerInputEvent e) { + @SubscribeEvent(priority = EventPriority.LOWEST) + public void onMoveInput(PrePlayerInputEvent e) { if (!ModuleManager.scaffold.isEnabled) { return; } + if (fastScaffold.getInput() == 0) { + return; + } mc.thePlayer.movementInput.jump = false; } @@ -741,7 +758,7 @@ public class Scaffold extends Module { private int handleFastScaffolds() { if (fastOnRMB.isToggled()) { - return Mouse.isButtonDown(1) && Utils.tabbedIn() ? (int) fastScaffold.getInput() : (int) sprint.getInput(); + return fastScaffold.getInput() > 0 && Mouse.isButtonDown(1) && Utils.tabbedIn() ? (int) fastScaffold.getInput() : (int) sprint.getInput(); } else { return fastScaffold.getInput() > 0 ? (int) fastScaffold.getInput() : (int) sprint.getInput(); @@ -814,11 +831,10 @@ public class Scaffold extends Module { private void placeBlock(int yOffset, int xOffset) { locateAndPlaceBlock(yOffset, xOffset); int input = (int) multiPlace.getInput(); - if (sprint.getInput() == 0 && mc.thePlayer.onGround && !ModuleManager.tower.canTower() && !usingFastScaffold()) { - return; - } - if (ModuleManager.tower.canTower() && !ModuleManager.tower.tower) { - return; + if (!mAlways.isToggled()) { + if (!handleMultiPlaceSettings()) { + return; + } } if (input >= 1) { locateAndPlaceBlock(yOffset, xOffset); @@ -828,6 +844,28 @@ public class Scaffold extends Module { } } + private boolean handleMultiPlaceSettings() { + if (mTowerMove.isToggled() && ModuleManager.tower.towerMove.getInput() != 0 && (ModuleManager.tower.canTower() && Utils.keysDown() && ModuleManager.tower.towering || ModuleManager.tower.finishedTower)) { + return true; + } + if (mVerticalTower.isToggled() && ModuleManager.tower.verticalTower.getInput() != 0 && ModuleManager.tower.canTower() && !Utils.keysDown()) { + return true; + } + if (mSprint.isToggled() && sprint.getInput() != 0 && !usingFastScaffold() && !ModuleManager.tower.canTower()) { + return true; + } + if (mSprintWithSpeed.isToggled() && sprint.getInput() != 0 && !usingFastScaffold() && getSpeedLevel() > 0 && !ModuleManager.tower.canTower()) { + return true; + } + if (mKeepY.isToggled() && fastScaffold.getInput() != 0 && usingFastScaffold() && !ModuleManager.tower.canTower()) { + return true; + } + if (mKeepYWithSpeed.isToggled() && fastScaffold.getInput() != 0 && usingFastScaffold() && getSpeedLevel() > 0 && !ModuleManager.tower.canTower()) { + return true; + } + return false; + } + private void locateAndPlaceBlock(int yOffset, int xOffset) { locateBlocks(yOffset, xOffset); if (blockInfo == null) { diff --git a/src/main/java/keystrokesmod/module/impl/player/Tower.java b/src/main/java/keystrokesmod/module/impl/player/Tower.java index 1422cdc..d89e148 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/player/Tower.java @@ -14,12 +14,13 @@ import net.minecraft.network.play.client.*; import net.minecraft.network.play.server.S12PacketEntityVelocity; import net.minecraft.network.play.server.S27PacketExplosion; import net.minecraft.potion.PotionEffect; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Tower extends Module { - final private SliderSetting towerMove; + final public SliderSetting towerMove; private SliderSetting speedSetting; - final private SliderSetting verticalTower; + final public SliderSetting verticalTower; final private SliderSetting slowedSpeed; final private SliderSetting slowedTicks; final private ButtonSetting disableWhileHurt; @@ -32,7 +33,7 @@ public class Tower extends Module { private int slowTicks; private boolean wasTowering; private int towerTicks; - public boolean tower; + public boolean towering; private boolean hasTowered, startedTowerInAir, setLowMotion, firstJump; private int cMotionTicks, placeTicks; public int dCount; @@ -40,6 +41,8 @@ public class Tower extends Module { public float pitch; + public boolean finishedTower; + //vertical tower private boolean aligning, aligned, placed; private int blockX; @@ -97,7 +100,7 @@ public class Tower extends Module { break; case 4: - if (tower) { + if (towering) { if (towerTicks == 6) { e.setPosY(e.getPosY() + 0.000383527); ModuleManager.scaffold.rotateForward(); @@ -119,10 +122,11 @@ public class Tower extends Module { int valY = (int) Math.round((mc.thePlayer.posY % 1) * 10000); int simpleY = (int) Math.round((mc.thePlayer.posY % 1.0D) * 100.0D); if (canTower() && Utils.keysDown()) { - wasTowering = true; + speed = false; + wasTowering = hasTowered = true; if (disableWhileHurt.isToggled() && ModuleUtils.damage) { towerTicks = 0; - tower = false; + towering = false; return; } switch ((int) towerMove.getInput()) { @@ -162,10 +166,10 @@ public class Tower extends Module { } break; case 3: - if (mc.thePlayer.posY % 1 == 0 && !setLowMotion) { - tower = true; + if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround && !setLowMotion) { + towering = true; } - if (tower) { + if (towering) { if (valY == 0) { mc.thePlayer.motionY = 0.42f; Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel())); @@ -175,13 +179,11 @@ public class Tower extends Module { mc.thePlayer.motionY = 0.33f; Utils.setSpeed(getTowerSpeed(getSpeedLevel())); speed = true; - hasTowered = true; } else if (valY > 7000) { if (setLowMotion) { - tower = false; + towering = false; } - speed = false; mc.thePlayer.motionY = 1 - mc.thePlayer.posY % 1f; } } @@ -194,17 +196,16 @@ public class Tower extends Module { else if (cMotionTicks == 4) { cMotionTicks = 0; setLowMotion = false; - tower = true; + towering = true; Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel()) - 0.02); } } break; case 4: - speed = false; - if (mc.thePlayer.posY % 1 == 0) { - tower = true; + if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround) { + towering = true; } - if (tower) { + if (towering) { towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks; switch (simpleY) { case 0: @@ -227,11 +228,10 @@ public class Tower extends Module { } break; case 5: - speed = false; - if (mc.thePlayer.posY % 1 == 0) { - tower = true; + if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround) { + towering = true; } - if (tower) { + if (towering) { towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks; switch (towerTicks) { case 0: @@ -264,14 +264,13 @@ public class Tower extends Module { } break; case 6: - speed = false; - if (mc.thePlayer.onGround) { + if (mc.thePlayer.posY % 1 == 0 && mc.thePlayer.onGround) { grounds++; } if (mc.thePlayer.posY % 1 == 0) { - tower = true; + towering = true; } - if (tower) { + if (towering) { towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks; switch (towerTicks) { case 0: @@ -295,6 +294,12 @@ public class Tower extends Module { } } else { + if (finishedTower) { + finishedTower = false; + } + if (hasTowered) { + finishedTower = true; + } if (wasTowering && modulesEnabled()) { if (slowedTicks.getInput() > 0 && slowedTicks.getInput() != 100 && slowTicks++ < slowedTicks.getInput()) { mc.thePlayer.motionX *= slowedSpeed.getInput() / 100; @@ -314,10 +319,10 @@ public class Tower extends Module { } slowTicks = 0; } - if (speed) { - Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 2); + if (speed || hasTowered && mc.thePlayer.onGround) { + Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 1.6); } - hasTowered = tower = firstJump = startedTowerInAir = setLowMotion = speed = false; + hasTowered = towering = firstJump = startedTowerInAir = setLowMotion = speed = false; cMotionTicks = placeTicks = towerTicks = grounds = 0; reset(); } @@ -374,8 +379,8 @@ public class Tower extends Module { return canTower() && !Utils.keysDown() && verticalTower.getInput() == 2; } - @SubscribeEvent - public void onPostPlayerInput(PostPlayerInputEvent e) { + @SubscribeEvent(priority = EventPriority.LOWEST) + public void onMoveInput(PrePlayerInputEvent e) { if (!ModuleManager.scaffold.isEnabled) { return; } @@ -428,7 +433,7 @@ public class Tower extends Module { private void reset() { towerTicks = 0; - tower = false; + towering = false; placeTicks = 0; setLowMotion = false; } diff --git a/src/main/java/keystrokesmod/script/ScriptDefaults.java b/src/main/java/keystrokesmod/script/ScriptDefaults.java index 41f0121..cea43a3 100644 --- a/src/main/java/keystrokesmod/script/ScriptDefaults.java +++ b/src/main/java/keystrokesmod/script/ScriptDefaults.java @@ -121,6 +121,10 @@ public class ScriptDefaults { Utils.sendRawMessage(s); } + public static void print(Message component) { + mc.thePlayer.addChatMessage(component.component); + } + public static boolean isDiagonal() { return Utils.isDiagonal(false); } diff --git a/src/main/java/keystrokesmod/script/classes/Message.java b/src/main/java/keystrokesmod/script/classes/Message.java new file mode 100644 index 0000000..8cbf866 --- /dev/null +++ b/src/main/java/keystrokesmod/script/classes/Message.java @@ -0,0 +1,30 @@ +package keystrokesmod.script.classes; + +import keystrokesmod.utility.Utils; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; + +public class Message { + public ChatComponentText component; + + public Message(String message) { + this.component = new ChatComponentText(message); + } + + public void appendStyle(String style, String action, String styleMessage, String message) { + ChatStyle chatStyle = new ChatStyle(); + if (style.equals("HOVER")) { + chatStyle.setChatHoverEvent(new HoverEvent(Utils.getEnum(HoverEvent.Action.class, action), new ChatComponentText(styleMessage))); + } + else if (style.equals("CLICK")) { + chatStyle.setChatClickEvent(new ClickEvent(Utils.getEnum(ClickEvent.Action.class, action), styleMessage)); + } + component.appendSibling(new ChatComponentText(message).setChatStyle(chatStyle)); + } + + public void append(String append) { + component.appendSibling(new ChatComponentText(append)); + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/script/classes/WebSocket.java b/src/main/java/keystrokesmod/script/classes/WebSocket.java new file mode 100644 index 0000000..b727009 --- /dev/null +++ b/src/main/java/keystrokesmod/script/classes/WebSocket.java @@ -0,0 +1,124 @@ +package keystrokesmod.script.classes; + +import org.java_websocket.client.WebSocketClient; +import org.java_websocket.handshake.ServerHandshake; + +import java.net.URI; +import java.util.Map; + +public class WebSocket { + private final WebSocketClient client; + + public WebSocket(String serverURI) { + this.client = createWebSocketClient(serverURI); + } + + public WebSocket(String serverUri, Map httpHeaders) { + this.client = createWebSocketClient(serverUri, httpHeaders); + } + + private WebSocketClient createWebSocketClient(String serverUri) { + return new WebSocketClient(toURI(serverUri)) { + @Override + public void onOpen(ServerHandshake handshakedata) { + WebSocket.this.onOpen(handshakedata.getHttpStatus(), handshakedata.getHttpStatusMessage()); + } + @Override + public void onMessage(String message) { + WebSocket.this.onMessage(message); + } + @Override + public void onClose(int code, String reason, boolean remote) { + WebSocket.this.onClose(code, reason, remote); + } + @Override + public void onError(Exception ex) { + WebSocket.this.onError(ex); + } + }; + } + + private WebSocketClient createWebSocketClient(String serverUri, Map httpHeaders) { + return new WebSocketClient(toURI(serverUri), httpHeaders) { + @Override + public void onOpen(ServerHandshake handshakedata) { + WebSocket.this.onOpen(handshakedata.getHttpStatus(), handshakedata.getHttpStatusMessage()); + } + @Override + public void onMessage(String message) { + WebSocket.this.onMessage(message); + } + @Override + public void onClose(int code, String reason, boolean remote) { + WebSocket.this.onClose(code, reason, remote); + } + @Override + public void onError(Exception ex) { + WebSocket.this.onError(ex); + } + }; + } + + private static URI toURI(String uri) { + try { + return new URI(uri); + } + catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public void onOpen(short status, String message) { + + } + + public void onMessage(String message) { + + } + + public void onClose(int code, String reason, boolean remote) { + + } + + public void onError(Exception ex) { + + } + + public boolean connect(boolean block) { + if (block) { + try { + return client.connectBlocking(); + } + catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + else { + client.connect(); + } + return true; + } + + public void send(String message) { + client.send(message); + } + + public void close(boolean block) { + if (block) { + try { + client.closeBlocking(); + } + catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + else { + client.close(); + } + } + + public boolean isOpen() { + return this.client == null ? false : this.client.isOpen(); + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/utility/ModuleUtils.java b/src/main/java/keystrokesmod/utility/ModuleUtils.java index 6149152..e2390ee 100644 --- a/src/main/java/keystrokesmod/utility/ModuleUtils.java +++ b/src/main/java/keystrokesmod/utility/ModuleUtils.java @@ -43,7 +43,7 @@ public class ModuleUtils { private long FIREBALL_TIMEOUT = 500L, fireballTime = 0; public static int inAirTicks, groundTicks, stillTicks; public static int fadeEdge; - public static double offsetValue = 0.0000000000201; + public static double offsetValue = 0.0000000000003; public static boolean isAttacking; private int attackingTicks; private int unTargetTicks; @@ -230,13 +230,14 @@ public class ModuleUtils { if ((canSlow || ModuleManager.scaffold.moduleEnabled && !ModuleManager.tower.canTower()) && !mc.thePlayer.onGround) { double motionVal = 0.9507832 - ((double) inAirTicks / 10000) - Utils.randomizeDouble(0.00001, 0.00006); - if (mc.thePlayer.hurtTime == 0 && inAirTicks >= 4 && !setSlow) { + if (mc.thePlayer.hurtTime == 0 && inAirTicks >= 5 && !setSlow) { mc.thePlayer.motionX *= motionVal; mc.thePlayer.motionZ *= motionVal; setSlow = true; //Utils.print("Slow " + motionVal); } didSlow = true; + //Utils.print(mc.thePlayer.ticksExisted + " : " + Utils.getHorizontalSpeed()); } else if (didSlow) { canSlow = didSlow = false;