Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new module: AttributeSwap #70

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/pwn/noobs/trouserstreak/Trouser.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void onInitialize() {
Modules.get().add(new BoatKill());
Modules.get().add(new InstantKill());
Modules.get().add(new LecternCrash());
Modules.get().add(new AttributeSwap());

//Modules.get().add(new -----> And much more <-----());
Modules.get().add(new BookAndQuillDupe());
Expand Down
45 changes: 45 additions & 0 deletions src/main/java/pwn/noobs/trouserstreak/modules/AttributeSwap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package pwn.noobs.trouserstreak.modules;

import pwn.noobs.trouserstreak.Trouser;
import meteordevelopment.meteorclient.events.entity.player.AttackEntityEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.IntSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.orbit.EventHandler;

public class AttributeSwap extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final Setting<Integer> targetSlot = sgGeneral.add(new IntSetting.Builder().name("target-slot").description("The hotbar slot to swap to when attacking.").sliderRange(0, 8).defaultValue(0).build());
private final Setting<Boolean> swapBack = sgGeneral.add(new BoolSetting.Builder().name("swap-back").description("Swap back to the original slot after a short delay.").defaultValue(true).build());
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder().name("swap-back-delay").description("Delay in ticks before swapping back to the previous slot.").sliderRange(1, 20).defaultValue(1).visible(swapBack::get).build());
private int prevSlot = -1;
private int dDelay = 0;
public AttributeSwap() {
super(Trouser.Main, "Attribute Swap", "Tries the Atrribute Swap bug");
}
@EventHandler
private void onAttack(AttackEntityEvent event) {
if (mc.player == null || mc.world == null) return;
if (swapBack.get()) {
prevSlot = mc.player.getInventory().selectedSlot;
}
InvUtils.swap(targetSlot.get(), false);
if (swapBack.get() && prevSlot != -1) {
dDelay = delay.get();
}
}
@EventHandler
private void onTick(TickEvent.Pre event) {
if (dDelay > 0) {
dDelay--;
if (dDelay == 0 && prevSlot != -1) {
InvUtils.swap(prevSlot, false);
prevSlot = -1;
}
}
}
}