Skip to content

Commit

Permalink
Merge pull request #70 from DonKisser/AttributeSwap
Browse files Browse the repository at this point in the history
Added new module: AttributeSwap
  • Loading branch information
etianl authored Dec 27, 2024
2 parents c067424 + 3c4a9f4 commit 1073c91
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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 @@ -70,6 +70,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;
}
}
}
}

0 comments on commit 1073c91

Please sign in to comment.