hitboxes module

hitboxes: Minecraft 26.3 cheat module, full source for every implementation (3 clients: Meteor Client, MelaHack (ThunderHack fork), OfflineClient).

3 implementationsCombatCOMBAT

Full module source: 3 implementations

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/Hitboxes.javaJava · 145 lines · 5.1 KB

Expands an entity's hitboxes.

Settingsentitiesexpandignore-friendsonly-on-weaponswordaxepickaxeshovelhoemacespeartrident
Hitboxes.javaJava · Minecraft 26.2 · 145 lines · 5.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.combat;
7
8
import meteordevelopment.meteorclient.settings.*;
9
import meteordevelopment.meteorclient.systems.friends.Friends;
10
import meteordevelopment.meteorclient.systems.modules.Categories;
11
import meteordevelopment.meteorclient.systems.modules.Module;
12
import meteordevelopment.meteorclient.utils.player.InvUtils;
13
import net.minecraft.tags.ItemTags;
14
import net.minecraft.world.entity.Entity;
15
import net.minecraft.world.entity.EntityType;
16
import net.minecraft.world.entity.EntityTypes;
17
import net.minecraft.world.entity.player.Player;
18
import net.minecraft.world.item.MaceItem;
19
import net.minecraft.world.item.TridentItem;
20
21
import java.util.Set;
22
23
public class Hitboxes extends Module {
24
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
25
    private final SettingGroup sgWeapon = settings.createGroup("Weapon Options");
26
27
    private final Setting<Set<EntityType<?>>> entities = sgGeneral.add(new EntityTypeListSetting.Builder()
28
        .name("entities")
29
        .description("Which entities to target.")
30
        .defaultValue(EntityTypes.PLAYER)
31
        .build()
32
    );
33
34
    private final Setting<Double> value = sgGeneral.add(new DoubleSetting.Builder()
35
        .name("expand")
36
        .description("How much to expand the hitbox of the entity.")
37
        .defaultValue(0.5)
38
        .build()
39
    );
40
41
    private final Setting<Boolean> ignoreFriends = sgGeneral.add(new BoolSetting.Builder()
42
        .name("ignore-friends")
43
        .description("Doesn't expand the hitboxes of friends.")
44
        .defaultValue(true)
45
        .build()
46
    );
47
48
    private final Setting<Boolean> onlyOnWeapon = sgWeapon.add(new BoolSetting.Builder()
49
        .name("only-on-weapon")
50
        .description("Only modifies hitbox when holding a weapon in hand.")
51
        .defaultValue(false)
52
        .build()
53
    );
54
55
    private final Setting<Boolean> sword = sgWeapon.add(new BoolSetting.Builder()
56
        .name("sword")
57
        .description("Enable when holding a sword.")
58
        .defaultValue(true)
59
        .visible(onlyOnWeapon::get)
60
        .build()
61
    );
62
63
    private final Setting<Boolean> axe = sgWeapon.add(new BoolSetting.Builder()
64
        .name("axe")
65
        .description("Enable when holding an axe.")
66
        .defaultValue(true)
67
        .visible(onlyOnWeapon::get)
68
        .build()
69
    );
70
71
    private final Setting<Boolean> pickaxe = sgWeapon.add(new BoolSetting.Builder()
72
        .name("pickaxe")
73
        .description("Enable when holding a pickaxe.")
74
        .defaultValue(true)
75
        .visible(onlyOnWeapon::get)
76
        .build()
77
    );
78
79
    private final Setting<Boolean> shovel = sgWeapon.add(new BoolSetting.Builder()
80
        .name("shovel")
81
        .description("Enable when holding a shovel.")
82
        .defaultValue(true)
83
        .visible(onlyOnWeapon::get)
84
        .build()
85
    );
86
87
    private final Setting<Boolean> hoe = sgWeapon.add(new BoolSetting.Builder()
88
        .name("hoe")
89
        .description("Enable when holding a hoe.")
90
        .defaultValue(true)
91
        .visible(onlyOnWeapon::get)
92
        .build()
93
    );
94
95
    private final Setting<Boolean> mace = sgWeapon.add(new BoolSetting.Builder()
96
        .name("mace")
97
        .description("Enable when holding a mace.")
98
        .defaultValue(true)
99
        .visible(onlyOnWeapon::get)
100
        .build()
101
    );
102
103
    private final Setting<Boolean> spear = sgWeapon.add(new BoolSetting.Builder()
104
        .name("spear")
105
        .description("Enable when holding a spear.")
106
        .defaultValue(true)
107
        .visible(onlyOnWeapon::get)
108
        .build()
109
    );
110
111
    private final Setting<Boolean> trident = sgWeapon.add(new BoolSetting.Builder()
112
        .name("trident")
113
        .description("Enable when holding a trident.")
114
        .defaultValue(true)
115
        .visible(onlyOnWeapon::get)
116
        .build()
117
    );
118
119
    public Hitboxes() {
120
        super(Categories.Combat, "hitboxes", "Expands an entity's hitboxes.");
121
    }
122
123
    public double getEntityValue(Entity entity) {
124
        if (!(isActive() && testWeapon()) || (ignoreFriends.get() && entity instanceof Player playerEntity && Friends.get().isFriend(playerEntity)))
125
            return 0;
126
        if (entities.get().contains(entity.getType())) return value.get();
127
        return 0;
128
    }
129
130
    private boolean testWeapon() {
131
        if (!onlyOnWeapon.get()) return true;
132
        return InvUtils.testInMainHand(itemStack -> {
133
            if (sword.get() && itemStack.is(ItemTags.SWORDS)) return true;
134
            if (axe.get() && itemStack.is(ItemTags.AXES)) return true;
135
            if (pickaxe.get() && itemStack.is(ItemTags.PICKAXES)) return true;
136
            if (shovel.get() && itemStack.is(ItemTags.SHOVELS)) return true;
137
            if (hoe.get() && itemStack.is(ItemTags.HOES)) return true;
138
            if (mace.get() && itemStack.getItem() instanceof MaceItem) return true;
139
            if (spear.get() && itemStack.is(ItemTags.SPEARS)) return true;
140
            if (trident.get() && itemStack.getItem() instanceof TridentItem) return true;
141
            return false;
142
        });
143
    }
144
}
145
MelaHack (ThunderHack fork)COMBATsrc/main/java/thunder/hack/features/modules/combat/HitBox.javaJava · 22 lines · 748 B

Allows you to increase the hitboxes of entities.

SettingsXZExpandYExpandAffectToAura
HitBox.javaJava · Minecraft 26.2 · 22 lines · 748 B · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.combat;
2
3
import thunder.hack.features.modules.Module;
4
import thunder.hack.setting.Setting;
5
6
import static thunder.hack.core.manager.client.ServerManager.round2;
7
8
public final class HitBox extends Module {
9
    public HitBox() {
10
        super("HitBoxes", Category.COMBAT);
11
    }
12
13
    public static final Setting<Float> XZExpand = new Setting<>("XZExpand", 1.0f, 0.0f, 5.0f);
14
    public static final Setting<Float> YExpand = new Setting<>("YExpand", 0.0f, 0.0f, 5.0f);
15
    public static final Setting<Boolean> affectToAura = new Setting<>("AffectToAura", false);
16
17
    @Override
18
    public String getDisplayInfo() {
19
        return "H: " + round2(XZExpand.getValue()) + " V: " + round2(YExpand.getValue());
20
    }
21
}
22
OfflineClientCOMBATsrc/main/java/com/jellypudding/offlineclient/modules/combat/Hitboxes.javaJava · 110 lines · 4.3 KB

Makes entities easier to hit by growing their hitboxes.

SettingsExpandEntitiesIgnore friendsOnly with weapon
Hitboxes.javaJava · Minecraft 26.2 · 110 lines · 4.3 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.combat;
2
3
import com.jellypudding.offlineclient.module.Category;
4
import com.jellypudding.offlineclient.module.Module;
5
import com.jellypudding.offlineclient.setting.BoolSetting;
6
import com.jellypudding.offlineclient.setting.EnumSetting;
7
import com.jellypudding.offlineclient.setting.NumberSetting;
8
import com.jellypudding.offlineclient.setting.RegistryListSetting;
9
import com.jellypudding.offlineclient.util.EntityUtil;
10
import net.minecraft.core.registries.BuiltInRegistries;
11
import net.minecraft.tags.ItemTags;
12
import net.minecraft.world.entity.Entity;
13
import net.minecraft.world.entity.EntityType;
14
import net.minecraft.world.entity.EntityTypes;
15
import net.minecraft.world.item.ItemStack;
16
import net.minecraft.world.item.MaceItem;
17
import net.minecraft.world.item.TridentItem;
18
19
import java.util.EnumMap;
20
import java.util.List;
21
import java.util.Locale;
22
import java.util.Map;
23
import java.util.function.Predicate;
24
25
// Melee swings apply one margin to every entity regardless of the kinds list.
26
// Arrows instead read the pick radius of the entity kinds the list names.
27
public final class Hitboxes extends Module {
28
29
    private enum Weapon {
30
        SWORD(stack -> stack.is(ItemTags.SWORDS)),
31
        AXE(stack -> stack.is(ItemTags.AXES)),
32
        PICKAXE(stack -> stack.is(ItemTags.PICKAXES)),
33
        SHOVEL(stack -> stack.is(ItemTags.SHOVELS)),
34
        HOE(stack -> stack.is(ItemTags.HOES)),
35
        MACE(stack -> stack.getItem() instanceof MaceItem),
36
        SPEAR(stack -> stack.is(ItemTags.SPEARS)),
37
        TRIDENT(stack -> stack.getItem() instanceof TridentItem);
38
39
        private final Predicate<ItemStack> matches;
40
41
        Weapon(Predicate<ItemStack> matches) {
42
            this.matches = matches;
43
        }
44
    }
45
46
    private final NumberSetting expand = new NumberSetting("Expand",
47
        "How far the hitbox grows on every side.", 0.25, 0.05, 1, 0.05, " blocks")
48
        .min(0).max(2);
49
    private final RegistryListSetting<EntityType<?>> entities = new RegistryListSetting<>(
50
        "Entities", "Kinds of entity to grow. Arrows only take the bigger box on these kinds.",
51
        BuiltInRegistries.ENTITY_TYPE, List.of(EntityTypes.PLAYER));
52
    private final BoolSetting ignoreFriends = new BoolSetting("Ignore friends",
53
        "Leaves the hitboxes of friends alone.", true);
54
    private final BoolSetting onlyWithWeapon = new BoolSetting("Only with weapon",
55
        "Only grows hitboxes whilst one of the ticked weapons is in your main hand.", false);
56
    private final Map<Weapon, BoolSetting> weapons = new EnumMap<>(Weapon.class);
57
58
    public Hitboxes() {
59
        super("Hitboxes", "Makes entities easier to hit by growing their hitboxes.", Category.COMBAT);
60
        addSettings(expand, entities, ignoreFriends, onlyWithWeapon);
61
        for (Weapon weapon : Weapon.values()) {
62
            String label = EnumSetting.label(weapon);
63
            String article = weapon == Weapon.AXE ? "an " : "a ";
64
            BoolSetting setting = new BoolSetting(label,
65
                "Counts " + article + label.toLowerCase(Locale.ROOT) + " as a weapon.", true)
66
                .under(onlyWithWeapon);
67
            weapons.put(weapon, setting);
68
            addSettings(setting);
69
        }
70
        searchTags("aim", "reach", "pick");
71
    }
72
73
    @Override
74
    public String getSuffix() {
75
        return expand.getValueString();
76
    }
77
78
    // Extra pick radius for one entity. Zero keeps it vanilla.
79
    public double expansionFor(Entity entity) {
80
        if (!isEnabled() || entity == mc.player || !holdingWeapon()) {
81
            return 0;
82
        }
83
        if (ignoreFriends.isOn() && EntityUtil.isFriend(entity)) {
84
            return 0;
85
        }
86
        return entities.contains(entity.getType()) ? expand.getValue() : 0;
87
    }
88
89
    // Extra margin for the attack range check.
90
    public float margin() {
91
        if (!isEnabled() || entities.resolved().isEmpty() || !holdingWeapon()) {
92
            return 0;
93
        }
94
        return expand.getFloat();
95
    }
96
97
    private boolean holdingWeapon() {
98
        if (!onlyWithWeapon.isOn() || mc.player == null) {
99
            return true;
100
        }
101
        ItemStack held = mc.player.getMainHandItem();
102
        for (Weapon weapon : Weapon.values()) {
103
            if (weapons.get(weapon).isOn() && weapon.matches.test(held)) {
104
                return true;
105
            }
106
        }
107
        return false;
108
    }
109
}
110