Skip to content

Commit

Permalink
okay
Browse files Browse the repository at this point in the history
  • Loading branch information
user93390 committed Nov 24, 2024
1 parent 7285ba4 commit 94d7ed8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
18 changes: 7 additions & 11 deletions src/main/java/org/snail/plus/modules/misc/autoXP.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.concurrent.Executors;
import java.util.stream.StreamSupport;

import static meteordevelopment.meteorclient.MeteorClient.mc;

public class autoXP extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();

Expand All @@ -30,17 +32,16 @@ public class autoXP extends Module {

private final Setting<swapUtils.swapMode> autoSwitch = sgGeneral.add(new EnumSetting.Builder<swapUtils.swapMode>()
.name("swap-mode")
.description("Swapping method")
.description("Swapping method. IGNORE MOVE")
.defaultValue(swapUtils.swapMode.silent)
.build());

private final Setting<Integer> moveSlot = sgGeneral.add(new IntSetting.Builder()
.name("slot")
.description("the slot to move the xp to")
.defaultValue(0)
.min(0)
.sliderMax(10)
.visible(() -> autoSwitch.get().equals(swapUtils.swapMode.silent) || autoSwitch.get().equals(swapUtils.swapMode.normal))
.sliderRange(0, 10)
.visible(() -> autoSwitch.get().equals(swapUtils.swapMode.silent) || autoSwitch.get().equals(swapUtils.swapMode.normal) || autoSwitch.get().equals(swapUtils.swapMode.Move))
.build());

private final Setting<WorldUtils.HandMode> handSwing = sgGeneral.add(new EnumSetting.Builder<WorldUtils.HandMode>()
Expand Down Expand Up @@ -109,7 +110,7 @@ public void onDeactivate() {

@EventHandler
private void onTick(TickEvent.Post event) {
mc.executeTask(() -> {
mc.executeSync(() -> {
if (autoDisable.get() && isArmorFullDurability()) {
toggle();
return;
Expand Down Expand Up @@ -146,15 +147,10 @@ public void interact() {
swapUtils.pickSwapBack();
}
case normal -> {
InvUtils.move().from(slot).to(moveSlot.get());
InvUtils.move().from(slot).to(moveSlot.get() - 1);
InvUtils.swap(slot, false);
mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
}
case Move -> {
swapUtils.moveSwitch(slot, moveSlot.get());
mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
swapUtils.moveSwitch(moveSlot.get(), slot);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/snail/plus/utils/WorldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static void placeBlock(FindItemResult item, BlockPos pos, HandMode hand,
case Move -> {
swapUtils.moveSwitch(item.slot(), mc.player.getInventory().selectedSlot);
placeAction.run();
swapUtils.moveSwitch(item.slot(), mc.player.getInventory().selectedSlot);
swapUtils.moveSwitch(mc.player.getInventory().selectedSlot, item.slot());
}
case none -> placeAction.run();
default -> throw new IllegalArgumentException("Unexpected value: " + Mode);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/snail/plus/utils/swapUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

public class swapUtils {
public static int pickSlot = -1;
public static int moveSlot = -1;

//credits to Blackout-client
public static void pickSwitch(int slot) {
Expand Down Expand Up @@ -52,4 +51,4 @@ public enum swapMode {
normal,
none
}
}
}

0 comments on commit 94d7ed8

Please sign in to comment.