Crow nash

Haz un mod de crystal aura inteligente, por ejemplo, que si detecta que el enemigo, como mob o jugador están arriba por un bloque, y cerca hay un agujero de un bloque que automáticamente lo spamee osea, un cristal aura inteligente, que si el jugador enemigo está arriba mío un ejemplo y hay obsidiana justo arriba mío que spame esa obsidiana que está ahí pero o sea que es paramé con cristales obviamente, evitando hacerse tanto tu daño a mi personaje con un autototem que sí o sí se equipe los tótems automáticamente, sin usar la mano, del inventario y hotbar, que el spam sea muy rápido y apenas detecte que el enemigo murió como bosty

Kodari AI
KodariTue at 3:03 am 4
CrystalAuraAI
An intelligent Crystal Aura mod for Minecraft Fabric that automatically detects enemy players or mobs positioned above the user, identifies nearby obsidian blocks, and rapidly spawns end crystals to damage targets while minimizing self-harm. Features an automatic totem system that equips totems from inventory and hotbar without requiring hand usage, ensuring survival during combat. The mod spams crystals at high speed upon detection and immediately stops when the enemy dies. Includes smart positioning logic to avoid self-damage by calculating safe crystal placement, and prioritizes targets based on proximity and threat level. Designed for competitive PvP scenarios with configurable activation range and crystal spam rate.
  • Activaré el aura con la tecla R y mantendré el autotótem independiente.

  • Buscaré bases cercanas al enemigo y limitaré el daño propio estimado antes de colocar o romper cristales.

Mod creado para Fabric 26.3.

  • R activa o desactiva el aura. Busca jugadores y mobs hostiles cercanos, coloca cristales sobre obsidiana o roca madre y los rompe; se detiene cuando no quedan objetivos vivos.

  • El autotótem funciona independientemente del aura y equipa tótems desde el inventario o la barra rápida.

  • El aura requiere cristales del End en la barra rápida. Usa una estimación conservadora del daño propio, aunque no garantiza evitarlo.

Para conseguir los cristales en supervivencia, fabrícalos con vidrio, un ojo de ender y una lágrima de ghast. Los tótems se obtienen al derrotar evocadores.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 268
src/client/java/com/kodari/crystalaura/CrystalAuraClient.java
package com.kodari.crystalaura;

import com.mojang.blaze3d.platform.InputConstants;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.ContainerInput;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ServerExplosion;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;

public final class CrystalAuraClient implements ClientModInitializer {
    private static final double REACH_SQUARED = 4.5 * 4.5;
    private static final double TARGET_RANGE_SQUARED = 8.0 * 8.0;
    private static final float MAX_SELF_DAMAGE = 6.0F;
    private static final KeyMapping TOGGLE = KeyMappingHelper.registerKeyMapping(
            new KeyMapping("key.crystal_aura.toggle", InputConstants.Type.KEYBOARD,
                    InputConstants.KEY_R, KeyMapping.Category.MISC));

    private boolean enabled;
    private int cooldown;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(this::tick);
    }

    private void tick(Minecraft client) {
        while (TOGGLE.consumeClick()) {
            enabled = !enabled;
        }
        LocalPlayer player = client.player;
        ClientLevel level = client.level;
        if (player == null || level == null || client.gameMode == null || !player.isAlive()) {
            cooldown = 0;
            return;
        }

        if (client.gui.screen() != null || player.containerMenu != player.inventoryMenu) {
            return;
        }
        equipTotem(client, player);
        if (!enabled || player.isSpectator()) {
            return;
        }
        if (cooldown > 0) {
            cooldown--;
            return;
        }

        LivingEntity target = findTarget(level, player);
        if (target == null) {
            return;
        }
        for (Entity entity : level.entitiesForRendering()) {
            if (entity instanceof EndCrystal crystal && crystal.isAlive()
                    && player.distanceToSqr(crystal) <= REACH_SQUARED) {
                Vec3 center = new Vec3(crystal.getX(), crystal.getY(), crystal.getZ());
                if (goodExplosion(center, player, target)) {
                    client.gameMode.attack(player, crystal);
                    cooldown = 2;
                    return;
                }
            }
        }

        int crystalSlot = findItem(player.getInventory(), Items.END_CRYSTAL, 9);
        if (crystalSlot < 0) {
            return;
        }
        BlockPos base = bestBase(level, player, target);
        if (base == null) {
            return;
        }
        int previousSlot = player.getInventory().getSelectedSlot();
        player.getInventory().setSelectedSlot(crystalSlot);
        Vec3 hit = new Vec3(base.getX() + 0.5, base.getY() + 1.0, base.getZ() + 0.5);
        client.gameMode.useItemOn(player, InteractionHand.MAIN_HAND,
                new BlockHitResult(hit, Direction.UP, base, false));
        player.getInventory().setSelectedSlot(previousSlot);
        cooldown = 2;
    }

    private static void equipTotem(Minecraft client, LocalPlayer player) {
        if (player.getOffhandItem().getItem() == Items.TOTEM_OF_UNDYING) {
            return;
        }
        int slot = findItem(player.getInventory(), Items.TOTEM_OF_UNDYING, 36);
        if (slot >= 0) {
            int menuSlot = slot < 9 ? slot + 36 : slot;
            client.gameMode.handleContainerInput(player.inventoryMenu.containerId, menuSlot,
                    Inventory.SLOT_OFFHAND, ContainerInput.SWAP, player);
        }
    }

    private static int findItem(Inventory inventory, net.minecraft.world.item.Item item, int end) {
        for (int i = 0; i < end; i++) {
            if (inventory.getItem(i).getItem() == item) {
                return i;
            }
        }
        return -1;
    }

    private static LivingEntity findTarget(ClientLevel level, LocalPlayer player) {
        LivingEntity best = null;
        double closest = TARGET_RANGE_SQUARED;
        for (Entity entity : level.entitiesForRendering()) {
            if (!(entity instanceof LivingEntity living) || entity == player || !living.isAlive()
                    || !(entity instanceof Player || entity instanceof Monster)
                    || player.isAlliedTo(entity)
                    || (entity instanceof Player other && other.isSpectator())) {
                continue;
            }
            double distance = player.distanceToSqr(entity);
            if (distance < closest) {
                closest = distance;
                best = living;
            }
        }
        return best;
    }

    private static BlockPos bestBase(ClientLevel level, LocalPlayer player, LivingEntity target) {
        BlockPos origin = target.blockPosition();
        BlockPos best = null;
        float bestScore = 0;
        for (int x = -3; x <= 3; x++) {
            for (int y = -2; y <= 2; y++) {
                for (int z = -3; z <= 3; z++) {
                    BlockPos base = origin.offset(x, y, z);
                    var block = level.getBlockState(base).getBlock();
                    if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK) {
                        continue;
                    }
                    Vec3 center = new Vec3(base.getX() + 0.5, base.getY() + 1.0, base.getZ() + 0.5);
                    if (player.distanceToSqr(center) > REACH_SQUARED || !level.isEmptyBlock(base.above())) {
                        continue;
                    }
                    AABB space = new AABB(base.getX(), base.getY() + 1, base.getZ(),
                            base.getX() + 1, base.getY() + 3, base.getZ() + 1);
                    if (!level.getEntities((Entity) null, space, entity -> true).isEmpty()
                            || !goodExplosion(center, player, target)) {
                        continue;
                    }
                    float score = damage(center, target) - damage(center, player);
                    if (score > bestScore) {
                        bestScore = score;
                        best = base;
                    }
                }
            }
        }
        return best;
    }

    private static boolean goodExplosion(Vec3 center, LocalPlayer player, LivingEntity target) {
        float self = damage(center, player);
        float enemy = damage(center, target);
        return self <= MAX_SELF_DAMAGE && self + 2.0F < player.getHealth()
                && enemy >= 4.0F && enemy > self;
    }

    private static float damage(Vec3 center, LivingEntity entity) {
        double distance = Math.sqrt(entity.distanceToSqr(center)) / 12.0;
        if (distance > 1.0) {
            return 0;
        }
        double impact = (1.0 - distance) * ServerExplosion.getSeenPercent(center, entity);
        return (float) ((impact * impact + impact) / 2.0 * 84.0 + 1.0);
    }
}