Skip to content

Commit 72b2c4e

Browse files
Fixed Bed Aura automove and autoswitch
1 parent 27e2804 commit 72b2c4e

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

  • src/main/java/meteordevelopment/meteorclient/systems/modules/combat

src/main/java/meteordevelopment/meteorclient/systems/modules/combat/BedAura.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
public class BedAura extends Module {
4040
private final SettingGroup sgGeneral = settings.getDefaultGroup();
4141
private final SettingGroup sgTargeting = settings.createGroup("Targeting");
42-
private final SettingGroup sgAutoMove = settings.createGroup("Inventory");
42+
private final SettingGroup sgInventory = settings.createGroup("Inventory");
4343
private final SettingGroup sgPause = settings.createGroup("Pause");
4444
private final SettingGroup sgRender = settings.createGroup("Render");
4545

@@ -89,7 +89,7 @@ public class BedAura extends Module {
8989
private final Setting<Integer> placeDelay = sgGeneral.add(new IntSetting.Builder()
9090
.name("place-delay")
9191
.description("The delay between placing beds in ticks.")
92-
.defaultValue(10)
92+
.defaultValue(5)
9393
.range(0, 10)
9494
.visible(place::get)
9595
.build()
@@ -98,7 +98,7 @@ public class BedAura extends Module {
9898
private final Setting<Integer> breakDelay = sgGeneral.add(new IntSetting.Builder()
9999
.name("break-delay")
100100
.description("The tick delay between exploding beds.")
101-
.defaultValue(2)
101+
.defaultValue(0)
102102
.min(0)
103103
.sliderMax(10)
104104
.build()
@@ -168,14 +168,14 @@ public class BedAura extends Module {
168168

169169
// Inventory
170170

171-
private final Setting<Boolean> autoMove = sgAutoMove.add(new BoolSetting.Builder()
171+
private final Setting<Boolean> autoMove = sgInventory.add(new BoolSetting.Builder()
172172
.name("auto-move")
173173
.description("Moves beds into a selected hotbar slot.")
174174
.defaultValue(false)
175175
.build()
176176
);
177177

178-
private final Setting<Integer> autoMoveSlot = sgAutoMove.add(new IntSetting.Builder()
178+
private final Setting<Integer> autoMoveSlot = sgInventory.add(new IntSetting.Builder()
179179
.name("auto-move-slot")
180180
.description("The slot auto move moves beds to.")
181181
.defaultValue(9)
@@ -185,14 +185,14 @@ public class BedAura extends Module {
185185
.build()
186186
);
187187

188-
private final Setting<Boolean> autoSwitch = sgAutoMove.add(new BoolSetting.Builder()
188+
private final Setting<Boolean> autoSwitch = sgInventory.add(new BoolSetting.Builder()
189189
.name("auto-switch")
190190
.description("Switches to beds automatically.")
191191
.defaultValue(true)
192192
.build()
193193
);
194194

195-
private final Setting<Boolean> swapBack = sgAutoMove.add(new BoolSetting.Builder()
195+
private final Setting<Boolean> swapBack = sgInventory.add(new BoolSetting.Builder()
196196
.name("swap-back")
197197
.description("Switches to your previous slot after using beds.")
198198
.defaultValue(true)
@@ -314,12 +314,12 @@ private void onTick(TickEvent.Pre event) {
314314
if (TargetUtils.isBadTarget(target, targetRange.get())) return;
315315
}
316316

317-
// Auto move
317+
// Auto move beds from inventory
318318
if (autoMove.get()) {
319319
FindItemResult bed = InvUtils.find(itemStack -> itemStack.getItem() instanceof BedItem);
320320
boolean alreadyHasBed = mc.player.getInventory().getStack(autoMoveSlot.get() - 1).getItem() instanceof BedItem;
321321
if (bed.found() && !bed.isHotbar() && !alreadyHasBed) {
322-
InvUtils.move().from(bed.slot()).toHotbar(autoMoveSlot.get() - 1);
322+
InvUtils.quickSwap().fromId(autoMoveSlot.get() - 1).to(bed.slot());
323323
}
324324
}
325325

@@ -414,6 +414,8 @@ private void doPlace() {
414414

415415
if (autoSwitch.get()) InvUtils.swap(bed.slot(), swapBack.get());
416416

417+
if (!mc.player.isHolding(itemStack -> itemStack.getItem() instanceof BedItem)) return;
418+
417419
// Get rotation to use depending on what direction we are doing
418420
double yaw = Direction.getHorizontalDegreesOrThrow(bestPlaceDirection);
419421

@@ -422,12 +424,9 @@ private void doPlace() {
422424

423425
// Place bed!
424426
Rotations.rotate(yaw, Rotations.getPitch(bestPlacePos), () -> {
425-
BlockUtils.place(bestPlacePos, bed, false, 0, swing.get(), true);
427+
BlockUtils.place(bestPlacePos, bed, false, 0, swing.get(), true, swapBack.get());
428+
placeDelayLeft = 0;
426429
});
427-
428-
if (swapBack.get()) InvUtils.swapBack();
429-
430-
placeDelayLeft = 0;
431430
}
432431

433432
private void doBreak() {
@@ -443,8 +442,6 @@ private void doBreak() {
443442
} else {
444443
doInteract();
445444
}
446-
447-
breakDelayLeft = 0;
448445
}
449446

450447
private void doInteract() {
@@ -454,6 +451,7 @@ private void doInteract() {
454451
}
455452

456453
BlockUtils.interact(new BlockHitResult(bestBreakPos.toCenterPos(), BlockUtils.getDirection(bestBreakPos), bestBreakPos, true), Hand.MAIN_HAND, swing.get());
454+
breakDelayLeft = 0;
457455
}
458456

459457
private boolean isOutOfRange(BlockPos blockPos) {

0 commit comments

Comments
 (0)