auto-breed module

auto-breed: 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/AutoBreed.javaJava · 122 lines · 4.8 KB

Automatically breeds specified animals.

Settingsentitiesrangehand-for-breedingmob-age-filtercontinuous-breedingbreeding-interval
AutoBreed.javaJava · Minecraft 26.2 · 122 lines · 4.8 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.*;
10
import meteordevelopment.meteorclient.systems.modules.Categories;
11
import meteordevelopment.meteorclient.systems.modules.Module;
12
import meteordevelopment.meteorclient.utils.entity.EntityAgeTest;
13
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
14
import meteordevelopment.meteorclient.utils.player.Rotations;
15
import meteordevelopment.orbit.EventHandler;
16
import net.minecraft.world.InteractionHand;
17
import net.minecraft.world.entity.Entity;
18
import net.minecraft.world.entity.EntityType;
19
import net.minecraft.world.entity.EntityTypes;
20
import net.minecraft.world.entity.animal.Animal;
21
import net.minecraft.world.phys.EntityHitResult;
22
23
import java.util.LinkedHashMap;
24
import java.util.Set;
25
26
public class AutoBreed extends Module {
27
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
28
29
    private final Setting<Set<EntityType<?>>> entities = sgGeneral.add(new EntityTypeListSetting.Builder()
30
        .name("entities")
31
        .description("Entities to breed.")
32
        .defaultValue(EntityTypes.HORSE, EntityTypes.DONKEY, EntityTypes.COW,
33
            EntityTypes.MOOSHROOM, EntityTypes.SHEEP, EntityTypes.PIG, EntityTypes.CHICKEN, EntityTypes.WOLF,
34
            EntityTypes.CAT, EntityTypes.OCELOT, EntityTypes.RABBIT, EntityTypes.LLAMA, EntityTypes.TURTLE,
35
            EntityTypes.PANDA, EntityTypes.FOX, EntityTypes.BEE, EntityTypes.STRIDER, EntityTypes.HOGLIN)
36
        .onlyAttackable()
37
        .build()
38
    );
39
40
    private final Setting<Double> range = sgGeneral.add(new DoubleSetting.Builder()
41
        .name("range")
42
        .description("How far away the animals can be to be bred.")
43
        .min(0)
44
        .defaultValue(4.5)
45
        .build()
46
    );
47
48
    private final Setting<InteractionHand> hand = sgGeneral.add(new EnumSetting.Builder<InteractionHand>()
49
        .name("hand-for-breeding")
50
        .description("The hand to use for breeding.")
51
        .defaultValue(InteractionHand.MAIN_HAND)
52
        .build()
53
    );
54
55
    private final Setting<EntityAgeTest> mobAgeFilter = sgGeneral.add(new EnumSetting.Builder<EntityAgeTest>()
56
        .name("mob-age-filter")
57
        .description("Determines the age of the mobs to target (baby, adult, or both).")
58
        .defaultValue(EntityAgeTest.Adult)
59
        .build()
60
    );
61
62
    private final Setting<Boolean> continuousBreeding = sgGeneral.add(new BoolSetting.Builder()
63
        .name("continuous-breeding")
64
        .description("Whether to feed the same animal again after a certain time period.")
65
        .defaultValue(false)
66
        .build()
67
    );
68
69
    private final Setting<Integer> breedingInterval = sgGeneral.add(new IntSetting.Builder()
70
        .name("breeding-interval")
71
        .description("Determines how often the same animal is fed in ticks.")
72
        .min(1)
73
        .sliderMax(24000)
74
        .defaultValue(6600) // 30s in love mode and the 5-minute breeding cooldown
75
        .visible(continuousBreeding::get)
76
        .build()
77
    );
78
79
    private final LinkedHashMap<Entity, Integer> animalsFed = new LinkedHashMap<>();
80
    private int tickCounter = 0;
81
82
    public AutoBreed() {
83
        super(Categories.World, "auto-breed", "Automatically breeds specified animals.");
84
    }
85
86
    @Override
87
    public void onActivate() {
88
        animalsFed.clear();
89
        tickCounter = 0;
90
    }
91
92
    @EventHandler
93
    private void onTick(TickEvent.Pre event) {
94
        for (Entity entity : mc.level.entitiesForRendering()) {
95
            if (!(entity instanceof Animal animal)) continue;
96
97
            if (!entities.get().contains(animal.getType())
98
                || !mobAgeFilter.get().test(animal)
99
                || animalsFed.containsKey(animal)
100
                || !PlayerUtils.isWithin(animal, range.get())
101
                || !animal.isFood(hand.get() == InteractionHand.MAIN_HAND ? mc.player.getMainHandItem() : mc.player.getOffhandItem()))
102
                continue;
103
104
            Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, () -> {
105
                EntityHitResult location = new EntityHitResult(animal, animal.getBoundingBox().getCenter());
106
                mc.gameMode.interact(mc.player, animal, location, hand.get());
107
                mc.player.swing(hand.get());
108
                animalsFed.putLast(animal, tickCounter);
109
            });
110
            break;
111
        }
112
113
        if (continuousBreeding.get()) {
114
            while (!animalsFed.isEmpty() && animalsFed.firstEntry().getValue() < tickCounter - breedingInterval.get()) {
115
                animalsFed.pollFirstEntry();
116
            }
117
            tickCounter++;
118
        }
119
    }
120
121
}
122