swarm module

swarm: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationMisc

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientMiscsrc/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/Swarm.javaJava · 143 lines · 4.1 KB

Allows you to control multiple instances of Meteor from one central host.

Settingsmodeipport
Swarm.javaJava · Minecraft 26.2 · 143 lines · 4.1 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.misc.swarm;
7
8
import meteordevelopment.meteorclient.events.game.GameJoinedEvent;
9
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
10
import meteordevelopment.meteorclient.events.world.TickEvent;
11
import meteordevelopment.meteorclient.gui.GuiTheme;
12
import meteordevelopment.meteorclient.gui.widgets.WWidget;
13
import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList;
14
import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList;
15
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
16
import meteordevelopment.meteorclient.settings.*;
17
import meteordevelopment.meteorclient.systems.modules.Categories;
18
import meteordevelopment.meteorclient.systems.modules.Module;
19
import meteordevelopment.orbit.EventHandler;
20
import net.minecraft.util.Util;
21
22
public class Swarm extends Module {
23
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
24
25
    public final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
26
        .name("mode")
27
        .description("What type of client to run.")
28
        .defaultValue(Mode.Host)
29
        .build()
30
    );
31
32
    private final Setting<String> ipAddress = sgGeneral.add(new StringSetting.Builder()
33
        .name("ip")
34
        .description("The IP address of the host server.")
35
        .defaultValue("localhost")
36
        .visible(() -> mode.get() == Mode.Worker)
37
        .build()
38
    );
39
40
    private final Setting<Integer> serverPort = sgGeneral.add(new IntSetting.Builder()
41
        .name("port")
42
        .description("The port used for connections.")
43
        .defaultValue(6969)
44
        .range(1, 65535)
45
        .noSlider()
46
        .build()
47
    );
48
49
    public SwarmHost host;
50
    public SwarmWorker worker;
51
52
    public Swarm() {
53
        super(Categories.Misc, "swarm", "Allows you to control multiple instances of Meteor from one central host.");
54
    }
55
56
    @Override
57
    public WWidget getWidget(GuiTheme theme) {
58
        WVerticalList list = theme.verticalList();
59
60
        WHorizontalList b = list.add(theme.horizontalList()).expandX().widget();
61
62
        WButton start = b.add(theme.button("Start")).expandX().widget();
63
        start.action = () -> {
64
            if (!isActive()) return;
65
66
            close();
67
            if (mode.get() == Mode.Host) host = new SwarmHost(serverPort.get());
68
            else worker = new SwarmWorker(ipAddress.get(), serverPort.get());
69
        };
70
71
        WButton stop = b.add(theme.button("Stop")).expandX().widget();
72
        stop.action = this::close;
73
74
        WButton guide = list.add(theme.button("Guide")).expandX().widget();
75
        guide.action = () -> Util.getPlatform().openUri("https://github.com/MeteorDevelopment/meteor-client/wiki/Swarm-Guide");
76
77
        return list;
78
    }
79
80
    @Override
81
    public String getInfoString() {
82
        return mode.get().name();
83
    }
84
85
    @Override
86
    public void onActivate() {
87
        close();
88
    }
89
90
    @Override
91
    public void onDeactivate() {
92
        close();
93
    }
94
95
    public void close() {
96
        try {
97
            if (host != null) {
98
                host.disconnect();
99
                host = null;
100
            }
101
            if (worker != null) {
102
                worker.disconnect();
103
                worker = null;
104
            }
105
        } catch (Exception _) {
106
        }
107
    }
108
109
    @EventHandler
110
    private void onGameLeft(GameLeftEvent event) {
111
        toggle();
112
    }
113
114
    @EventHandler
115
    private void onGameJoin(GameJoinedEvent event) {
116
        toggle();
117
    }
118
119
    @Override
120
    public void toggle() {
121
        close();
122
        super.toggle();
123
    }
124
125
    public boolean isHost() {
126
        return mode.get() == Mode.Host && host != null && !host.isInterrupted();
127
    }
128
129
    public boolean isWorker() {
130
        return mode.get() == Mode.Worker && worker != null && !worker.isInterrupted();
131
    }
132
133
    @EventHandler
134
    private void onTick(TickEvent.Post event) {
135
        if (isWorker()) worker.tick();
136
    }
137
138
    public enum Mode {
139
        Host,
140
        Worker
141
    }
142
}
143