|
5 | 5 | import fartenware.utils.bedrock.Messager; |
6 | 6 | import fartenware.utils.bedrock.TargetBlock; |
7 | 7 | import meteordevelopment.meteorclient.events.world.TickEvent; |
| 8 | +import meteordevelopment.meteorclient.settings.*; |
8 | 9 | import meteordevelopment.meteorclient.systems.modules.Module; |
| 10 | +import meteordevelopment.meteorclient.systems.modules.Modules; |
| 11 | +import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; |
| 12 | +import meteordevelopment.meteorclient.systems.modules.player.*; |
| 13 | +import meteordevelopment.meteorclient.systems.modules.world.NoGhostBlocks; |
| 14 | +import meteordevelopment.meteorclient.systems.modules.world.PacketMine; |
| 15 | +import meteordevelopment.meteorclient.systems.modules.world.Timer; |
9 | 16 | import meteordevelopment.orbit.EventHandler; |
10 | 17 | import net.minecraft.block.Blocks; |
11 | 18 | import net.minecraft.client.MinecraftClient; |
|
14 | 21 | import net.minecraft.util.math.BlockPos; |
15 | 22 |
|
16 | 23 | import java.util.ArrayList; |
| 24 | +import java.util.List; |
17 | 25 |
|
18 | 26 | public class BedrockBreaker extends Module { |
| 27 | + private final SettingGroup sgGeneral = settings.getDefaultGroup(); |
| 28 | + |
| 29 | + private final Setting<Boolean> toggleModules = sgGeneral.add(new BoolSetting.Builder() |
| 30 | + .name("toggle-modules") |
| 31 | + .description("Turn off specific modules when BedrockBreaker is activated.") |
| 32 | + .defaultValue(true) |
| 33 | + .build() |
| 34 | + ); |
| 35 | + |
| 36 | + private final Setting<Boolean> toggleBack = sgGeneral.add(new BoolSetting.Builder() |
| 37 | + .name("toggle-back-on") |
| 38 | + .description("Turn the specific modules back on when BedrockBreaker is deactivated.") |
| 39 | + .defaultValue(false) |
| 40 | + .visible(toggleModules::get) |
| 41 | + .build() |
| 42 | + ); |
| 43 | + |
| 44 | + private final Setting<List<Module>> modules = sgGeneral.add(new ModuleListSetting.Builder() |
| 45 | + .name("modules") |
| 46 | + .description("Which modules to disable on activation.") |
| 47 | + .defaultValue(new ArrayList<>() {{ |
| 48 | + add(Modules.get().get(AntiHunger.class)); |
| 49 | + add(Modules.get().get(AntiPacketKick.class)); |
| 50 | + add(Modules.get().get(AutoClicker.class)); |
| 51 | + add(Modules.get().get(AutoTool.class)); |
| 52 | + add(Modules.get().get(BreakDelay.class)); |
| 53 | + add(Modules.get().get(NoGhostBlocks.class)); |
| 54 | + add(Modules.get().get(NoMiningTrace.class)); |
| 55 | + add(Modules.get().get(PacketMine.class)); |
| 56 | + add(Modules.get().get(Timer.class)); |
| 57 | + }}) |
| 58 | + .visible(toggleModules::get) |
| 59 | + .build() |
| 60 | + ); |
| 61 | + |
19 | 62 | public BedrockBreaker() { |
20 | 63 | super(FartenWare.MAIN, "bedrock-breaker", "Breaks bedrock automatically (requires haste 2)."); |
21 | 64 | } |
22 | 65 |
|
| 66 | + public ArrayList<Module> toActivate; |
23 | 67 | private static ArrayList<TargetBlock> cachedTargetBlockList = new ArrayList<>(); |
24 | 68 |
|
| 69 | + @Override |
| 70 | + public void onActivate() { |
| 71 | + toActivate = new ArrayList<>(); |
| 72 | + |
| 73 | + if (toggleModules.get() && !modules.get().isEmpty() && mc.world != null && mc.player != null) { |
| 74 | + for (Module module : modules.get()) { |
| 75 | + if (module.isActive()) { |
| 76 | + module.toggle(); |
| 77 | + toActivate.add(module); |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + @Override |
| 84 | + public void onDeactivate() { |
| 85 | + if (toggleBack.get() && !toActivate.isEmpty() && mc.world != null && mc.player != null) { |
| 86 | + for (Module module : toActivate) { |
| 87 | + if (!module.isActive()) { |
| 88 | + module.toggle(); |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
25 | 94 | public static void addBlockPosToList(BlockPos pos) { |
26 | 95 | ClientWorld world = MinecraftClient.getInstance().world; |
27 | 96 | if (world.getBlockState(pos).isOf(Blocks.BEDROCK)) { |
|
0 commit comments