auto-shearer module

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

1 implementationWorld

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 ClientWorldsrc/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.javaJava · 91 lines · 3.3 KB

Automatically shears sheep.

Settingsdistanceanti-breakrotate
AutoShearer.javaJava · Minecraft 26.2 · 91 lines · 3.3 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.world;
7
8
import meteordevelopment.meteorclient.events.world.TickEvent;
9
import meteordevelopment.meteorclient.settings.BoolSetting;
10
import meteordevelopment.meteorclient.settings.DoubleSetting;
11
import meteordevelopment.meteorclient.settings.Setting;
12
import meteordevelopment.meteorclient.settings.SettingGroup;
13
import meteordevelopment.meteorclient.systems.modules.Categories;
14
import meteordevelopment.meteorclient.systems.modules.Module;
15
import meteordevelopment.meteorclient.utils.player.FindItemResult;
16
import meteordevelopment.meteorclient.utils.player.InvUtils;
17
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
18
import meteordevelopment.meteorclient.utils.player.Rotations;
19
import meteordevelopment.orbit.EventHandler;
20
import net.minecraft.world.InteractionHand;
21
import net.minecraft.world.entity.Entity;
22
import net.minecraft.world.entity.animal.sheep.Sheep;
23
import net.minecraft.world.item.Items;
24
import net.minecraft.world.phys.EntityHitResult;
25
26
public class AutoShearer extends Module {
27
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
28
29
    private final Setting<Double> distance = sgGeneral.add(new DoubleSetting.Builder()
30
        .name("distance")
31
        .description("The maximum distance the sheep have to be to be sheared.")
32
        .min(0.0)
33
        .defaultValue(5.0)
34
        .build()
35
    );
36
37
    private final Setting<Boolean> antiBreak = sgGeneral.add(new BoolSetting.Builder()
38
        .name("anti-break")
39
        .description("Prevents shears from being broken.")
40
        .defaultValue(false)
41
        .build()
42
    );
43
44
    private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
45
        .name("rotate")
46
        .description("Automatically faces towards the animal being sheared.")
47
        .defaultValue(true)
48
        .build()
49
    );
50
51
    private Entity entity;
52
    private InteractionHand hand;
53
54
    public AutoShearer() {
55
        super(Categories.World, "auto-shearer", "Automatically shears sheep.");
56
    }
57
58
    @Override
59
    public void onDeactivate() {
60
        entity = null;
61
    }
62
63
    @EventHandler
64
    private void onTick(TickEvent.Pre event) {
65
        entity = null;
66
67
        for (Entity entity : mc.level.entitiesForRendering()) {
68
            if (!(entity instanceof Sheep sheep) || sheep.isSheared() || sheep.isBaby() || !PlayerUtils.isWithin(entity, distance.get()))
69
                continue;
70
71
            FindItemResult findShear = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.SHEARS && (!antiBreak.get() || itemStack.getDamageValue() < itemStack.getMaxDamage() - 1));
72
            if (!InvUtils.swap(findShear.slot(), true)) return;
73
74
            this.hand = findShear.getHand();
75
            this.entity = entity;
76
77
            if (rotate.get())
78
                Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, this::interact);
79
            else interact();
80
81
            return;
82
        }
83
    }
84
85
    private void interact() {
86
        EntityHitResult location = new EntityHitResult(entity, entity.getBoundingBox().getCenter());
87
        mc.gameMode.interact(mc.player, entity, location, hand);
88
        InvUtils.swapBack();
89
    }
90
}
91