diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 446309da..2e9fdfdc 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -211,7 +211,7 @@ public void register() { this.addModule(panic = new Panic()); this.addModule(slotHandler = new SlotHandler()); this.addModule(staffDetector = new StaffDetector()); - this.addModule(new AutoWeapon()); + this.addModule(new AutoWeapon()); this.addModule(autoRespawn = new AutoRespawn()); antiBot.enable(); diff --git a/src/main/java/keystrokesmod/module/impl/movement/Fly.java b/src/main/java/keystrokesmod/module/impl/movement/Fly.java index 319459e1..d096aa97 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Fly.java @@ -53,7 +53,7 @@ public Fly() { this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 2.0, 0.0, 9.0, 0.1, canChangeSpeed)); this.registerSetting(maxBalance = new SliderSetting("Max balance", 6000, 3000, 30000, 1000, "ms", balanceMode)); this.registerSetting(autoDisable = new ButtonSetting("Auto disable", true, balanceMode)); - this.registerSetting(motionMultiplier = new SliderSetting("Motion multiplier", 1.0, 0.8, 1.1, 0.05, new ModeOnly(mode, 6))); + this.registerSetting(motionMultiplier = new SliderSetting("Motion multiplier", 1.0, 0.8, 1.2, 0.05, new ModeOnly(mode, 6))); this.registerSetting(showBPS = new ButtonSetting("Show BPS", false)); this.registerSetting(stopMotion = new ButtonSetting("Stop motion", false)); } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java index 0da423e8..b36b7be8 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java @@ -1,5 +1,7 @@ package keystrokesmod.module.impl.world; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -16,6 +18,7 @@ public class AutoWeapon extends Module { private final SliderSetting hoverDelay; private final ButtonSetting swap; + private final ButtonSetting ignoreTeammates; private int previousSlot = -1; private int ticksHovered; private Entity currentEntity; @@ -23,8 +26,9 @@ public AutoWeapon() { super("AutoWeapon", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); this.registerSetting(swap = new ButtonSetting("Swap to previous slot", true)); + this.registerSetting(ignoreTeammates = new ButtonSetting("Ignore teammates", true)); this.registerSetting(new DescriptionSetting("Configure your weapons in the Settings tab.")); - } + } public void onDisable() { resetVariables(); @@ -38,26 +42,24 @@ public void setSlot(final int currentItem) { } @SubscribeEvent - public void onTick(TickEvent.RenderTickEvent e) { - if (Utils.nullCheck() || !mc.inGameHasFocus || mc.currentScreen != null) { + public void onPreMotion(PreMotionEvent e) { + if (!Utils.nullCheck() || !mc.inGameHasFocus || mc.currentScreen != null) { resetSlot(); resetVariables(); return; } Entity hoveredEntity = mc.objectMouseOver != null ? mc.objectMouseOver.entityHit : null; - if (!(hoveredEntity instanceof Entity)) { + if (!(hoveredEntity instanceof EntityLivingBase) + || (hoveredEntity instanceof EntityPlayer && AntiBot.isBot(hoveredEntity)) + || (hoveredEntity instanceof EntityPlayer && Utils.isFriended((EntityPlayer) hoveredEntity)) + || (ignoreTeammates.isToggled() && Utils.isTeamMate(hoveredEntity)) + ) { resetSlot(); resetVariables(); return; } ticksHovered = hoveredEntity.equals(currentEntity) ? ticksHovered + 1 : 0; - if (hoveredEntity instanceof EntityLivingBase - && !AntiBot.isBot(hoveredEntity) - && (!(hoveredEntity instanceof EntityPlayer) || Utils.isFriended((EntityPlayer) hoveredEntity)) - && !Utils.isTeamMate(hoveredEntity) - ) { - currentEntity = hoveredEntity; - } + currentEntity = hoveredEntity; if (hoverDelay.getInput() == 0 || ticksHovered > hoverDelay.getInput()) { int slot = Utils.getWeapon();