ServerHelper module

ServerHelper: Minecraft 26.3 cheat module, full source for every implementation (1 client: MelaHack (ThunderHack fork)).

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.

MelaHack (ThunderHack fork)MISCsrc/main/java/thunder/hack/features/modules/misc/ServerHelper.javaJava · 297 lines · 13.2 KB
SettingsPhotoMathAntiTpHereClanInviteInviteDelay/fix all/feed/nearAirDropWayFarmilkaTrueSightSpekNotifyDesorientTrapAucHelperGroupByContrast
ServerHelper.javaJava · Minecraft 26.2 · 297 lines · 13.2 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.misc;
2
import meteordevelopment.orbit.EventHandler;
3
import net.minecraft.client.gui.GuiGraphicsExtractor;
4
import net.minecraft.client.multiplayer.PlayerInfo;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket;
7
import net.minecraft.network.protocol.game.ServerboundChatCommandPacket;
8
import net.minecraft.network.protocol.game.ServerboundContainerClosePacket;
9
import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
10
import net.minecraft.world.InteractionHand;
11
import net.minecraft.world.entity.Entity;
12
import net.minecraft.world.entity.LivingEntity;
13
import net.minecraft.world.entity.player.Player;
14
import net.minecraft.world.inventory.ChestMenu;
15
import net.minecraft.world.inventory.ContainerInput;
16
import net.minecraft.world.inventory.Slot;
17
import net.minecraft.world.item.Item;
18
import net.minecraft.world.item.ItemStack;
19
import net.minecraft.world.item.Items;
20
import org.apache.commons.lang3.StringUtils;
21
import thunder.hack.ThunderHack;
22
import thunder.hack.core.Managers;
23
import thunder.hack.events.impl.EventSync;
24
import thunder.hack.events.impl.PacketEvent;
25
import thunder.hack.features.modules.Module;
26
import thunder.hack.gui.notification.Notification;
27
import thunder.hack.setting.Setting;
28
import thunder.hack.setting.impl.Bind;
29
import thunder.hack.utility.ThunderUtility;
30
import thunder.hack.utility.Timer;
31
import thunder.hack.utility.player.InventoryUtility;
32
import thunder.hack.utility.player.SearchInvResult;
33
import thunder.hack.utility.render.Render2DEngine;
34
import java.util.List;
35
36
import java.awt.*;
37
import java.util.*;
38
39
import static thunder.hack.features.modules.client.ClientSettings.isRu;
40
41
public class ServerHelper extends Module {
42
    public ServerHelper() {
43
        super("ServerHelper", Category.MISC);
44
    }
45
46
    private final Setting<Boolean> photomath = new Setting<>("PhotoMath", false);
47
    private final Setting<Boolean> antiTpHere = new Setting<>("AntiTpHere", false);
48
    private final Setting<Boolean> clanInvite = new Setting<>("ClanInvite", false);
49
    private final Setting<Integer> clanInviteDelay = new Setting<>("InviteDelay", 10, 1, 30, v -> clanInvite.getValue());
50
    private final Setting<Boolean> fixAll = new Setting<>("/fix all", true);
51
    private final Setting<Boolean> feed = new Setting<>("/feed", true);
52
    private final Setting<Boolean> near = new Setting<>("/near", true);
53
    private final Setting<Boolean> airDropWay = new Setting<>("AirDropWay", true);
54
    private final Setting<Boolean> farmilka = new Setting<>("Farmilka", true);
55
    public final Setting<Boolean> trueSight = new Setting<>("TrueSight", true);
56
    private final Setting<Boolean> spek = new Setting<>("SpekNotify", true);
57
    private final Setting<Bind> desorient = new Setting<>("Desorient", new Bind(-1, false, false));
58
    private final Setting<Bind> trap = new Setting<>("Trap", new Bind(-1, false, false));
59
    public final Setting<Boolean> aucHelper = new Setting<>("AucHelper", true);
60
    private final Setting<GroupBy> groupBy = new Setting<>("GroupBy", GroupBy.ItemType, v -> aucHelper.getValue());
61
    private final Setting<Integer> contrast = new Setting<>("Contrast", 4, 1, 15, v -> aucHelper.getValue());
62
63
    private enum GroupBy {
64
        Name, ItemType
65
    }
66
67
    private final Timer pvpTimer = new Timer();
68
    private final Timer inviteTimer = new Timer();
69
    private final Timer atphtimer = new Timer();
70
    private final Timer checktimer = new Timer();
71
    private List<AucItem> result = new ArrayList<>();
72
73
    private final Timer disorientTimer = new Timer();
74
    private final Timer trapTimer = new Timer();
75
76
    private boolean flag = false;
77
78
79
    @EventHandler
80
    public void onPacketReceive(PacketEvent.Receive event) {
81
        if (event.getPacket() instanceof ClientboundSystemChatPacket pac) {
82
            if (spek.getValue()) {
83
                String content = pac.content().getString().toLowerCase();
84
                if (content.contains("спек") || content.contains("ызус") || content.contains("spec") || content.contains("spek") || content.contains("ызул")) {
85
                    String name = ThunderUtility.solveName(pac.content().getString());
86
                    Managers.NOTIFICATION.publicity("SpekNotification", isRu() ? name + " хочет чтобы за ним проследили" : name + " wants to be followed", 3, Notification.Type.WARNING);
87
                }
88
            }
89
90
            if (photomath.getValue())
91
                if (pac.content().getString().contains("Решите: ") && Objects.equals(ThunderUtility.solveName(pac.content().getString()), "FATAL ERROR"))
92
                    try {
93
                        mc.player.connection.sendChat(String.valueOf(Integer.parseInt(StringUtils.substringBetween(pac.content().getString(), "Решите: ", " + ")) + Integer.parseInt(StringUtils.substringBetween(pac.content().getString(), " + ", " кто первый"))));
94
                    } catch (Exception ignored) {
95
                    }
96
97
            if (antiTpHere.getValue()) {
98
                if (pac.content().getString().contains("Телепортирование...") && check(pac.content().getString())) {
99
                    flag = true;
100
                    atphtimer.reset();
101
                }
102
            }
103
104
            if (airDropWay.getValue() && pac.content().getString().contains("Аирдроп")) {
105
                try {
106
                    int xCord = Integer.parseInt(StringUtils.substringBetween(pac.content().getString(), "координаты X: ", " Y:"));
107
                    int yCord = Integer.parseInt(StringUtils.substringBetween(pac.content().getString(), "Y: ", " Z:"));
108
                    int zCord = Integer.parseInt(StringUtils.substringBetween(pac.content().getString() + "nigga", "Z: ", "nigga"));
109
                    ThunderHack.gps_position = new BlockPos(xCord, yCord, zCord);
110
                    Managers.NOTIFICATION.publicity("FGHelper", "Поставлена метка на аирдроп! X: " + xCord + " Y: " + yCord + " Z: " + zCord, 5, Notification.Type.SUCCESS);
111
                } catch (Exception ignored) {
112
                }
113
            }
114
        }
115
    }
116
117
    @Override
118
    public void onUpdate() {
119
        if (flag && atphtimer.passedMs(100) && antiTpHere.getValue()) {
120
            StringBuilder log = new StringBuilder("Тебя телепортировали в X: " + (int) mc.player.getX() + " Z: " + (int) mc.player.getZ() + ". Ближайшие игроки : ");
121
122
            for (Player entity : mc.level.players()) {
123
                if (entity == mc.player) continue;
124
                log.append(entity.getName().getString()).append(" ");
125
            }
126
            sendMessage(String.valueOf(log));
127
128
            mc.player.connection.sendCommand("back");
129
            flag = false;
130
        }
131
132
        if (inviteTimer.passedS(clanInviteDelay.getValue()) && clanInvite.getValue()) {
133
            ArrayList<String> playersNames = new ArrayList<>();
134
            for (PlayerInfo player : mc.player.connection.getOnlinePlayers()) {
135
                playersNames.add(player.getProfile().name());
136
            }
137
            if (playersNames.size() > 1) {
138
                int randomName = (int) Math.floor(Math.random() * playersNames.size());
139
                mc.player.connection.sendCommand("c invite " + playersNames.get(randomName));
140
                playersNames.clear();
141
                inviteTimer.reset();
142
            }
143
        }
144
145
        if (feed.getValue() && mc.player.getFoodData().getFoodLevel() < 8 && canSendCommand())
146
            mc.player.connection.sendCommand("feed");
147
148
        if (fixAll.getValue() && canSendCommand())
149
            mc.player.connection.sendCommand("fix all");
150
151
        if (mc.player.hurtTime > 0)
152
            pvpTimer.reset();
153
154
        if (near.getValue() && mc.player.tickCount % 30 == 0)
155
            mc.player.connection.sendCommand("near");
156
157
        if (farmilka.getValue()) {
158
            for (Entity ent : Managers.ASYNC.getAsyncEntities()) {
159
                if (ent instanceof Player) continue;
160
                if (ent instanceof LivingEntity) {
161
                    if (((LivingEntity) ent).isDeadOrDying())
162
                        mc.level.removeEntity(ent.getId(), Entity.RemovalReason.KILLED);
163
                }
164
            }
165
        }
166
167
        if (mc.player.containerMenu instanceof ChestMenu chest && aucHelper.getValue()) {
168
            if (mc.gui.screen().getTitle().getString().contains("Аукцион") || mc.gui.screen().getTitle().getString().contains("Поиск")) {
169
170
                result.clear();
171
                Map<String, Integer> itemMap = new HashMap<>();
172
173
                int slot = 0;
174
175
                for (ItemStack itemStack : chest.getItems()) {
176
                    if (slot > 44)
177
                        continue;
178
179
                    int price = getPrice(itemStack);
180
181
                    if (itemStack.getCount() > 1)
182
                        price /= itemStack.getCount();
183
184
                    itemMap.put(getKey(itemStack), Math.min(itemMap.getOrDefault(getKey(itemStack), 999999999), price));
185
                    slot++;
186
                }
187
188
                slot = 0;
189
                for (ItemStack itemStack : chest.getItems()) {
190
                    if (itemMap.get(getKey(itemStack)) != null) {
191
192
                        int price = getPrice(itemStack);
193
194
                        if (itemStack.getCount() > 1)
195
                            price /= itemStack.getCount();
196
197
                        result.add(new AucItem(itemStack.getItem(), price, itemMap.get(getKey(itemStack)), slot));
198
                    }
199
                    slot++;
200
                }
201
            }
202
        }
203
    }
204
205
    private boolean canSendCommand() {
206
        if (pvpTimer.passedMs(30000)) {
207
            pvpTimer.reset();
208
            return true;
209
        }
210
        return false;
211
    }
212
213
    public boolean check(String checkstring) {
214
        return checktimer.passedMs(3000) && (Objects.equals(ThunderUtility.solveName(checkstring), "FATAL ERROR"));
215
    }
216
217
    @EventHandler
218
    public void onPacketSend(PacketEvent.Send e) {
219
        if (e.getPacket() instanceof ServerboundChatCommandPacket)
220
            checktimer.reset();
221
    }
222
223
    @EventHandler
224
    private void onSync(EventSync event) {
225
        if (fullNullCheck()) return;
226
227
        if (isKeyPressed(desorient.getValue().getKey()) && disorientTimer.passedMs(3000) && mc.gui.screen() == null) {
228
            use(InventoryUtility.findInHotBar(i -> i.getItem() == Items.ENDER_EYE),
229
                    InventoryUtility.findInInventory(i -> i.getItem() == Items.ENDER_EYE));
230
            disorientTimer.reset();
231
        }
232
233
        if (isKeyPressed(trap.getValue().getKey()) && trapTimer.passedMs(3000) && mc.gui.screen() == null) {
234
            use(InventoryUtility.findInHotBar(i -> i.getItem() == Items.NETHERITE_SCRAP),
235
                    InventoryUtility.findInInventory(i -> i.getItem() == Items.NETHERITE_SCRAP));
236
            trapTimer.reset();
237
        }
238
    }
239
240
    private String getKey(ItemStack stack) {
241
        if (groupBy.is(GroupBy.Name)) {
242
            return stack.getHoverName().getString();
243
        } else {
244
            return stack.getItem().getDescriptionId();
245
        }
246
    }
247
248
    public void onRenderChest(GuiGraphicsExtractor context, Slot slot) {
249
        if (mc.player.containerMenu instanceof ChestMenu chest)
250
            if (mc.gui.screen().getTitle().getString().contains("Аукцион") || mc.gui.screen().getTitle().getString().contains("Поиск"))
251
                for (AucItem item : result)
252
                    if (item.id == slot.index && slot.index <= 44 && !slot.getItem().isEmpty()) {
253
                        float ratio = (float) (Math.pow(item.lowestPrice, contrast.getValue()) / Math.pow(item.price, contrast.getValue()));
254
255
                        Render2DEngine.drawRect(context.pose(), slot.x, slot.y,
256
                                16, 16, Render2DEngine.interpolateColorC(new Color(0xFF000000, true), new Color(0x00FF00), ratio));
257
                        return;
258
                    }
259
    }
260
261
    public int getPrice(ItemStack stack) {
262
        if (stack.getComponents().toString() == null) return 999999999;
263
264
        String string2 = StringUtils.substringBetween(stack.getComponents().toString(), "\"text\":\" $", "\"}]");
265
266
        if (string2 == null) return 999999999;
267
268
        string2 = string2.replaceAll(" ", "");
269
270
        int price = 999999999;
271
272
        try {
273
            price = Integer.parseInt(string2);
274
        } catch (NumberFormatException ignored) {
275
        }
276
277
        return price;
278
    }
279
280
    private void use(SearchInvResult result, SearchInvResult invResult) {
281
        if (result.found()) {
282
            InventoryUtility.saveAndSwitchTo(result.slot());
283
            sendSequencedPacket(id -> new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, id, mc.player.getYRot(), mc.player.getXRot()));
284
            InventoryUtility.returnSlot();
285
        } else if (invResult.found()) {
286
            clickSlot(invResult.slot(), mc.player.getInventory().getSelectedSlot(), ContainerInput.SWAP);
287
            sendSequencedPacket(id -> new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, id, mc.player.getYRot(), mc.player.getXRot()));
288
            clickSlot(invResult.slot(), mc.player.getInventory().getSelectedSlot(), ContainerInput.SWAP);
289
            sendPacket(new ServerboundContainerClosePacket(mc.player.containerMenu.containerId));
290
        }
291
        disorientTimer.reset();
292
    }
293
294
    private record AucItem(Item item, int price, int lowestPrice, int id) {
295
    }
296
}
297