auto-exp module

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

1 implementationCombat

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 ClientCombatsrc/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoEXP.javaJava · 153 lines · 5.4 KB

Automatically repairs your armor and tools in pvp.

Settingsmodereplenishonly-on-groundexp-slotmin-thresholdmax-threshold
AutoEXP.javaJava · Minecraft 26.2 · 153 lines · 5.4 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.combat;
7
8
import meteordevelopment.meteorclient.events.world.TickEvent;
9
import meteordevelopment.meteorclient.settings.*;
10
import meteordevelopment.meteorclient.systems.modules.Categories;
11
import meteordevelopment.meteorclient.systems.modules.Module;
12
import meteordevelopment.meteorclient.utils.Utils;
13
import meteordevelopment.meteorclient.utils.player.FindItemResult;
14
import meteordevelopment.meteorclient.utils.player.InvUtils;
15
import meteordevelopment.meteorclient.utils.player.Rotations;
16
import meteordevelopment.meteorclient.utils.player.SlotUtils;
17
import meteordevelopment.orbit.EventHandler;
18
import net.minecraft.world.InteractionHand;
19
import net.minecraft.world.entity.EquipmentSlot;
20
import net.minecraft.world.entity.EquipmentSlotGroup;
21
import net.minecraft.world.item.ItemStack;
22
import net.minecraft.world.item.Items;
23
import net.minecraft.world.item.enchantment.Enchantments;
24
25
public class AutoEXP extends Module {
26
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
27
28
    private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
29
        .name("mode")
30
        .description("Which items to repair.")
31
        .defaultValue(Mode.Both)
32
        .build()
33
    );
34
35
    private final Setting<Boolean> replenish = sgGeneral.add(new BoolSetting.Builder()
36
        .name("replenish")
37
        .description("Automatically replenishes exp into a selected hotbar slot.")
38
        .defaultValue(true)
39
        .build()
40
    );
41
42
    private final Setting<Boolean> onlyGround = sgGeneral.add(new BoolSetting.Builder()
43
        .name("only-on-ground")
44
        .description("Only throw when the player is on the ground.")
45
        .defaultValue(false)
46
        .build()
47
    );
48
49
    private final Setting<Integer> slot = sgGeneral.add(new IntSetting.Builder()
50
        .name("exp-slot")
51
        .description("The slot to replenish exp into.")
52
        .visible(replenish::get)
53
        .defaultValue(6)
54
        .range(1, 9)
55
        .sliderRange(1, 9)
56
        .build()
57
    );
58
59
    private final Setting<Integer> minThreshold = sgGeneral.add(new IntSetting.Builder()
60
        .name("min-threshold")
61
        .description("The minimum durability percentage that an item needs to fall to, to be repaired.")
62
        .defaultValue(30)
63
        .range(1, 100)
64
        .sliderRange(1, 100)
65
        .build()
66
    );
67
68
    private final Setting<Integer> maxThreshold = sgGeneral.add(new IntSetting.Builder()
69
        .name("max-threshold")
70
        .description("The maximum durability percentage to repair items to.")
71
        .defaultValue(80)
72
        .range(1, 100)
73
        .sliderRange(1, 100)
74
        .build()
75
    );
76
77
    private int repairingI;
78
79
    public AutoEXP() {
80
        super(Categories.Combat, "auto-exp", "Automatically repairs your armor and tools in pvp.");
81
    }
82
83
    @Override
84
    public void onActivate() {
85
        repairingI = -1;
86
    }
87
88
    @EventHandler
89
    private void onTick(TickEvent.Pre event) {
90
        if (onlyGround.get() && !mc.player.onGround()) {
91
            return;
92
        }
93
94
        if (repairingI == -1) {
95
            if (mode.get() != Mode.Hands) {
96
                for (EquipmentSlot slot : EquipmentSlotGroup.ARMOR) {
97
                    ItemStack stack = mc.player.getItemBySlot(slot);
98
                    if (needsRepair(stack, minThreshold.get())) {
99
                        repairingI = SlotUtils.ARMOR_START + slot.getIndex();
100
                        break;
101
                    }
102
                }
103
            }
104
105
            if (mode.get() != Mode.Armor && repairingI == -1) {
106
                for (InteractionHand hand : InteractionHand.values()) {
107
                    if (needsRepair(mc.player.getItemInHand(hand), minThreshold.get())) {
108
                        repairingI = hand == InteractionHand.MAIN_HAND ? mc.player.getInventory().getSelectedSlot() : SlotUtils.OFFHAND;
109
                        break;
110
                    }
111
                }
112
            }
113
        }
114
115
        if (repairingI != -1) {
116
            if (!needsRepair(mc.player.getInventory().getItem(repairingI), maxThreshold.get())) {
117
                repairingI = -1;
118
                return;
119
            }
120
121
            FindItemResult exp = InvUtils.find(Items.EXPERIENCE_BOTTLE);
122
123
            if (exp.found()) {
124
                if (!exp.isHotbar() && !exp.isOffhand()) {
125
                    if (!replenish.get()) return;
126
                    InvUtils.move().from(exp.slot()).toHotbar(slot.get() - 1);
127
                }
128
129
                Rotations.rotate(mc.player.getYRot(), 90, () -> {
130
                    if (exp.getHand() != null) {
131
                        mc.gameMode.useItem(mc.player, exp.getHand());
132
                    } else {
133
                        InvUtils.swap(exp.slot(), true);
134
                        mc.gameMode.useItem(mc.player, InteractionHand.MAIN_HAND);
135
                        InvUtils.swapBack();
136
                    }
137
                });
138
            }
139
        }
140
    }
141
142
    private boolean needsRepair(ItemStack itemStack, double threshold) {
143
        if (itemStack.isEmpty() || !Utils.hasEnchantments(itemStack, Enchantments.MENDING)) return false;
144
        return (itemStack.getMaxDamage() - itemStack.getDamageValue()) / (double) itemStack.getMaxDamage() * 100 <= threshold;
145
    }
146
147
    public enum Mode {
148
        Armor,
149
        Hands,
150
        Both
151
    }
152
}
153