Михаил

make me a fabric 1.21.11 mod that if you do a command /spawnbot you can set itz nickname and skin and then totem amount, example /spawnbot Marlowww 14 will spawn a fake player with marlow skin and nickname that will have 14 totems and gonna use them for example 1totem poped he will instantly take another, the bot should spawn in neth helmet undeaking 3 prot 4, same for chestplate and boots, the leggings are neth but with blast prot 4 and unbreaking 3. also like with 4 or 15 second interval a bot will fast look at you and throw a pearl and if u like dont pop the bot for like 0.4 to 1 seconds he starts like slowly walking to you not looking at you but if you pop him again he will comniue being afk, also make it so it randomly swings but doesnot damage you so this bot is just made for fake clips and everything

Kodari AI
KodariOct 20 at 7:30 am 3
FakePlayerSpawner
Creates a Fabric 1.21.11 mod that spawns a fake player via /spawnbot command with custom nickname and totem count. The bot wears enchanted netherite armor, uses totems instantly when popped, periodically looks at the player and throws pearls, walks slowly when not attacked, and performs non-damaging random swings for fake clip creation.
  1. Set up the Fabric 1.21.11 project structure and command registration.

  2. Implement a named, skinned bot with configurable totems and armor.

  3. Add pearl throws, idle swings, and the conditional approach behavior.

Created the Fabric 1.21.11 mod. Use /spawnbot Marlowww 14 to spawn a fake player using that username’s skin and nickname, with 14 totems and the requested netherite armor.

The bot automatically replaces each popped totem, occasionally looks at you to throw an ender pearl, and swings without attacking. After 0.4–1 second without a pop, it slowly approaches; another pop resets it to idle. If the skin profile can’t be resolved, it uses the default skin.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 287
src/main/java/com/kodari/clipbot/ClipBotMod.java
package com.kodari.clipbot;

import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.FakePlayer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.command.argument.EntityAnchorArgumentType;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.projectile.thrown.EnderPearlEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.Vec3d;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

public class ClipBotMod implements ModInitializer {
    private static final Map<UUID, BotState> BOTS = new HashMap<>();

    @Override
    public void onInitialize() {
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(
                CommandManager.literal("spawnbot")
                        .then(CommandManager.argument("nickname", StringArgumentType.word())
                                .then(CommandManager.argument("totems", IntegerArgumentType.integer(0))
                                        .executes(context -> {
                                            String nickname = StringArgumentType.getString(context, "nickname");
                                            int totems = IntegerArgumentType.getInteger(context, "totems");
                                            ServerCommandSource source = context.getSource();
                                            ServerPlayerEntity owner = source.getPlayerOrThrow();
                                            ServerWorld world = source.getWorld();
                                            MinecraftServer server = source.getServer();

                                            Optional<GameProfile> profile = Optional.empty();
                                            java.util.concurrent.CompletableFuture
                                                    .supplyAsync(
                                                            () -> server.getApiServices().profileResolver().getProfileByName(nickname),
                                                            Util.getDownloadWorkerExecutor()
                                                    )
                                                    .handle((resolved, error) -> error == null ? resolved : profile)
                                                    .thenAccept(resolved -> server.execute(() -> {
                                                        if (!owner.isAlive() || owner.getEntityWorld() != world) {
                                                            return;
                                                        }

                                                        GameProfile botProfile = resolved
                                                                .map(original -> new GameProfile(UUID.randomUUID(), nickname, original.properties()))
                                                                .orElseGet(() -> new GameProfile(UUID.randomUUID(), nickname));
                                                        spawnBot(server, world, owner, botProfile, totems);
                                                    }));
                                            return 1;
                                        }))
                        )
        ));

        ServerTickEvents.END_WORLD_TICK.register(ClipBotMod::tickWorld);
    }

    private static void spawnBot(MinecraftServer server, ServerWorld world, ServerPlayerEntity owner, GameProfile profile, int totems) {
        FakePlayer bot = FakePlayer.get(world, profile);
        bot.setPosition(owner.getX() + 1.25, owner.getY(), owner.getZ());
        bot.setYaw(owner.getYaw());
        bot.setPitch(0.0F);

        RegistryEntry<Enchantment> protection = world.getRegistryManager().getEntryOrThrow(Enchantments.PROTECTION);
        RegistryEntry<Enchantment> blastProtection = world.getRegistryManager().getEntryOrThrow(Enchantments.BLAST_PROTECTION);
        RegistryEntry<Enchantment> unbreaking = world.getRegistryManager().getEntryOrThrow(Enchantments.UNBREAKING);
        equip(bot, EquipmentSlot.HEAD, Items.NETHERITE_HELMET, protection, unbreaking);
        equip(bot, EquipmentSlot.CHEST, Items.NETHERITE_CHESTPLATE, protection, unbreaking);
        equip(bot, EquipmentSlot.LEGS, Items.NETHERITE_LEGGINGS, blastProtection, unbreaking);
        equip(bot, EquipmentSlot.FEET, Items.NETHERITE_BOOTS, protection, unbreaking);

        if (totems > 0) {
            bot.getInventory().setStack(PlayerInventory.OFF_HAND_SLOT, new ItemStack(Items.TOTEM_OF_UNDYING));
        }

        server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, bot));
        world.onPlayerConnected(bot);

        BotState state = new BotState(server, world, owner, bot, totems);
        BOTS.put(profile.id(), state);
    }

    private static void equip(FakePlayer bot, EquipmentSlot slot, Item item, RegistryEntry<Enchantment> primary, RegistryEntry<Enchantment> unbreaking) {
        ItemStack stack = new ItemStack(item);
        stack.addEnchantment(primary, 4);
        stack.addEnchantment(unbreaking, 3);
        bot.equipStack(slot, stack);
    }

    private static void tickWorld(ServerWorld world) {
        Iterator<BotState> iterator = BOTS.values().iterator();
        while (iterator.hasNext()) {
            BotState state = iterator.next();
            if (state.world != world) {
                continue;
            }

            if (state.bot.isRemoved() || !state.bot.isAlive() || !state.owner.isAlive() || state.owner.getEntityWorld() != world) {
                removeBot(state);
                iterator.remove();
                continue;
            }

            ItemStack offhand = state.bot.getInventory().getStack(PlayerInventory.OFF_HAND_SLOT);
            if (offhand.isEmpty() && state.totemsRemaining > 0) {
                state.totemsRemaining--;
                state.approaching = false;
                state.approachDelay = randomBetween(8, 21);
                state.bot.setVelocity(0.0, 0.0, 0.0);
                if (state.totemsRemaining > 0) {
                    state.bot.getInventory().setStack(PlayerInventory.OFF_HAND_SLOT, new ItemStack(Items.TOTEM_OF_UNDYING));
                }
            }

            if (--state.swingCooldown <= 0) {
                state.bot.swingHand(Hand.MAIN_HAND);
                state.swingCooldown = randomBetween(25, 101);
            }

            if (--state.pearlCooldown <= 0) {
                if (!state.approaching) {
                    state.bot.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, state.owner.getEyePos());
                    EnderPearlEntity pearl = new EnderPearlEntity(world, state.bot, new ItemStack(Items.ENDER_PEARL));
                    pearl.setVelocity(state.bot, state.bot.getPitch(), state.bot.getYaw(), 0.0F, 1.5F, 0.0F);
                    world.spawnEntity(pearl);
                }
                state.pearlCooldown = randomBetween(80, 301);
            }

            if (state.approachDelay > 0) {
                state.approachDelay--;
            } else if (!state.approaching) {
                state.approaching = true;
                state.bot.setYaw(state.bot.getYaw() + ThreadLocalRandom.current().nextFloat(90.0F, 271.0F));
            }

            if (state.approaching) {
                double dx = state.owner.getX() - state.bot.getX();
                double dz = state.owner.getZ() - state.bot.getZ();
                double distance = Math.sqrt(dx * dx + dz * dz);
                if (distance > 1.5) {
                    state.bot.move(MovementType.SELF, new Vec3d(dx / distance * 0.025, 0.0, dz / distance * 0.025));
                }
            }
        }
    }

    private static void removeBot(BotState state) {
        state.server.getPlayerManager().sendToAll(new PlayerRemoveS2CPacket(List.of(state.bot.getGameProfile().id())));
        state.bot.discard();
    }

    private static int randomBetween(int minimumInclusive, int maximumExclusive) {
        return ThreadLocalRandom.current().nextInt(minimumInclusive, maximumExclusive);
    }

    private static final class BotState {
        private final MinecraftServer server;
        private final ServerWorld world;
        private final ServerPlayerEntity owner;
        private final FakePlayer bot;
        private int totemsRemaining;
        private int pearlCooldown = randomBetween(80, 301);
        private int swingCooldown = randomBetween(25, 101);
        private int approachDelay = randomBetween(8, 21);
        private boolean approaching;

        private BotState(MinecraftServer server, ServerWorld world, ServerPlayerEntity owner, FakePlayer bot, int totemsRemaining) {
            this.server = server;
            this.world = world;
            this.owner = owner;
            this.bot = bot;
            this.totemsRemaining = totemsRemaining;
        }
    }
}