Skip to content

Commit

Permalink
Add multitask module
Browse files Browse the repository at this point in the history
closes #3336, closes #1765
  • Loading branch information
Wide-Cat committed Sep 11, 2024
1 parent 4ed2ee0 commit e4fc59e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import meteordevelopment.meteorclient.systems.config.Config;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.player.FastUse;
import meteordevelopment.meteorclient.systems.modules.player.Multitask;
import meteordevelopment.meteorclient.systems.modules.render.UnfocusedCPU;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.CPSUtils;
Expand All @@ -28,6 +29,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.util.Window;
Expand Down Expand Up @@ -74,6 +76,10 @@ public abstract class MinecraftClientMixin implements IMinecraftClient {
@Shadow
private int itemUseCooldown;

@Shadow
@Nullable
public ClientPlayerEntity player;

@Inject(method = "<init>", at = @At("TAIL"))
private void onInit(CallbackInfo info) {
MeteorClient.INSTANCE.onInitializeClient();
Expand Down Expand Up @@ -186,6 +192,31 @@ private void onRender(CallbackInfo info) {
lastTime = time;
}

// multitask

@ModifyExpressionValue(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
private boolean doItemUseModifyIsBreakingBlock(boolean original) {
return !Modules.get().isActive(Multitask.class) && original;
}

@ModifyExpressionValue(method = "handleBlockBreaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"))
private boolean handleBlockBreakingModifyIsUsingItem(boolean original) {
return !Modules.get().isActive(Multitask.class) && original;
}

@ModifyExpressionValue(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z", ordinal = 0))
private boolean handleInputEventsModifyIsUsingItem(boolean original) {
return !Modules.get().get(Multitask.class).attackingEntities() && original;
}

@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z", ordinal = 0, shift = At.Shift.BEFORE))
private void handleInputEventsInjectStopUsingItem(CallbackInfo info) {
if (Modules.get().get(Multitask.class).attackingEntities() && player.isUsingItem()) {
if (!options.useKey.isPressed()) interactionManager.stopUsingItem(player);
while (options.useKey.wasPressed());
}
}

// Interface

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,13 @@ private void initCombat() {
private void initPlayer() {
add(new AntiHunger());
add(new AutoEat());
add(new AutoClicker());
add(new AutoFish());
add(new AutoGap());
add(new AutoMend());
add(new AutoReplenish());
add(new AutoTool());
add(new BreakDelay());
add(new ChestSwap());
add(new EXPThrower());
add(new FakePlayer());
Expand All @@ -443,12 +445,11 @@ private void initPlayer() {
add(new InstantRebreak());
add(new LiquidInteract());
add(new MiddleClickExtra());
add(new BreakDelay());
add(new Multitask());
add(new NoInteract());
add(new NoMiningTrace());
add(new NoRotate());
add(new OffhandCrash());
add(new PacketMine());
add(new Portals());
add(new PotionSaver());
add(new PotionSpoof());
Expand Down Expand Up @@ -538,7 +539,6 @@ private void initRender() {
private void initWorld() {
add(new AirPlace());
add(new Ambience());
add(new Collisions());
add(new AutoBreed());
add(new AutoBrewer());
add(new AutoMount());
Expand All @@ -547,18 +547,20 @@ private void initWorld() {
add(new AutoSign());
add(new AutoSmelter());
add(new BuildHeight());
add(new Collisions());
add(new EChestFarmer());
add(new EndermanLook());
add(new Flamethrower());
add(new HighwayBuilder());
add(new LiquidFiller());
add(new MountBypass());
add(new NoGhostBlocks());
add(new Nuker());
add(new PacketMine());
add(new StashFinder());
add(new SpawnProofer());
add(new Timer());
add(new VeinMiner());
add(new HighwayBuilder());

if (BaritoneUtils.IS_AVAILABLE) {
add(new Excavator());
Expand All @@ -569,23 +571,22 @@ private void initWorld() {
private void initMisc() {
add(new Swarm());
add(new AntiPacketKick());
add(new AutoClicker());
add(new AutoLog());
add(new AutoReconnect());
add(new AutoRespawn());
add(new BetterBeacons());
add(new BetterChat());
add(new BookBot());
add(new DiscordPresence());
add(new InventoryTweaks());
add(new MessageAura());
add(new NameProtect());
add(new Notebot());
add(new Notifier());
add(new PacketCanceller());
add(new ServerSpoof());
add(new SoundBlocker());
add(new Spam());
add(new ServerSpoof());
add(new InventoryTweaks());
}

public static class ModuleRegistry extends SimpleRegistry<Module> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.player;

import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;

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

private final Setting<Boolean> attackingEntities = sgGeneral.add(new BoolSetting.Builder()
.name("attacking-entities")
.description("Lets you attack entities while using an item.")
.defaultValue(true)
.build()
);

public Multitask() {
super(Categories.Player, "multitask", "Lets you use items and attack at the same time.");
}

public boolean attackingEntities() {
return isActive() && attackingEntities.get();
}
}

0 comments on commit e4fc59e

Please sign in to comment.