StashLogger module

StashLogger: 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/StashLogger.javaJava · 82 lines · 3.3 KB
SettingsSoundSaveToFileMinChestsMinShulkers
StashLogger.javaJava · Minecraft 26.2 · 82 lines · 3.3 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.misc;
2
3
import thunder.hack.core.Managers;
4
import thunder.hack.core.manager.client.ConfigManager;
5
import thunder.hack.gui.notification.Notification;
6
import thunder.hack.features.modules.Module;
7
import thunder.hack.features.modules.render.StorageEsp;
8
import thunder.hack.setting.Setting;
9
10
import java.io.BufferedWriter;
11
import java.io.File;
12
import java.io.FileWriter;
13
import java.util.ArrayList;
14
import java.util.List;
15
import net.minecraft.sounds.SoundEvents;
16
import net.minecraft.sounds.SoundSource;
17
import net.minecraft.world.level.block.entity.BlockEntity;
18
import net.minecraft.world.level.block.entity.ChestBlockEntity;
19
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
20
import net.minecraft.world.level.chunk.LevelChunk;
21
22
public class StashLogger extends Module {
23
    private final Setting<Boolean> sound = new Setting<>("Sound", true);
24
    private final Setting<Boolean> saveToFile = new Setting<>("SaveToFile", true);
25
    private final Setting<Integer> minChests = new Setting<>("MinChests", 5, 0, 100);
26
    private final Setting<Integer> minShulkers = new Setting<>("MinShulkers", 0, 0, 100);
27
28
    private List<LevelChunk> savedChunks = new ArrayList<>();
29
30
    public StashLogger() {
31
        super("StashLogger", Category.MISC);
32
    }
33
34
    @Override
35
    public void onEnable() {
36
        savedChunks.clear();
37
    }
38
39
    @Override
40
    public void onUpdate() {
41
        for (LevelChunk chunk : StorageEsp.getLoadedChunks()) {
42
            if (savedChunks.contains(chunk))
43
                continue;
44
45
            List<BlockEntity> storages = chunk.getBlockEntities().values().stream().toList();
46
47
            int chests = 0;
48
            int shulkers = 0;
49
50
            for (BlockEntity storage : storages) {
51
                if (storage instanceof ChestBlockEntity)
52
                    chests++;
53
                if (storage instanceof ShulkerBoxBlockEntity)
54
                    shulkers++;
55
            }
56
57
            if (chests >= minChests.getValue() && shulkers >= minShulkers.getValue()) {
58
                savedChunks.add(chunk);
59
60
                String str = "Stash pos: X:" + chunk.getPos().getMiddleBlockX() + " Z:" + chunk.getPos().getMiddleBlockZ() + " Chests: " + chests + " Shulkers: " + shulkers;
61
                Managers.NOTIFICATION.publicity("StashLogger", str, 5, Notification.Type.SUCCESS);
62
                sendMessage(str);
63
64
                if (sound.getValue())
65
                    mc.level.playSound(mc.player, mc.player.blockPosition(), SoundEvents.PLAYER_LEVELUP, SoundSource.BLOCKS, 1f, 1f);
66
67
                String serverIP = "unknown_server";
68
                if (mc.getConnection().getServerData() != null && mc.getConnection().getServerData().ip != null)
69
                    serverIP = mc.getConnection().getServerData().ip.replace(':', '_');
70
71
                if (saveToFile.getValue())
72
                    try {
73
                        BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigManager.STASHLOGGER_FOLDER, serverIP + ".txt"), true));
74
                        writer.append("\nStash pos: X:" + chunk.getPos().getMiddleBlockX() + " Z:" + chunk.getPos().getMiddleBlockZ() + " Chests: " + chests + " Shulkers: " + shulkers);
75
                        writer.close();
76
                    } catch (Exception e) {
77
                    }
78
            }
79
        }
80
    }
81
}
82