diff --git a/src/main/java/keystrokesmod/Raven.java b/src/main/java/keystrokesmod/Raven.java index 7b695119c..9913c490e 100644 --- a/src/main/java/keystrokesmod/Raven.java +++ b/src/main/java/keystrokesmod/Raven.java @@ -75,6 +75,7 @@ public void init(FMLInitializationEvent ignored) { FMLCommonHandler.instance().bus().register(ModuleManager.tower); FMLCommonHandler.instance().bus().register(ModuleManager.rotationHandler); FMLCommonHandler.instance().bus().register(ModuleManager.slotHandler); + FMLCommonHandler.instance().bus().register(ModuleManager.dynamicManager); try { ViaMCP.create(); diff --git a/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java b/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java index 9a0b01266..c510b2c15 100644 --- a/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java +++ b/src/main/java/keystrokesmod/clickgui/components/impl/ModuleComponent.java @@ -35,8 +35,13 @@ public ModuleComponent(Module mod, CategoryComponent p, int o) { this.o = o; this.settings = new ArrayList<>(); this.po = false; + updateSetting(); + } + + public void updateSetting() { int y = o + 12; if (mod != null && !mod.getSettings().isEmpty()) { + this.settings.clear(); for (Setting v : mod.getSettings()) { this.settings.add(Component.fromSetting(v, this, y)); y += 12; diff --git a/src/main/java/keystrokesmod/mixins/impl/client/MixinInventoryPlayer.java b/src/main/java/keystrokesmod/mixins/impl/client/MixinInventoryPlayer.java index 950e153b8..e164cce60 100644 --- a/src/main/java/keystrokesmod/mixins/impl/client/MixinInventoryPlayer.java +++ b/src/main/java/keystrokesmod/mixins/impl/client/MixinInventoryPlayer.java @@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(InventoryPlayer.class) -public class MixinInventoryPlayer { +public abstract class MixinInventoryPlayer { @Shadow public EntityPlayer player; diff --git a/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java b/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java index 8e38add9b..31d3d3a2d 100644 --- a/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java +++ b/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java @@ -1,24 +1,51 @@ package keystrokesmod.mixins.impl.client; import keystrokesmod.event.PreTickEvent; +import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.HitBox; import keystrokesmod.module.impl.combat.Reach; +import keystrokesmod.module.impl.render.Animations; import keystrokesmod.module.impl.render.FreeLook; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.MinecraftForge; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(Minecraft.class) -public class MixinMinecraft { +@Mixin(value = Minecraft.class, priority = 1001) +public abstract class MixinMinecraft { + + @Shadow public GameSettings gameSettings; + + @Shadow public EntityPlayerSP thePlayer; + + @Shadow protected abstract void clickMouse(); + + @Shadow public MovingObjectPosition objectMouseOver; @Inject(method = "runTick", at = @At("HEAD")) private void runTickPre(CallbackInfo ci) { MinecraftForge.EVENT_BUS.post(new PreTickEvent()); } + @Inject(method = "runTick", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;onStoppedUsingItem(Lnet/minecraft/entity/player/EntityPlayer;)V", + shift = At.Shift.BY, by = 2 + )) + private void onRunTick$usingWhileDigging(CallbackInfo ci) { + if (ModuleManager.animations != null && ModuleManager.animations.isEnabled() && Animations.swingWhileDigging.isToggled() + && this.gameSettings.keyBindAttack.isKeyDown()) { + if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + clickMouse(); + } + } + } + /** * @author xia__mc * @reason to fix reach and hitBox won't work with autoClicker diff --git a/src/main/java/keystrokesmod/mixins/impl/client/MixinPlayerControllerMP.java b/src/main/java/keystrokesmod/mixins/impl/client/MixinPlayerControllerMP.java index c2f7de210..9e114c44a 100644 --- a/src/main/java/keystrokesmod/mixins/impl/client/MixinPlayerControllerMP.java +++ b/src/main/java/keystrokesmod/mixins/impl/client/MixinPlayerControllerMP.java @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(PlayerControllerMP.class) -public class MixinPlayerControllerMP { +public abstract class MixinPlayerControllerMP { @Shadow private int currentPlayerItem; diff --git a/src/main/java/keystrokesmod/module/Module.java b/src/main/java/keystrokesmod/module/Module.java index 23f04dba8..a26dc1def 100644 --- a/src/main/java/keystrokesmod/module/Module.java +++ b/src/main/java/keystrokesmod/module/Module.java @@ -16,7 +16,7 @@ import java.util.Iterator; public class Module { - protected ArrayList settings; + protected final ArrayList settings; private final String moduleName; private String prettyName; private final Module.category moduleCategory; @@ -172,7 +172,9 @@ public ArrayList getSettings() { } public void registerSetting(Setting setting) { - this.settings.add(setting); + synchronized (settings) { + this.settings.add(setting); + } } public void registerSetting(Setting @NotNull ... setting) { @@ -182,7 +184,9 @@ public void registerSetting(Setting @NotNull ... setting) { } public void unregisterSetting(Setting setting) { - this.settings.remove(setting); + synchronized (settings) { + this.settings.remove(setting); + } } public Module.category moduleCategory() { diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index d21f8ccb5..2825cf282 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -11,7 +11,6 @@ import keystrokesmod.module.impl.render.*; import keystrokesmod.module.impl.world.*; import keystrokesmod.utility.Utils; -import keystrokesmod.utility.profile.Manager; import java.util.ArrayList; import java.util.Comparator; @@ -20,6 +19,7 @@ public class ModuleManager { static List modules = new ArrayList<>(); public static List organizedModules = new ArrayList<>(); + public static Module longJump; public static Module blink; public static Module nameHider; @@ -95,133 +95,151 @@ public class ModuleManager { public static Ambience ambience; public static KillAuraV2 killAuraV2; public static DynamicManager dynamicManager; - + public void register() { - this.addModule(autoClicker = new AutoClicker()); - this.addModule(longJump = new LongJump()); + + // client + this.addModule(commandChat = new CommandChat()); + this.addModule(commandLine = new CommandLine()); + this.addModule(dynamicManager = new DynamicManager()); + this.addModule(new Gui()); + // this.addModule(new NyaProxy()); + this.addModule(new Settings()); + + // combat this.addModule(new AimAssist()); - this.addModule(blink = new Blink()); + this.addModule(autoClicker = new AutoClicker()); + this.addModule(blockHit = new BlockHit()); this.addModule(new BurstClicker()); this.addModule(new ClickAssist()); - this.addModule(tower = new Tower()); - this.addModule(new DelayRemover()); + this.addModule(criticals = new Criticals()); this.addModule(hitBox = new HitBox()); - this.addModule(new Radar()); - this.addModule(new Settings()); + this.addModule(hitSelect = new HitSelect()); + this.addModule(infiniteAura = new InfiniteAura()); + this.addModule(new JumpReset()); + this.addModule(killAura = new KillAura()); + this.addModule(killAuraV2 = new KillAuraV2()); + this.addModule(moreKB = new MoreKB()); this.addModule(reach = new Reach()); + this.addModule(reduce = new Reduce()); this.addModule(new RodAimbot()); - this.addModule(speed = new Speed()); - this.addModule(invManager = new InvManager()); - this.addModule(scaffold = new Scaffold()); - this.addModule(new AntiAFK()); - this.addModule(new AutoTool()); + this.addModule(timerRange = new TimerRange()); + this.addModule(velocity = new Velocity()); + + // fun + this.addModule(new ExtraBobbing()); + this.addModule(new FlameTrail()); + this.addModule(new SlyPort()); + this.addModule(new Spin()); + + // minigames + this.addModule(new AutoWho()); + this.addModule(bedwars = new BedWars()); + this.addModule(new BridgeInfo()); + this.addModule(new DuelsStats()); + this.addModule(murderMystery = new MurderMystery()); + this.addModule(new SumoFences()); + + // movement this.addModule(fly = new Fly()); this.addModule(new InvMove()); - this.addModule(new Trajectories()); - this.addModule(potions = new Potions()); - this.addModule(new AutoSwap()); this.addModule(keepSprint = new KeepSprint()); - this.addModule(bedAura = new BedAura()); + this.addModule(longJump = new LongJump()); + this.addModule(motionModifier = new MotionModifier()); this.addModule(noSlow = new NoSlow()); - this.addModule(new Indicators()); - this.addModule(new LatencyAlerts()); + this.addModule(phase = new Phase()); + this.addModule(speed = new Speed()); this.addModule(sprint = new Sprint()); + this.addModule(step = new Step()); this.addModule(new StopMotion()); + this.addModule(targetStrafe = new TargetStrafe()); this.addModule(timer = new Timer()); this.addModule(new VClip()); + + // other + this.addModule(new Anticheat()); + this.addModule(autoPlay = new AutoPlay()); + this.addModule(autoRespawn = new AutoRespawn()); + this.addModule(clickRecorder = new ClickRecorder()); + this.addModule(clientSpoofer = new ClientSpoofer()); + this.addModule(new FakeChat()); + this.addModule(new LatencyAlerts()); + this.addModule(modSpoofer = new ModSpoofer()); + this.addModule(motionSkidder = new MotionSkidder()); + this.addModule(nameHider = new NameHider()); + this.addModule(panic = new Panic()); + this.addModule(pingSpoof = new PingSpoof()); + this.addModule(recordClick = new RecordClick()); + this.addModule(rotationHandler = new RotationHandler()); + this.addModule(new ScreenshotHelper()); + this.addModule(slotHandler = new SlotHandler()); + this.addModule(staffDetector = new StaffDetector()); + + // player + this.addModule(new AntiAFK()); + this.addModule(antiFireball = new AntiFireball()); + this.addModule(antiVoid = new AntiVoid()); + this.addModule(autoHeal = new AutoHeal()); this.addModule(new AutoJump()); - this.addModule(new AutoPlace()); - this.addModule(fastPlace = new FastPlace()); + this.addModule(new AutoPot()); + this.addModule(new AutoSwap()); + this.addModule(backtrack = new Backtrack()); + this.addModule(blink = new Blink()); + this.addModule(chestStealer = new ChestStealer()); + this.addModule(new DelayRemover()); + this.addModule(new FakeLag()); this.addModule(new Freecam()); + this.addModule(invManager = new InvManager()); this.addModule(noFall = new NoFall()); - this.addModule(safeWalk = new SafeWalk()); - this.addModule(reduce = new Reduce()); - this.addModule(velocity = new Velocity()); - this.addModule(antiBot = new AntiBot()); + this.addModule(new NoRotate()); + + // render + this.addModule(ambience = new Ambience()); + this.addModule(animations = new Animations()); this.addModule(antiShuffle = new AntiShuffle()); + this.addModule(bedESP = new BedESP()); + this.addModule(new BreakProgress()); this.addModule(new Chams()); this.addModule(new ChestESP()); - this.addModule(new Nametags()); - this.addModule(playerESP = new PlayerESP()); - this.addModule(new Tracers()); + this.addModule(customCape = new CustomCape()); + this.addModule(customName = new CustomName()); + this.addModule(freeLook = new FreeLook()); + this.addModule(fullBright = new FullBright()); this.addModule(hud = new HUD()); - this.addModule(new Anticheat()); - this.addModule(new BreakProgress()); - this.addModule(moreKB = new MoreKB()); - this.addModule(new Xray()); - this.addModule(new BridgeInfo()); - this.addModule(new TargetHUD()); - this.addModule(new DuelsStats()); - this.addModule(antiFireball = new AntiFireball()); - this.addModule(bedESP = new BedESP()); - this.addModule(murderMystery = new MurderMystery()); - this.addModule(new keystrokesmod.script.Manager()); - this.addModule(new SumoFences()); - this.addModule(new ExtraBobbing()); - this.addModule(killAura = new KillAura()); - this.addModule(new FlameTrail()); - this.addModule(new SlyPort()); + this.addModule(new Indicators()); this.addModule(new ItemESP()); this.addModule(new MobESP()); - this.addModule(new Spin()); - this.addModule(new NoRotate()); - this.addModule(new FakeChat()); - this.addModule(nameHider = new NameHider()); - this.addModule(new FakeLag()); - this.addModule(new WaterBucket()); - this.addModule(commandLine = new CommandLine()); - this.addModule(bedwars = new BedWars()); - this.addModule(fastMine = new FastMine()); - this.addModule(new JumpReset()); - this.addModule(new Manager()); - this.addModule(new ViewPackets()); - this.addModule(new AutoWho()); - this.addModule(new Gui()); - this.addModule(new Shaders()); - this.addModule(motionSkidder = new MotionSkidder()); - this.addModule(motionModifier = new MotionModifier()); - this.addModule(antiVoid = new AntiVoid()); - this.addModule(criticals = new Criticals()); - this.addModule(timerRange = new TimerRange()); - this.addModule(targetStrafe = new TargetStrafe()); - this.addModule(autoHeal = new AutoHeal()); - this.addModule(hitSelect = new HitSelect()); - this.addModule(noHurtCam = new NoHurtCam()); - this.addModule(noCameraClip = new NoCameraClip()); - this.addModule(autoPlay = new AutoPlay()); - this.addModule(customName = new CustomName()); - this.addModule(commandChat = new CommandChat()); - this.addModule(phase = new Phase()); - this.addModule(pingSpoof = new PingSpoof()); + this.addModule(new Nametags()); this.addModule(noBackground = new NoBackground()); - this.addModule(blockIn = new BlockIn()); - this.addModule(backtrack = new Backtrack()); + this.addModule(noCameraClip = new NoCameraClip()); + this.addModule(noHurtCam = new NoHurtCam()); this.addModule(particles = new Particles()); - this.addModule(recordClick = new RecordClick()); - this.addModule(clickRecorder = new ClickRecorder()); - this.addModule(infiniteAura = new InfiniteAura()); - this.addModule(legitScaffold = new LegitScaffold()); - this.addModule(freeLook = new FreeLook()); - this.addModule(step = new Step()); - this.addModule(animations = new Animations()); - this.addModule(chestStealer = new ChestStealer()); - this.addModule(rotationHandler = new RotationHandler()); - this.addModule(customCape = new CustomCape()); - this.addModule(clientSpoofer = new ClientSpoofer()); - this.addModule(blockHit = new BlockHit()); - this.addModule(fullBright = new FullBright()); - this.addModule(new AutoPot()); - this.addModule(modSpoofer = new ModSpoofer()); - this.addModule(panic = new Panic()); - this.addModule(slotHandler = new SlotHandler()); - this.addModule(staffDetector = new StaffDetector()); + this.addModule(playerESP = new PlayerESP()); + this.addModule(potions = new Potions()); + this.addModule(new Radar()); + this.addModule(new Shaders()); + this.addModule(new TargetHUD()); + this.addModule(new Tracers()); + this.addModule(new Trajectories()); + this.addModule(new Xray()); + + // world + this.addModule(antiBot = new AntiBot()); + this.addModule(new AutoPlace()); + this.addModule(new AutoTool()); this.addModule(new AutoWeapon()); - this.addModule(autoRespawn = new AutoRespawn()); - this.addModule(ambience = new Ambience()); + this.addModule(bedAura = new BedAura()); + this.addModule(blockIn = new BlockIn()); this.addModule(clutch = new Clutch()); - this.addModule(killAuraV2 = new KillAuraV2()); - this.addModule(dynamicManager = new DynamicManager()); - this.addModule(new ScreenshotHelper()); + this.addModule(fastMine = new FastMine()); + this.addModule(fastPlace = new FastPlace()); + this.addModule(legitScaffold = new LegitScaffold()); + this.addModule(safeWalk = new SafeWalk()); + this.addModule(scaffold = new Scaffold()); + this.addModule(tower = new Tower()); + this.addModule(new WaterBucket()); + + // enable antiBot.enable(); commandChat.enable(); modules.sort(Comparator.comparing(Module::getPrettyName)); @@ -263,4 +281,4 @@ public static void sort() { organizedModules.sort((o1, o2) -> Utils.mc.fontRendererObj.getStringWidth(o2.getPrettyName() + ((HUD.showInfo.isToggled() && !o2.getInfo().isEmpty()) ? " " + o2.getInfo() : "")) - Utils.mc.fontRendererObj.getStringWidth(o1.getPrettyName() + (HUD.showInfo.isToggled() && !(o1.getInfo().isEmpty()) ? " " + o1.getInfo() : ""))); } } -} +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java b/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java index 874a153d8..8830a83d3 100644 --- a/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java +++ b/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java @@ -2,16 +2,20 @@ import com.mojang.realmsclient.gui.ChatFormatting; import keystrokesmod.Raven; +import keystrokesmod.clickgui.ClickGui; +import keystrokesmod.clickgui.components.impl.ModuleComponent; import keystrokesmod.dynamic.Dynamic; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.setting.Setting; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.utility.Utils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import javax.tools.JavaCompiler; -import javax.tools.ToolProvider; +import javax.tools.*; +import java.awt.*; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -21,6 +25,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; +import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -30,14 +35,28 @@ public final class DynamicManager extends Module { public static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); private static final Set activeDynamics = new HashSet<>(); + private boolean needToLoad = false; public DynamicManager() { - super("DynamicManager", category.experimental); + super("DynamicManager", category.client); + this.registerSetting(new ButtonSetting("Load dynamics", () -> needToLoad = true)); + this.registerSetting(new ButtonSetting("Open folder", () -> { + try { + Desktop.getDesktop().open(directory); + } + catch (IOException ex) { + Raven.profileManager.directory.mkdirs(); + Utils.sendMessage("&cError locating folder, recreated."); + } + })); + this.registerSetting(new DescriptionSetting("Dynamics:", () -> !activeDynamics.isEmpty())); + this.canBeEnabled = false; + directory = new File(Raven.mc.mcDataDir + File.separator + "keystrokes", "dynamics"); if (!directory.exists()) { boolean success = directory.mkdirs(); if (!success) { - System.out.println("There was an issue creating dynamics directory."); + Utils.sendMessage("There was an issue creating dynamics directory."); return; } } @@ -45,22 +64,40 @@ public DynamicManager() { if (!cacheDirectory.exists()) { boolean success = cacheDirectory.mkdirs(); if (!success) { - System.out.println("There was an issue creating dynamics cache directory."); + Utils.sendMessage("There was an issue creating dynamics cache directory."); return; } } - this.registerSetting(new ButtonSetting("Load dynamics", this::loadDynamics)); - this.registerSetting(new DescriptionSetting("Dynamics:", () -> !activeDynamics.isEmpty())); - this.canBeEnabled = false; - loadDynamics(); } + @SubscribeEvent + public void onPreUpdate(PreUpdateEvent event) { + if (needToLoad) { + needToLoad = false; + loadDynamics(); + } + } + public void loadDynamics() { if (!directory.exists() || !directory.isDirectory()) return; + unregister: + for (Setting setting : (List) settings.clone()) { + if (!(setting instanceof ButtonSetting)) continue; + + for (Dynamic dynamic : activeDynamics) { + if (dynamic.getClass().getSimpleName().equals(setting.getName())) { + this.unregisterSetting(setting); + if (((ButtonSetting) setting).isToggled()) + dynamic.exit(); + continue unregister; + } + } + } + try { for (File file : Objects.requireNonNull(cacheDirectory.listFiles())) { file.delete(); @@ -72,22 +109,38 @@ public void loadDynamics() { File[] files = directory.listFiles(); if (files == null) return; - for (File file : files) { - if (!file.exists() || !file.isFile() || !file.getName().endsWith(".java")) - continue; + try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null)) { + Set classPath = new HashSet<>(); - int compilationResult = compiler.run(null, null, null, "-d", cacheDirectory.getPath(), file.getPath()); - - if (compilationResult == 0) { - System.out.println(ChatFormatting.GREEN + "Compilation successful." + ChatFormatting.RESET + "(" + file.getName() + ")"); + for (File file : Objects.requireNonNull(new File(mc.mcDataDir, "mods").listFiles())) { + if (file.exists() && file.isFile() && file.getName().endsWith(".jar")) + classPath.add(file); + } + classPath.add(new File(DynamicManager.class.getProtectionDomain().getCodeSource().getLocation().getFile())); + + fileManager.setLocation(StandardLocation.CLASS_PATH, classPath); + fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singletonList(cacheDirectory)); + + Iterable compilationUnits = fileManager.getJavaFileObjectsFromFiles( + Arrays.stream(files) + .filter(File::exists) + .filter(File::isFile) + .filter(file -> file.getName().endsWith(".java")) + .collect(Collectors.toSet()) + ); + boolean compilationResult = compiler.getTask(null, fileManager, null, null, null, compilationUnits).call(); + + if (compilationResult) { + Utils.sendMessage(ChatFormatting.GREEN + "Compilation successful."); } else { - System.out.println(ChatFormatting.RED + "Compilation failed." + ChatFormatting.RESET + "(" + file.getName() + ")"); + Utils.sendMessage(ChatFormatting.RED + "Compilation failed."); } + } catch (IOException | NullPointerException ignored) { } List classFiles = findClassFiles(cacheDirectory.getPath()); if (classFiles.isEmpty()) { - System.out.println("No class files found"); + Utils.sendMessage("No class files found"); } URL[] urls = new URL[1]; @@ -96,36 +149,31 @@ public void loadDynamics() { } catch (MalformedURLException ignored) { } - unregister: - for (Setting setting : this.getSettings()) { - if (!(setting instanceof ButtonSetting)) continue; - - for (Dynamic dynamic : activeDynamics) { - if (dynamic.getClass().getName().equals(setting.getName())) { - this.unregisterSetting(setting); - if (((ButtonSetting) setting).isToggled()) - dynamic.exit(); - continue unregister; - } - } - } - activeDynamics.clear(); - try (URLClassLoader classLoader = new URLClassLoader(urls)) { - Class interfaceClass = Dynamic.class; // 指定要检查的接口类 + try (URLClassLoader classLoader = new URLClassLoader(urls, getClass().getClassLoader())) { + Class dynamicInterface = classLoader.loadClass("keystrokesmod.dynamic.Dynamic"); for (File classFile : classFiles) { - String className = getClassName(cacheDirectory.getPath(), classFile); - Class compiledClass = classLoader.loadClass(className); + if (!classFile.exists() || !classFile.isFile() || !classFile.getName().endsWith(".class")) continue; - if (interfaceClass.isAssignableFrom(compiledClass)) { - System.out.println("The class " + className + " implements the interface."); - activeDynamics.add((Dynamic) compiledClass.newInstance()); - } else { - System.out.println("The class " + className + " does not implement the interface."); + String className = getClassName(cacheDirectory.getPath(), classFile); + try { + Class compiledClass = classLoader.loadClass(className); + Utils.sendMessage("Loaded class: " + className); + + if (dynamicInterface.isAssignableFrom(compiledClass)) { + activeDynamics.add((Dynamic) compiledClass.newInstance()); + } else { + Utils.sendMessage("Class " + className + " does not implement Dynamic interface."); + } + } catch (ClassCastException e) { + Utils.sendMessage("ClassCastException: The class '" + className + "' does not implement the interface."); + } catch (NullPointerException e) { + Utils.sendMessage("NullPointerException: " + e.getLocalizedMessage()); } } - } catch (IOException | ClassNotFoundException | ClassCastException | InstantiationException | IllegalAccessException ignored) { + } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { + Utils.sendMessage("Exception: " + e.getMessage()); } Utils.sendMessage(ChatFormatting.GREEN + "Loaded " + activeDynamics.size() + " dynamics."); @@ -133,13 +181,23 @@ public void loadDynamics() { for (Dynamic dynamic : activeDynamics) { String name = dynamic.getClass().getSimpleName(); - this.registerSetting(new ButtonSetting(name, false, () -> activeDynamics.contains(dynamic), setting -> { + this.registerSetting(new ButtonSetting(name, false, setting -> { if (setting.isToggled()) dynamic.init(); else dynamic.exit(); })); } + + try { + for (ModuleComponent module : ClickGui.categories.get(this.moduleCategory()).getModules()) { + if (module.mod == this) { + module.updateSetting(); + break; + } + } + } catch (NullPointerException ignored) { + } } private static List findClassFiles(String dir) { diff --git a/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java b/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java index 7843f43b1..69a3b2fe7 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java +++ b/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java @@ -1,7 +1,7 @@ package keystrokesmod.module.impl.combat; import akka.japi.Pair; -import keystrokesmod.Raven; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.mixins.impl.client.PlayerControllerMPAccessor; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.anticheats.utils.world.PlayerRotation; @@ -10,132 +10,208 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; import keystrokesmod.utility.AimSimulator; -import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.List; public class AimAssist extends Module { - private final SliderSetting horizonSpeed; + private final ButtonSetting clickAim; + private final ButtonSetting aimWhileOnTarget; + private final ButtonSetting strafeIncrease; + private final ButtonSetting checkBlockBreak; + private final ButtonSetting aimVertically; private final SliderSetting verticalSpeed; - private final SliderSetting fov; + private final SliderSetting horizontalSpeed; + private final SliderSetting maxAngle; private final SliderSetting distance; - private final ButtonSetting clickAim; - private final ButtonSetting stopOnTarget; - private final ButtonSetting breakBlocks; - private final ButtonSetting singleTarget; private final ButtonSetting weaponOnly; - private final ButtonSetting aimInvis; - private final ButtonSetting blatantMode; - private final ButtonSetting aimNearest; private final ButtonSetting ignoreTeammates; - private final ButtonSetting throughBlock; - private final ButtonSetting smooth; - private EntityPlayer target = null; + private Double yawNoise = null; + private Double pitchNoise = null; + private long nextNoiseRefreshTime = -1; + private long nextNoiseEmptyTime = 200; public AimAssist() { super("AimAssist", category.combat, 0); - this.registerSetting(horizonSpeed = new SliderSetting("Horizon speed", 3, 0, 10, 0.05)); - this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 0, 0, 10, 0.05)); - this.registerSetting(fov = new SliderSetting("FOV", 90.0D, 15.0D, 360.0D, 1.0D)); - this.registerSetting(distance = new SliderSetting("Distance", 4.5D, 1.0D, 10.0D, 0.5D)); this.registerSetting(clickAim = new ButtonSetting("Click aim", true)); - this.registerSetting(stopOnTarget = new ButtonSetting("Stop on target", true)); - this.registerSetting(breakBlocks = new ButtonSetting("Break blocks", false)); - this.registerSetting(singleTarget = new ButtonSetting("Single target", false)); + this.registerSetting(aimWhileOnTarget = new ButtonSetting("Aim while on target", true)); + this.registerSetting(strafeIncrease = new ButtonSetting("Strafe increase", false)); + this.registerSetting(checkBlockBreak = new ButtonSetting("Check block break", false)); + this.registerSetting(aimVertically = new ButtonSetting("Aim vertically", false)); + this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 5, 1, 10, 0.1, aimVertically::isToggled)); + this.registerSetting(horizontalSpeed = new SliderSetting("Horizontal speed", 5, 1, 10, 0.1)); + this.registerSetting(maxAngle = new SliderSetting("Max angle", 180, 1, 360, 5)); + this.registerSetting(distance = new SliderSetting("Distance", 5, 1, 8, 0.1)); this.registerSetting(weaponOnly = new ButtonSetting("Weapon only", false)); - this.registerSetting(aimInvis = new ButtonSetting("Aim invis", false)); - this.registerSetting(blatantMode = new ButtonSetting("Blatant mode", false)); this.registerSetting(ignoreTeammates = new ButtonSetting("Ignore teammates", false)); - this.registerSetting(aimNearest = new ButtonSetting("Aim nearest", true, () -> !blatantMode.isToggled())); - this.registerSetting(throughBlock = new ButtonSetting("Through block", true, () -> !blatantMode.isToggled())); - this.registerSetting(smooth = new ButtonSetting("Smooth as possible", false)); } + @Override + public void onDisable() { + yawNoise = pitchNoise = null; + nextNoiseRefreshTime = -1; + } + + @Override public void onUpdate() { if (noAction()) { - target = null; return; } - target = getEnemy(); - if (target != null) { - if (Raven.debugger) { - Utils.sendMessage(this.getName() + " &e" + target.getName()); - } + final EntityPlayer target = getEnemy(); + if (target == null) return; + final boolean onTarget = mc.objectMouseOver != null + && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY + && mc.objectMouseOver.entityHit == target; - if (stopOnTarget.isToggled() && (mc.objectMouseOver.entityHit == target - || RotationUtils.rayCastIgnoreWall(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, target)) - ) return; + double deltaYaw = yawNoise; + double deltaPitch = pitchNoise; - if (blatantMode.isToggled()) { - final Vec3 pos = Utils.getEyePos(target); - mc.thePlayer.rotationYaw = PlayerRotation.getYaw(pos); - mc.thePlayer.rotationPitch = PlayerRotation.getPitch(pos); + double hSpeed = horizontalSpeed.getInput(); + double vSpeed = verticalSpeed.getInput(); + + + if (onTarget) { + if (aimWhileOnTarget.isToggled()) { + hSpeed *= 0.85; + vSpeed *= 0.85; } else { - final Pair rot = AimSimulator.getLegitAim(target, mc.thePlayer, - aimNearest.isToggled(), true, false, null, 0); - - if (!throughBlock.isToggled() && RotationUtils.rayCast(distance.getInput(), rot.first(), rot.second()) != null) - return; - - if (horizonSpeed.getInput() > 0) - mc.thePlayer.rotationYaw = smooth.isToggled() ? - AimSimulator.rotMoveNoRandom(rot.first(), mc.thePlayer.rotationYaw, (float) horizonSpeed.getInput()) : - AimSimulator.rotMove(rot.first(), mc.thePlayer.rotationYaw, (float) horizonSpeed.getInput()); - if (verticalSpeed.getInput() > 0) - mc.thePlayer.rotationPitch = smooth.isToggled() ? - AimSimulator.rotMoveNoRandom(rot.second(), mc.thePlayer.rotationPitch, (float) verticalSpeed.getInput()) : - AimSimulator.rotMove(rot.second(), mc.thePlayer.rotationPitch, - (float) verticalSpeed.getInput()); + hSpeed = 0; + vSpeed = 0; + } + } + + if (strafeIncrease.isToggled()) { + int mouseX = Math.abs(mc.mouseHelper.deltaX); + int mouseY = Math.abs(mc.mouseHelper.deltaY); + + if (mouseX > 100) + hSpeed = 0; + else + hSpeed = Math.min(hSpeed, (100 - mouseX) / 35.0); + + if (mouseY > 100) + vSpeed = 0; + else + vSpeed = Math.min(hSpeed, (100 - mouseY) / 35.0); + } + + final Pair, Pair> rotation = getRotation(target.getEntityBoundingBox()); + final Pair yaw = rotation.first(); + final Pair pitch = rotation.second(); + + boolean move = false; + + final float curYaw = mc.thePlayer.rotationYaw; + final float curPitch = mc.thePlayer.rotationPitch; + if (yaw.first() > curYaw) { + move = true; + final float after = AimSimulator.rotMove(yaw.first(), curYaw, (float) hSpeed); + deltaYaw += after - curYaw; + } else if (yaw.second() < curYaw) { + move = true; + final float after = AimSimulator.rotMove(yaw.second(), curYaw, (float) hSpeed); + deltaYaw += after - curYaw; + } + if (aimVertically.isToggled()) { + if (pitch.first() > curPitch) { + move = true; + final float after = AimSimulator.rotMove(pitch.first(), curPitch, (float) vSpeed); + deltaPitch += after - curPitch; + } else if (pitch.second() < curPitch) { + move = true; + final float after = AimSimulator.rotMove(pitch.second(), curPitch, (float) vSpeed); + deltaPitch += after - curPitch; + } + } + + if (move) { + deltaYaw += (Math.random() - 0.5) * Math.min(0.8, deltaPitch / 10.0); + deltaPitch += (Math.random() - 0.5) * Math.min(0.8, deltaYaw / 10.0); + } + + mc.thePlayer.rotationYaw += (float) deltaYaw; + mc.thePlayer.rotationPitch += (float) deltaPitch; + } + + private @NotNull Pair, Pair> getRotation(@NotNull AxisAlignedBB boundingBox) { + float minYaw = Float.MAX_VALUE; + float maxYaw = Float.MIN_VALUE; + + for (Double x : Arrays.asList(boundingBox.minX, boundingBox.maxX)) { + for (Double z : Arrays.asList(boundingBox.minZ, boundingBox.maxZ)) { + float yaw = PlayerRotation.getYaw(new Vec3(x, 0, z)); + + if (yaw < minYaw) + minYaw = yaw; + if (yaw > maxYaw) + maxYaw = yaw; } } + + float pitch1 = PlayerRotation.getPitch(new Vec3(0, boundingBox.minY + 1.12, 0)); + float pitch2 = PlayerRotation.getPitch(new Vec3(0, boundingBox.maxY + 0.12, 0)); + + return new Pair<>( + new Pair<>(minYaw, maxYaw), + new Pair<>(Math.min(pitch1, pitch2), Math.max(pitch1, pitch2)) + ); } private boolean noAction() { if (mc.currentScreen != null || !mc.inGameHasFocus) return true; if (weaponOnly.isToggled() && !Utils.holdingWeapon()) return true; + if (yawNoise == null || pitchNoise == null) return true; if (clickAim.isToggled() && !Utils.ilc()) return true; - return breakBlocks.isToggled() && ((PlayerControllerMPAccessor) mc.playerController).isHittingBlock(); + return checkBlockBreak.isToggled() && ((PlayerControllerMPAccessor) mc.playerController).isHittingBlock(); + } + + @SubscribeEvent + public void onRender(TickEvent.RenderTickEvent event) { + long time = System.currentTimeMillis(); + if (nextNoiseRefreshTime == -1 || time >= nextNoiseRefreshTime + nextNoiseEmptyTime) { + nextNoiseRefreshTime = (long) (time + Math.random() * 60 + 80); + nextNoiseEmptyTime = (long) (Math.random() * 100 + 180); + yawNoise = (Math.random() - 0.5) * 2 * ((Math.random() - 0.5) * 0.3 + 0.8); + pitchNoise = (Math.random() - 0.5) * 2 * ((Math.random() - 0.5) * 0.35 + 0.6); + } else if (time >= nextNoiseRefreshTime) { + yawNoise = 0d; + pitchNoise = 0d; + } } private @Nullable EntityPlayer getEnemy() { - final int n = (int) fov.getInput(); + final int fov = (int) maxAngle.getInput(); + final List players = mc.theWorld.playerEntities; + final Vec3 playerPos = new Vec3(mc.thePlayer); - List players = mc.theWorld.playerEntities; - if (target != null && new Vec3(target).distanceTo(mc.thePlayer) <= distance.getInput() && singleTarget.isToggled() && players.contains(target)) { - return target; - } else { - target = null; - } EntityPlayer target = null; - double targetDist = Double.MAX_VALUE; + double targetFov = Double.MAX_VALUE; for (final EntityPlayer entityPlayer : players) { if (entityPlayer != mc.thePlayer && entityPlayer.deathTime == 0) { - if (Utils.isFriended(entityPlayer)) { + if (Utils.isFriended(entityPlayer)) continue; - } - if (ignoreTeammates.isToggled() && Utils.isTeamMate(entityPlayer)) { - continue; - } - if (!aimInvis.isToggled() && entityPlayer.isInvisible()) { + if (AntiBot.isBot(entityPlayer)) continue; - } - if (mc.thePlayer.getDistanceToEntity(entityPlayer) > distance.getInput()) { + if (ignoreTeammates.isToggled() && Utils.isTeamMate(entityPlayer)) continue; - } - if (AntiBot.isBot(entityPlayer)) { + if (playerPos.distanceTo(entityPlayer) > distance.getInput()) continue; - } - if (!blatantMode.isToggled() && n != 360 && !Utils.inFov((float)n, entityPlayer)) { + if (fov != 360 && !Utils.inFov(fov, entityPlayer)) continue; - } - double dist = new Vec3(entityPlayer).distanceTo(mc.thePlayer); - if (dist < targetDist) { + + double curFov = Math.abs(Utils.getFov(entityPlayer.posX, entityPlayer.posZ)); + if (curFov < targetFov) { target = entityPlayer; - targetDist = dist; + targetFov = curFov; } } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index a219cd17e..4db5c9582 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -48,6 +48,7 @@ public class KillAura extends Module { private final SliderSetting attackRange; private final SliderSetting swingRange; private final SliderSetting blockRange; + private final SliderSetting preAimRange; private final ModeSetting rotationMode; private final ModeSetting moveFixMode; private final ModeSetting rotationTarget; @@ -111,6 +112,7 @@ public KillAura() { this.registerSetting(attackRange = new SliderSetting("Attack range", 3.2, 3.0, 6.0, 0.1)); this.registerSetting(swingRange = new SliderSetting("Swing range", 3.2, 3.0, 8.0, 0.1)); this.registerSetting(blockRange = new SliderSetting("Block range", 6.0, 3.0, 12.0, 0.1)); + this.registerSetting(preAimRange = new SliderSetting("PreAim range", 6.0, 3.0, 12.0, 0.1)); this.registerSetting(rotationMode = new ModeSetting("Rotation mode", rotationModes, 0)); final ModeOnly doRotation = new ModeOnly(rotationMode, 1, 2); this.registerSetting(moveFixMode = new ModeSetting("MoveFix mode", RotationHandler.MoveFix.MODES, 0, new ModeOnly(rotationMode, 1))); @@ -149,6 +151,7 @@ public void onEnable() { public void guiUpdate() { Utils.correctValue(minCPS, maxCPS); Utils.correctValue(attackRange, swingRange); + Utils.correctValue(swingRange, preAimRange); } public void onDisable() { @@ -514,7 +517,7 @@ private void setTarget(float[] rotations) { if (pair.second() <= swingRange.getInput()) { swing = true; } - if (pair.second() <= attackRange.getInput() || pair.second() <= swingRange.getInput()) { + if (pair.second() <= preAimRange.getInput()) { availableTargets.add(pair.first()); } }); diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java index 3f3686768..13f09a77e 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java @@ -1,10 +1,7 @@ package keystrokesmod.module.impl.movement; import keystrokesmod.Raven; -import keystrokesmod.event.JumpEvent; -import keystrokesmod.event.PostMotionEvent; -import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.RotationEvent; +import keystrokesmod.event.*; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.other.RotationHandler; @@ -24,8 +21,8 @@ import net.minecraft.network.play.client.C0CPacketInput; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; @@ -34,22 +31,27 @@ public class NoSlow extends Module { public static ModeSetting mode; public static SliderSetting slowed; + public static SliderSetting sneakSlowed; public static ButtonSetting disableBow; public static ButtonSetting disableSword; public static ButtonSetting disablePotions; public static ButtonSetting swordOnly; public static ButtonSetting vanillaSword; - private final String[] modes = new String[]{"Vanilla", "Pre", "Post", "Alpha", "Old Intave", "Intave", "Polar", "GrimAC", "HypixelTest A", "HypixelTest B", "Blink"}; + private final String[] modes = new String[]{"Vanilla", "Pre", "Post", "Alpha", "Old Intave", "Intave", "Polar", "GrimAC", "HypixelTest A", "HypixelTest B", "Blink", "Beta", "Sneak"}; private boolean postPlace; private static ModeOnly canChangeSpeed; private boolean lastUsingItem = false; + private int offGroundTicks = 0; + private boolean send = false; + public NoSlow() { super("NoSlow", Module.category.movement, 0); this.registerSetting(mode = new ModeSetting("Mode", modes, 0)); canChangeSpeed = new ModeOnly(mode, 5, 6, 7).reserve(); - this.registerSetting(slowed = new SliderSetting("Slow %", 5.0D, 0.0D, 80.0D, 1.0D, canChangeSpeed)); + this.registerSetting(slowed = new SliderSetting("Slow %", 5.0D, 0.0D, 100.0D, 1.0D, canChangeSpeed)); + this.registerSetting(sneakSlowed = new SliderSetting("Sneak slowed %", 0, 0, 100, 1, new ModeOnly(mode, 12))); this.registerSetting(disableSword = new ButtonSetting("Disable sword", false)); this.registerSetting(disableBow = new ButtonSetting("Disable bow", false, canChangeSpeed)); this.registerSetting(disablePotions = new ButtonSetting("Disable potions", false)); @@ -60,6 +62,16 @@ public NoSlow() { @Override public void onDisable() { lastUsingItem = false; + offGroundTicks = 0; + send = false; + } + + @SubscribeEvent + public void onMoveInput(@NotNull MoveInputEvent event) { + if (mc.thePlayer.isUsingItem() && mode.getInput() == 12) { + event.setSneak(true); + event.setSneakSlowDownMultiplier(1 - sneakSlowed.getInput() / 100); + } } public void onUpdate() { @@ -184,6 +196,46 @@ public void onPreMotion(PreMotionEvent event) { lastUsingItem = true; } + @SubscribeEvent + public void onPreMotion$Beta(PreMotionEvent event) { + if (mc.thePlayer.onGround) { + offGroundTicks = 0; + } else { + offGroundTicks++; + } + + final @Nullable ItemStack item = SlotHandler.getHeldItem(); + if (offGroundTicks == 2 && send) { + send = false; + PacketUtils.sendPacketNoEvent(new C08PacketPlayerBlockPlacement( + new BlockPos(-1, -1, -1), + 255, item, + 0, 0, 0 + )); + + } else if (item != null && mc.thePlayer.isUsingItem() + && (ContainerUtils.isRest(item.getItem()) || item.getItem() instanceof ItemBow)) { + event.setPosY(event.getPosY() + 1E-14); + } + } + + @SubscribeEvent + public void onPacketSent(@NotNull SendPacketEvent event) { + if (mode.getInput() == 11) { + if (event.getPacket() instanceof C08PacketPlayerBlockPlacement && !mc.thePlayer.isUsingItem()) { + C08PacketPlayerBlockPlacement blockPlacement = (C08PacketPlayerBlockPlacement) event.getPacket(); + if (SlotHandler.getHeldItem() != null && blockPlacement.getPlacedBlockDirection() == 255 + && ContainerUtils.isRest(SlotHandler.getHeldItem().getItem()) && offGroundTicks < 2) { + if (mc.thePlayer.onGround) { + mc.thePlayer.setJumping(false); + mc.thePlayer.jump(); + } + send = true; + } + } + } + } + public static float getSlowed() { if (!mc.thePlayer.isUsingItem()) return (100.0F - 0.0F) / 100.0F; if (SlotHandler.getHeldItem() == null || ModuleManager.noSlow == null || !ModuleManager.noSlow.isEnabled()) { diff --git a/src/main/java/keystrokesmod/module/impl/movement/Speed.java b/src/main/java/keystrokesmod/module/impl/movement/Speed.java index e219c4836..dbd09f4ae 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Speed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Speed.java @@ -92,7 +92,7 @@ public void onEnable() { @SubscribeEvent public void onPreUpdate(PreUpdateEvent event) { if (mode.getInput() == 4) { - if (mc.thePlayer.hurtTime > 0 || !MoveUtil.isMoving() || Utils.jumpDown()) { + if ((mc.thePlayer.hurtTime > 0 && offGroundTicks != 0) || !MoveUtil.isMoving() || Utils.jumpDown()) { Utils.resetTimer(); return; } diff --git a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java index 7584796ba..0ed016275 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java +++ b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java @@ -16,8 +16,8 @@ public final class RecordClick extends Module { private static File directory; - private static List LOADED_PATTERNS = new ArrayList<>(Collections.singletonList(Pattern.DEFAULT)); - public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName()}; + private static List LOADED_PATTERNS = new ArrayList<>(Arrays.asList(Pattern.DEFAULT, Pattern.VAPE)); + public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName(), Pattern.VAPE.getName()}; private static ModeSetting currentPattern; private int lastPattern = 0; @@ -98,9 +98,10 @@ public static void reset() { public static void loadPatterns() { File[] requireNonNull = Objects.requireNonNull(directory.listFiles()); - LOADED_PATTERNS = new ArrayList<>(Collections.singletonList(Pattern.DEFAULT)); - LOADED_PATTERNS_NAMES = new String[requireNonNull.length + 1]; + LOADED_PATTERNS = new ArrayList<>(Arrays.asList(Pattern.DEFAULT, Pattern.VAPE)); + LOADED_PATTERNS_NAMES = new String[requireNonNull.length + 2]; LOADED_PATTERNS_NAMES[0] = Pattern.DEFAULT.getName(); + LOADED_PATTERNS_NAMES[1] = Pattern.VAPE.getName(); for (int i = 0, requireNonNullLength = requireNonNull.length; i < requireNonNullLength; i++) { File file = requireNonNull[i]; diff --git a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java index 936c9d3bd..a91ccc6de 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java @@ -25,8 +25,6 @@ public final class RotationHandler extends Module { private static @Nullable Float movementYaw = null; private static @Nullable Float rotationYaw = null; private static @Nullable Float rotationPitch = null; - private static @Nullable Float lastRotationYaw = null; - private static @Nullable Float lastRotationPitch = null; private boolean isSet = false; private static MoveFix moveFix = MoveFix.NONE; @@ -52,7 +50,7 @@ public static float getMovementYaw(Entity entity) { } public static void setRotationYaw(float rotationYaw) { - RotationHandler.rotationYaw = RotationUtils.normalize(rotationYaw); + RotationHandler.rotationYaw = rotationYaw; } public static void setRotationPitch(float rotationPitch) { @@ -75,18 +73,6 @@ public static float getRotationPitch() { return mc.thePlayer.rotationPitch; } - public static float getLastRotationYaw() { - if (lastRotationYaw != null) - return RotationUtils.normalize(lastRotationYaw); - return getRotationYaw(); - } - - public static float getLastRotationPitch() { - if (lastRotationPitch != null) - return lastRotationPitch; - return getRotationPitch(); - } - /** * Fix movement * @param event before update living entity (move) @@ -94,16 +80,16 @@ public static float getLastRotationPitch() { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPreMotion(MoveInputEvent event) { if (isSet) { - lastRotationYaw = rotationYaw; - lastRotationPitch = rotationPitch; + float viewYaw = RotationUtils.normalize(mc.thePlayer.rotationYaw); + float viewPitch = RotationUtils.normalize(mc.thePlayer.rotationPitch); switch ((int) smoothBack.getInput()) { case 0: - rotationYaw = mc.thePlayer.rotationYaw; - rotationPitch = mc.thePlayer.rotationPitch; + setRotationYaw(viewYaw); + setRotationPitch(viewPitch); break; case 1: - rotationYaw = AimSimulator.rotMove(mc.thePlayer.rotationYaw, getRotationYaw(), (float) aimSpeed.getInput()); - rotationPitch = AimSimulator.rotMove(mc.thePlayer.rotationPitch, getRotationPitch(), (float) aimSpeed.getInput()); + setRotationYaw(AimSimulator.rotMove(viewYaw, getRotationYaw(), (float) aimSpeed.getInput())); + setRotationPitch(AimSimulator.rotMove(viewPitch, getRotationPitch(), (float) aimSpeed.getInput())); break; } } @@ -115,7 +101,7 @@ public void onPreMotion(MoveInputEvent event) { MinecraftForge.EVENT_BUS.post(rotationEvent); isSet = rotationEvent.isSet() || rotationYaw != null || rotationPitch != null; if (isSet) { - rotationYaw = RotationUtils.normalize(rotationEvent.getYaw()); + rotationYaw = rotationEvent.getYaw(); rotationPitch = rotationEvent.getPitch(); moveFix = rotationEvent.getMoveFix(); } diff --git a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java index 95255d820..1d27ffa02 100644 --- a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java @@ -1,6 +1,7 @@ package keystrokesmod.module.impl.other; import keystrokesmod.event.PreUpdateEvent; +import keystrokesmod.mixins.impl.client.PlayerControllerMPAccessor; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; @@ -57,7 +58,9 @@ public void onPreUpdate(PreUpdateEvent event) { currentSlot = null; break; case 1: - if (currentSlot != null && System.currentTimeMillis() - lastSetCurrentSlotTime > switchBackDelay.getInput()) + if (currentSlot != null + && !((PlayerControllerMPAccessor) mc.playerController).isHittingBlock() + && System.currentTimeMillis() - lastSetCurrentSlotTime > switchBackDelay.getInput()) currentSlot = null; break; } diff --git a/src/main/java/keystrokesmod/module/impl/player/InvManager.java b/src/main/java/keystrokesmod/module/impl/player/InvManager.java index 2a4b349d6..3235c707c 100644 --- a/src/main/java/keystrokesmod/module/impl/player/InvManager.java +++ b/src/main/java/keystrokesmod/module/impl/player/InvManager.java @@ -26,7 +26,7 @@ public class InvManager extends Module { private final ModeSetting mode = new ModeSetting("Mode", new String[]{"Basic", "OpenInv"}, 1); - private final ButtonSetting notWhileMoving = new ButtonSetting("Not while moving", false, new ModeOnly(mode, 1)); + private final ButtonSetting notWhileMoving = new ButtonSetting("Not while moving", false, new ModeOnly(mode, 0)); private final SliderSetting minStartDelay = new SliderSetting("Min start delay", 100, 0, 500, 10, "ms"); private final SliderSetting maxStartDelay = new SliderSetting("Max start delay", 200, 0, 500, 10, "ms"); private final ButtonSetting armor = new ButtonSetting("Armor", false); diff --git a/src/main/java/keystrokesmod/module/impl/render/Animations.java b/src/main/java/keystrokesmod/module/impl/render/Animations.java index ebbb3db5b..4a64cd83d 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Animations.java +++ b/src/main/java/keystrokesmod/module/impl/render/Animations.java @@ -2,6 +2,7 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.RenderItemEvent; +import keystrokesmod.event.SendPacketEvent; import keystrokesmod.event.SwingAnimationEvent; import keystrokesmod.mixins.impl.render.ItemRendererAccessor; import keystrokesmod.module.Module; @@ -14,18 +15,18 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C0APacketAnimation; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL11; -import static net.minecraft.util.MovingObjectPosition.MovingObjectType.BLOCK; - public class Animations extends Module { private final ModeSetting blockAnimation = new ModeSetting("Block animation", new String[]{"None", "1.7", "Smooth", "Exhibition", "Stab", "Spin", "Sigma", "Wood", "Swong", "Chill", "Komorebi", "Rhys", "Allah"}, 1); private final ModeSetting swingAnimation = new ModeSetting("Swing animation", new String[]{"None", "1.9+", "Smooth", "Punch", "Shove"}, 0); private final ModeSetting otherAnimation = new ModeSetting("Other animation", new String[]{"None", "1.7"}, 1); - private final ButtonSetting blockAndSwing = new ButtonSetting("Block and swing", false); + public static final ButtonSetting swingWhileDigging = new ButtonSetting("Swing while digging", true); + public static final ButtonSetting clientSide = new ButtonSetting("Client side", true, swingWhileDigging::isToggled); private final SliderSetting x = new SliderSetting("X", 0, -1, 1, 0.05); private final SliderSetting y = new SliderSetting("Y", 0, -1, 1, 0.05); private final SliderSetting z = new SliderSetting("Z", 0, -1, 1, 0.05); @@ -35,7 +36,18 @@ public class Animations extends Module { public Animations() { super("Animations", category.render); - this.registerSetting(blockAnimation, swingAnimation, otherAnimation, blockAndSwing, x, y, z, swingSpeed); + this.registerSetting(blockAnimation, swingAnimation, otherAnimation, swingWhileDigging, clientSide, x, y, z, swingSpeed); + } + + @SubscribeEvent + public void onSendPacket(SendPacketEvent event) { + if (Utils.nullCheck() + && swingWhileDigging.isToggled() + && clientSide.isToggled() + && event.getPacket() instanceof C0APacketAnimation + && mc.thePlayer.isUsingItem() + ) + event.setCanceled(true); } @SubscribeEvent @@ -244,11 +256,6 @@ public void onPreMotion(PreMotionEvent event) { } else { swing = Math.max(0, swing - 1); } - - if (blockAndSwing.isToggled() && mc.objectMouseOver.typeOfHit == BLOCK - && mc.gameSettings.keyBindAttack.isKeyDown()) { - mc.thePlayer.swingItem(); - } } catch (Exception ignore) { } } diff --git a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java index 772cf2b75..b4b79a459 100644 --- a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java +++ b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java @@ -15,7 +15,7 @@ public class FreeLook extends Module { private final ButtonSetting onlyIfPressed = new ButtonSetting("Only if pressed", true); - private @Nullable ViewData viewData = null; + public static @Nullable ViewData viewData = null; public FreeLook() { super("FreeLook", category.render); @@ -33,11 +33,11 @@ public void onDisable() { } public static void call() { - if (ModuleManager.freeLook.isEnabled() && ModuleManager.freeLook.viewData != null) { + if (ModuleManager.freeLook.isEnabled() && FreeLook.viewData != null) { mc.objectMouseOver = RotationUtils.rayCast( mc.playerController.getBlockReachDistance(), - ModuleManager.freeLook.viewData.rotationYaw, - ModuleManager.freeLook.viewData.rotationPitch + FreeLook.viewData.rotationYaw, + FreeLook.viewData.rotationPitch ); } } @@ -79,10 +79,10 @@ public void onJump(JumpEvent event) { } } - private static class ViewData { - private final int thirdPersonView; - private final float rotationYaw; - private final float rotationPitch; + public static class ViewData { + public final int thirdPersonView; + public final float rotationYaw; + public final float rotationPitch; public ViewData(int thirdPersonView, float rotationYaw, float rotationPitch) { this.thirdPersonView = thirdPersonView; diff --git a/src/main/java/keystrokesmod/module/impl/render/HUD.java b/src/main/java/keystrokesmod/module/impl/render/HUD.java index 5acfb46d8..e0218895f 100644 --- a/src/main/java/keystrokesmod/module/impl/render/HUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/HUD.java @@ -34,7 +34,7 @@ import java.util.List; public class HUD extends Module { - public static final String VERSION = "1.15.0"; + public static final String VERSION = "1.16.0"; public static final HashMap WATERMARK = new HashMap<>(); public static ModeSetting theme; // public static SliderSetting font; diff --git a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java index 5b0fcd13b..37a5aeffd 100644 --- a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java @@ -2,10 +2,16 @@ import keystrokesmod.mixins.impl.client.KeyBindingAccessor; import keystrokesmod.module.Module; +import keystrokesmod.module.impl.other.RotationHandler; +import keystrokesmod.module.impl.other.SlotHandler; +import keystrokesmod.module.impl.render.FreeLook; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; @@ -17,12 +23,13 @@ public class LegitScaffold extends Module { private final SliderSetting pitch = new SliderSetting("Pitch", 45, 0, 90, 5, pitchCheck::isToggled); private final ButtonSetting onlySPressed = new ButtonSetting("Only S pressed", false); private final ButtonSetting onlySneak = new ButtonSetting("Only sneak", false); + private final ButtonSetting showBlockCount = new ButtonSetting("Show block count", false); private long lastSneakTime = -1; public LegitScaffold() { super("Legit scaffold", category.world); - this.registerSetting(minDelay, maxDelay, pitchCheck, pitch, onlySPressed, onlySneak); + this.registerSetting(minDelay, maxDelay, pitchCheck, pitch, onlySPressed, onlySneak, showBlockCount); } @Override @@ -40,8 +47,17 @@ public void onDisable() { public void onRender(TickEvent.RenderTickEvent event) { if (!Utils.nullCheck() || mc.currentScreen != null) return; + ItemStack item = SlotHandler.getHeldItem(); + if (showBlockCount.isToggled()) { + if (item != null && item.getItem() instanceof ItemBlock) { + RenderUtils.drawText(String.valueOf(item.stackSize)); + } else { + RenderUtils.drawText("0"); + } + } + if ((onlySPressed.isToggled() && !mc.gameSettings.keyBindBack.isKeyDown()) - || (pitchCheck.isToggled() && mc.thePlayer.rotationPitch < pitch.getInput()) + || (pitchCheck.isToggled() && (FreeLook.viewData != null ? FreeLook.viewData.rotationPitch : mc.thePlayer.rotationPitch) < pitch.getInput()) || (onlySneak.isToggled() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) ) { setSneak(Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())); diff --git a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java index 5e68f314f..0c035dc6a 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java @@ -86,6 +86,7 @@ public class Scaffold extends Module { // from b4 :) private boolean placedUp; private int offGroundTicks = 0; private boolean telly$noBlockPlace = false; + private Float lastYaw = null, lastPitch = null; public Scaffold() { super("Scaffold", category.world); this.registerSetting(aimSpeed = new SliderSetting("Aim speed", 20, 5, 20, 0.1)); @@ -113,7 +114,7 @@ public Scaffold() { this.registerSetting(tower = new ButtonSetting("Tower", false)); this.registerSetting(fast = new ButtonSetting("Fast", false)); this.registerSetting(sameY = new ButtonSetting("SameY", false)); - this.registerSetting(autoJump = new ButtonSetting("Auto jump", false, sameY::isToggled)); + this.registerSetting(autoJump = new ButtonSetting("Auto jump", false)); } public void onDisable() { @@ -134,6 +135,7 @@ public void onDisable() { sameY$bridged = 1; offGroundTicks = 0; telly$noBlockPlace = false; + lastYaw = lastPitch = null; } public void onEnable() { @@ -195,8 +197,14 @@ public void onRotation(RotationEvent event) { break; } boolean instant = aimSpeed.getInput() == aimSpeed.getMax(); - event.setYaw(instant ? yaw : AimSimulator.rotMove(yaw, RotationHandler.getLastRotationYaw(), (float) aimSpeed.getInput())); - event.setPitch(instant ? pitch : AimSimulator.rotMove(pitch, RotationHandler.getLastRotationPitch(), (float) aimSpeed.getInput())); + + if (lastYaw == null || lastPitch == null) { + lastYaw = event.getYaw(); + lastPitch = event.getPitch(); + } + + event.setYaw(lastYaw = instant ? yaw : AimSimulator.rotMove(yaw, lastYaw, (float) aimSpeed.getInput())); + event.setPitch(lastPitch = instant ? pitch : AimSimulator.rotMove(pitch, lastPitch, (float) aimSpeed.getInput())); event.setMoveFix(moveFix.isToggled() ? RotationHandler.MoveFix.SILENT : RotationHandler.MoveFix.NONE); place = true; @@ -237,7 +245,7 @@ public void onPreUpdate(PreUpdateEvent e) { // place here } else { offGroundTicks++; } - if (rotation.getInput() == 4 && mc.thePlayer.onGround && MoveUtil.isMoving() && !Utils.jumpDown()) { + if ((rotation.getInput() == 4 || autoJump.isToggled()) && mc.thePlayer.onGround && MoveUtil.isMoving() && !Utils.jumpDown()) { mc.thePlayer.jump(); } @@ -577,7 +585,7 @@ private boolean forceStrict(float value) { private boolean keepYPosition() { boolean sameYSca = fastScaffold.getInput() == 4 || fastScaffold.getInput() == 3 || fastScaffold.getInput() == 5 || fastScaffold.getInput() == 6; - return this.isEnabled() && Utils.keysDown() && (sameYSca || sameY.isToggled()) && (!Utils.jumpDown() || fastScaffold.getInput() == 6) && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1)); + return this.isEnabled() && Utils.keysDown() && (sameYSca || (sameY.isToggled() && !Utils.jumpDown())) && (!Utils.jumpDown() || fastScaffold.getInput() == 6) && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1)); } public boolean safewalk() { @@ -685,7 +693,7 @@ protected void place(MovingObjectPosition block, boolean extra) { } if (rayCast.isToggled()) { - MovingObjectPosition hitResult = RotationUtils.rayCast(4.5, placeYaw, placePitch); + MovingObjectPosition hitResult = RotationUtils.rayCast(4.5, lastYaw, lastPitch); if (hitResult != null && hitResult.getBlockPos().equals(block.getBlockPos())) { block.hitVec = hitResult.hitVec; } else { diff --git a/src/main/java/keystrokesmod/module/impl/world/Tower.java b/src/main/java/keystrokesmod/module/impl/world/Tower.java index 17d1ad4bb..35a62fcb6 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/world/Tower.java @@ -1,12 +1,10 @@ package keystrokesmod.module.impl.world; -import keystrokesmod.Raven; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; -import keystrokesmod.module.impl.other.anticheats.utils.world.BlockUtils; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; @@ -14,19 +12,11 @@ import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.utility.Reflection; import keystrokesmod.utility.Utils; -import net.minecraft.network.play.client.C03PacketPlayer; import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.apache.commons.lang3.tuple.Triple; import org.lwjgl.input.Keyboard; -import java.util.Optional; -import java.util.concurrent.TimeUnit; - import static keystrokesmod.module.ModuleManager.scaffold; public class Tower extends Module { @@ -40,11 +30,13 @@ public class Tower extends Module { private final ButtonSetting sprintJumpForward; private final ButtonSetting hypixelNoStrafe; private final SliderSetting hypixelOffGroundSpeed; - private final ButtonSetting lowHop; + private final ModeSetting lowHop; private int slowTicks; private boolean wasTowering; private int offGroundTicks = 0; - private BlockPos toweredBlock = null; + private int onGroundTicks = 0; + private boolean lowHopTest1$watchdog = false; + public Tower() { super("Tower", category.world); this.registerSetting(new DescriptionSetting("Works with SafeWalk & Scaffold")); @@ -58,7 +50,7 @@ public Tower() { this.registerSetting(slowedTicks = new SliderSetting("Slowed ticks", 1, 0, 20, 1, mode0)); this.registerSetting(hypixelOffGroundSpeed = new SliderSetting("Hypixel off ground speed", 0.5, 0.0, 1.0, 0.01, mode1)); this.registerSetting(hypixelNoStrafe = new ButtonSetting("Hypixel no strafe", false, mode1)); - this.registerSetting(lowHop = new ButtonSetting("Low hop", false, mode1)); + this.registerSetting(lowHop = new ModeSetting("Low hop", new String[]{"None", "Default", "Test1", "Test2"}, 0)); this.registerSetting(disableWhileCollided = new ButtonSetting("Disable while collided", false)); this.registerSetting(disableWhileHurt = new ButtonSetting("Disable while hurt", false)); this.registerSetting(sprintJumpForward = new ButtonSetting("Sprint jump forward", true)); @@ -69,7 +61,8 @@ public Tower() { public void onDisable() { wasTowering = false; offGroundTicks = 0; - toweredBlock = null; + onGroundTicks = 0; + lowHopTest1$watchdog = false; } @SubscribeEvent @@ -86,7 +79,6 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException { Reflection.jumpTicks.set(mc.thePlayer, 0); e.setSprinting(false); - toweredBlock = null; double moveSpeed = e.isOnGround() ? speed.getInput() : hypixelOffGroundSpeed.getInput(); if (hypixelNoStrafe.isToggled()) { if (Math.abs(mc.thePlayer.motionX) >= Math.abs(mc.thePlayer.motionZ)) { @@ -100,6 +92,23 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException { mc.thePlayer.motionX *= moveSpeed; mc.thePlayer.motionZ *= moveSpeed; } + + if (lowHop.getInput() == 2) { + onGroundTicks = mc.thePlayer.onGround ? onGroundTicks + 1 : 0; + lowHopTest1$watchdog = (lowHopTest1$watchdog || onGroundTicks == 1) && onGroundTicks < 2; + if (onGroundTicks > 0) + e.setPosY(e.getPosY() + 1E-14); + + if (lowHopTest1$watchdog) { + if (mc.thePlayer.motionY == 0.16477328182606651) mc.thePlayer.motionY = 0.14961479459521598; + if (mc.thePlayer.motionY == 0.0682225000311085) mc.thePlayer.motionY = 0.0532225003663811; + if (mc.thePlayer.motionY == -0.0262419501516868) mc.thePlayer.motionY = -0.027141950136226; + if (mc.thePlayer.motionY == -0.104999113177072) mc.thePlayer.motionY = -0.31999911675335113; + if (mc.thePlayer.motionY == -0.3919991420476618) mc.thePlayer.motionY = -0.3968991421057737; + } + } + + break; // WTF?? why it works?? without this break??? case 2: if (mc.thePlayer.onGround) mc.thePlayer.motionY = 0.42F; @@ -148,23 +157,49 @@ public void onPreUpdate(PreUpdateEvent event) { offGroundTicks++; } - if (canTower() && mode.getInput() == 1 && lowHop.isToggled() && Utils.isMoving()) { - switch (offGroundTicks) { + if (canTower() && mode.getInput() == 1 && Utils.isMoving()) { + switch ((int) lowHop.getInput()) { + default: case 0: - mc.thePlayer.motionY = 0.4196; break; - case 3: - case 4: - mc.thePlayer.motionY = 0; - break; - case 5: - mc.thePlayer.motionY = 0.4191; - break; - case 6: - mc.thePlayer.motionY = 0.3275; + case 1: + switch (offGroundTicks) { + case 0: + mc.thePlayer.motionY = 0.4196; + break; + case 3: + case 4: + mc.thePlayer.motionY = 0; + break; + case 5: + mc.thePlayer.motionY = 0.4191; + break; + case 6: + mc.thePlayer.motionY = 0.3275; + break; + case 11: + mc.thePlayer.motionY = -0.5; + break; + } break; - case 11: - mc.thePlayer.motionY = -0.5; + case 3: + switch (offGroundTicks) { + case 0: + mc.thePlayer.motionY = 0.4191; + break; + case 1: + mc.thePlayer.motionY = 0.327318; + break; + case 4: + mc.thePlayer.motionY = 0.065; + break; + case 5: + mc.thePlayer.motionY = -0.005; + break; + case 6: + mc.thePlayer.motionY = -1.0; + break; + } break; } } diff --git a/src/main/java/keystrokesmod/script/Script.java b/src/main/java/keystrokesmod/script/Script.java index e78357035..c3efa0edc 100644 --- a/src/main/java/keystrokesmod/script/Script.java +++ b/src/main/java/keystrokesmod/script/Script.java @@ -77,10 +77,10 @@ public boolean run() { try { s = URLDecoder.decode(s, "UTF-8"); } - catch (UnsupportedOperationException ex2) {} + catch (UnsupportedOperationException ignored) {} list.add(s); } - boolean success = Raven.scriptManager.compiler.getTask(null, standardFileManager, bp, list, null, Arrays.asList(new ClassObject(this.scriptName, this.codeStr, this.extraLines))).call(); + boolean success = Raven.scriptManager.compiler.getTask(null, standardFileManager, bp, list, null, Collections.singletonList(new ClassObject(this.scriptName, this.codeStr, this.extraLines))).call(); if (!success) { this.error = true; return false; diff --git a/src/main/java/keystrokesmod/utility/AimSimulator.java b/src/main/java/keystrokesmod/utility/AimSimulator.java index 12d327e34..8803fcbd8 100644 --- a/src/main/java/keystrokesmod/utility/AimSimulator.java +++ b/src/main/java/keystrokesmod/utility/AimSimulator.java @@ -64,7 +64,7 @@ private static double normal(double max, double min, double current) { } public static float rotMove(float target, float current, float diff) { - diff *= (float) Math.min(Math.random() + diff * 0.4, diff); + diff *= (float) Math.min(Math.random() * diff + diff * 0.2, diff); return rotMoveNoRandom(target, current, diff); } @@ -83,7 +83,7 @@ public static float rotMoveNoRandom(float target, float current, float diff) { float dist1 = current - target; float dist2 = target + 360 - current; if (dist1 > dist2) { // 另一边移动更近 - delta = target + 360 + current; + delta = current + 360 + target; } else { delta = -dist1; } @@ -93,7 +93,9 @@ public static float rotMoveNoRandom(float target, float current, float diff) { delta = RotationUtils.normalize(delta); - if (Math.abs(delta) <= diff) { + if (Math.abs(delta) < 0.1 * Math.random() + 0.1) { + return current; + } else if (Math.abs(delta) <= diff) { return current + delta; } else { if (delta < 0) { diff --git a/src/main/java/keystrokesmod/utility/RotationUtils.java b/src/main/java/keystrokesmod/utility/RotationUtils.java index ed15ec04e..0a80a96ac 100644 --- a/src/main/java/keystrokesmod/utility/RotationUtils.java +++ b/src/main/java/keystrokesmod/utility/RotationUtils.java @@ -240,14 +240,11 @@ public static float toPositive(float yaw) { } public static float normalize(float yaw) { - if (yaw > 360f) { - while (yaw > 180f) { - yaw -= 360f; - } - } else if (yaw <= -360f) { - while (yaw <= -180f) { - yaw += 360f; - } + while (yaw > 180f) { + yaw -= 360f; + } + while (yaw < -180f) { + yaw += 360f; } return yaw; diff --git a/src/main/java/keystrokesmod/utility/Utils.java b/src/main/java/keystrokesmod/utility/Utils.java index 67e7b3ca8..67871dba2 100644 --- a/src/main/java/keystrokesmod/utility/Utils.java +++ b/src/main/java/keystrokesmod/utility/Utils.java @@ -41,6 +41,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Range; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -147,16 +148,15 @@ public static boolean inFov(float fov, Entity entity) { } public static boolean inFov(float fov, final double n2, final double n3) { - fov *= 0.5; - final double wrapAngleTo180_double = MathHelper.wrapAngleTo180_double((mc.thePlayer.rotationYaw - RotationUtils.angle(n2, n3)) % 360.0f); - if (wrapAngleTo180_double > 0.0) { - if (wrapAngleTo180_double < fov) { - return true; - } - } else if (wrapAngleTo180_double > -fov) { - return true; - } - return false; + fov *= 0.5F; + final double fovToPoint = getFov(n2, n3); + if (fovToPoint > 0.0) { + return fovToPoint < fov; + } else return fovToPoint > -fov; + } + + public static @Range(from = -180, to = 180) double getFov(final double posX, final double posZ) { + return MathHelper.wrapAngleTo180_double((mc.thePlayer.rotationYaw - RotationUtils.angle(posX, posZ)) % 360.0f); } public static void sendMessage(String txt) { diff --git a/src/main/java/keystrokesmod/utility/clicks/Pattern.java b/src/main/java/keystrokesmod/utility/clicks/Pattern.java index 8ad7b2a49..60a305e43 100644 --- a/src/main/java/keystrokesmod/utility/clicks/Pattern.java +++ b/src/main/java/keystrokesmod/utility/clicks/Pattern.java @@ -5,7 +5,8 @@ public class Pattern { public static final Pattern DEFAULT = new Pattern("DefaultButterfly", Arrays.asList(0,48,198,0,51,150,51,99,51,50,149,50,99,102,100,98,51,99,100,51,101,99,99,102,100,100,98,52,100,0,100,99,0,101,98,1,100,99,101,50,50,51,98,0,100,101,49,99,99,152,51,98,0,101,51,150,50,100,99,0,100,102,100,48,102,100,0,100,100,0,99,51,150,49,101,149,0,50,149,51,101,0,100,200,148,51,150,0,49,201,149,0,52,150,100,101,99,99,99,101,52,49,98,0,103,50,49,50,150,48,101,50,101,100,98,102,149,50,150,50,101,0,99,202,98,100,51,100,101,148,100,51,149,99,102,0,50,98,52,49,150,100,101,101,98,0,101,100,99,101,49,51,199,101,99,100,101,99,51,48,101,51,151,98,101,149,52,48,100,51,99,152,0,97,152,49,153,47,100,101,99,102,98,101,100,100,99,0,99,103,48,50,99,102,98,50,52,100,101,48,50,50,151,99,101,99,102,97,103,0,99,100,100,100,49,51,149,101,99,100,102,99,49,100,101,49,50,100,100,101,149,101,98,100,101,101,98,102,99,101,51,49,101,151,97,101,99,100,150,53,98,100,99,99,351,102,99,99,152,0,98,100,100,201,101,48,50,101,101,99,100,99,51,99,0,100,100,100,149,0,100,102,99,51,98,101,101,101,148,51,100,49,100,101,48,51,101,100,100,101,98,50,51,99,100,149,102,99,99,151,0,101,100,100,99,99,101,101,149,51,100,99,150,101,99,52,148,51,150,49,150,51,150,49,150,100,102,98,99,151,101,100,98,101,149,52,149,101,151,48,101,0,150,99,0,100,150,104,96,102,149,101,97,152,98,100,252,98,100,102,100,101,99,100,99,100,101,98,101,101,148,53,99,49,150,99,100,101,0,98,153,98,149,0,101,150,100,100,101,100,99,102,98,150,50,150,100,150,100,150,100,151,98,151,51,150,99,102,100,149,100,99,52,49,150,0,100,99,50,49,150,153,98,99,102,101,149,48,152,51,149,100,150,101,99,101,99,149,102,151,99,48,101,102,100,98,103,203,145,100,100,98,102)); - + public static final Pattern VAPE = new Pattern("Vape V4", Arrays.asList(0,50,51,48,51,50,50,49,56,46,49,56,93,51,100,50,50,49,53,48,50,49,50,52,51,49,49,51,49,150,99,103,148,100,49,101,102,98,99,52,98,51,52,48,50,50,50,51,49,50,99,52,49,51,48,51,50,50,50,100,50,50,49,51,51,49,49,50,51,101,48,50,100,102,150,148,101,51,100,48,151,49,150,52,50,49,49,50,50,51,50,49,51,50,100,51,48,51,51,49,51,48,50,50,52,49,149,100,100,102,99,99,100,102,50,49,101,49,49,51,50,49,51,49,50,51,51,48,50,50,50,51,50,100,49,51,100,101,49,99,51,51,100,49,49,51,149,50,50,52,49,50,100,99,102,100,99,99,152,149,100,50,151,48,50,52,49,150,50,50,49,100,51,49,51,99,51,50,49,52,50,48,51,50,50,51,50,49,50,51,48,52,99,50,50,49,52,49,49,150,52,98,151,101,198,100,102,99,100,99,151,100,50,51,48,49,51,52,49,50,51,50,48,100,151,149,51,150,149,51,99,100,51,99,102,50,49,49,101,50,49,51,99,102,48,101,50,49,51,51,48,151,100,50,150,100,99,102,48,102,99,151,49,49,51,48,53,49,49,50,150,52,50,49,49,50,51,50,51,99,100,50,100,49,102,100,49,99,102,98,51,51,149,50,51,49,49,51,50,99,50,51,100,50,50,49,51,50,50,49,50,151,50,100,100,150,150,51,99,150,100,100,99,52,150,49,100,51,49,99,50,101,101,49,50,50,50,53,47,50,99,50,50,50,50,51,50,50,49,51,50,49,100,52,48,51,49,102,49,49,51,51,50,50,99,101,99,49,152,48,100,50,51,51,49,49,50,50,51,100,50,50,50,50,50,50,49,51,50,51,49,99,52,49,50,51,49,49,52,48,51,49,51,101,49,100,100,99,50,101,101,100,50,98,151,99,51,149,101,50,101,48,50,50,52,48,151,51,48,50,51,50,100,49,51,49,52,149,51,49,51,49,49,51,50,49,102,48,50,51,99,101,99,102,101,48,99,52,148,101,50,52,48,150,49,50,52,50,49,51,48,52,49,51,50,49,100,49,51,100,49,102,49,52,49,50,149,52,49,49,51,49,51,48,102,99,150,100,51,99,100,50,101,149,50,100,50,100,50,48,102,49,51,49,52,48,50,51,50,50,50,50,50,100,50,99,50,152,98,100,51,101,48,52,49,50,49,152,49,50,100,51,49,50,52,49,49,100,49,52,49,151,49,50,50,50,50,50,51,99,250,100,99,101,150,101,48,50,50,51,50)); + private final String name; public final List delays;