mzncraft6-cell

make a minecraft auto totming crystaling and anchoring mod search online for help

Kodari AI
KodariJun 22 at 12:27 pm 42

I have enough research context to build this. Let me plan:

  1. build.gradle + build files

  2. AutoCombatClient.java — main client init, registers tick + HUD

  3. ModKeybinds.java — toggle keybinds for each module

  4. AutoTotemModule.java — every tick keeps totem in offhand via slot packets

  5. AutoCrystalModule.java — places End Crystals near nearest enemy, breaks them

  6. AutoAnchorModule.java — state machine: place anchor → charge → detonate

  7. HudOverlay.java — status display (ON/OFF per module)

AutoCombatMod
A client-side Fabric 1.21.11 Crystal PvP utility mod with three automation features. Auto Totem instantly moves a Totem of Undying from inventory to offhand whenever the slot is empty using inventory slot packets. Auto Crystal places End Crystals on obsidian/bedrock near the nearest enemy then immediately attacks them to explode. Auto Anchor runs a state machine to place, charge with glowstone, and detonate Respawn Anchors near enemies. Each feature has a dedicated keybind toggle and a HUD overlay shows active status.

How to use:

Feature
Default Key
What you need in hotbar
Auto Totem
Y
Totems anywhere in inventory
Auto Crystal
X
End Crystals in hotbar
Auto Anchor
B
Respawn Anchor + Glowstone in hotbar

Auto Totem — always on by default. Every tick it checks if your offhand has a totem; if not, it runs a 3-packet inventory swap to move one there instantly. Prefers main inventory over hotbar slots.

Auto Crystal — finds the nearest enemy within 8 blocks, breaks the closest End Crystal near them, then places a new one on any obsidian/bedrock surface nearby. Requires obsidian or bedrock on the ground near your target.

Auto Anchor — runs a 3-phase state machine: place anchor → charge with glowstone → detonate. Works in the Overworld and End only (anchors explode there). Resets automatically if the anchor disappears between phases.

⚠️ Note: Many servers ban client-side combat mods. Use responsibly and check server rules.

mzncraft6-cell

The compilation failed with this error:

code
Compilation failed with 22 error(s):

ERROR in src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 59: selectedSlot has private access in PlayerInventory
        player.getInventory().selectedSlot = crystalSlot;
                             ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 99: cannot find symbol
                    double distToPlayer = player.getPos().distanceTo(Vec3d.ofCenter(check));
                                                ^
  symbol: method getPos()
  location: variable player of type ClientPlayerEntity

ERROR in src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 101: cannot find symbol
                    double score = Vec3d.ofCenter(check).distanceTo(target.getPos());
                                                                          ^
  symbol: method getPos()
  location: variable target of type PlayerEntity

ERROR in src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 114: main has private access in PlayerInventory
            if (player.getInventory().main.get(i).isOf(item)) return i;
                                     ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 31: cannot find symbol
        if (inv.offHand.get(0).isOf(Items.TOTEM_OF_UNDYING)) return;
               ^
  symbol: variable offHand
  location: variable inv of type PlayerInventory

ERROR in src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 36: main has private access in PlayerInventory
            if (inv.main.get(i).isOf(Items.TOTEM_OF_UNDYING)) {
                   ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 43: main has private access in PlayerInventory
                if (inv.main.get(i).isOf(Items.TOTEM_OF_UNDYING)) {
                       ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 74: selectedSlot has private access in PlayerInventory
        player.getInventory().selectedSlot = anchorSlot;
                             ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 101: selectedSlot has private access in PlayerInventory
        player.getInventory().selectedSlot = glowstoneSlot;
                             ^

ERROR in src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 141: cannot find symbol
                double dist = player.getPos().distanceTo(Vec3d.ofCenter(above));
                                    ^
  symbol: method getPos()
  location: variable player of type ClientPlayerEntity

ERROR in src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 164: main has private access in PlayerInventory
            if (player.getInventory().main.get(i).isOf(item)) return i;
                                     ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 31: cannot find symbol
          if (inv.offHand.get(0).isOf(Items.TOTEM_OF_UNDYING)) return;
                 ^
  symbol: variable offHand
  location: variable inv of type PlayerInventory

ERROR in   src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 59: selectedSlot has private access in PlayerInventory
          player.getInventory().selectedSlot = crystalSlot;
                               ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 114: main has private access in PlayerInventory
              if (player.getInventory().main.get(i).isOf(item)) return i;
                                       ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 36: main has private access in PlayerInventory
              if (inv.main.get(i).isOf(Items.TOTEM_OF_UNDYING)) {
                     ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoTotemModule.java at line 43: main has private access in PlayerInventory
                  if (inv.main.get(i).isOf(Items.TOTEM_OF_UNDYING)) {
                         ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 74: selectedSlot has private access in PlayerInventory
          player.getInventory().selectedSlot = anchorSlot;
                               ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 101: selectedSlot has private access in PlayerInventory
          player.getInventory().selectedSlot = glowstoneSlot;
                               ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 164: main has private access in PlayerInventory
              if (player.getInventory().main.get(i).isOf(item)) return i;
                                       ^

ERROR in   src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 99: cannot find symbol
                      double distToPlayer = player.getPos().distanceTo(Vec3d.ofCenter(check));
                                                  ^
  symbol: method getPos()
  location: variable player of type ClientPlayerEntity

ERROR in   src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java at line 101: cannot find symbol
                      double score = Vec3d.ofCenter(check).distanceTo(target.getPos());
                                                                            ^
  symbol: method getPos()
  location: variable target of type PlayerEntity

ERROR in   src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java at line 141: cannot find symbol
                  double dist = player.getPos().distanceTo(Vec3d.ofCenter(above));
                                      ^
  symbol: method getPos()
  location: variable player of type ClientPlayerEntity


=== COMPILATION ERROR ANALYSIS ===

MISSING METHODS:
  - getPos()
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java
  - src/main/java/client/java/com/autocombat/module/AutoTotemModule.java
  - src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java
  -   src/main/java/client/java/com/autocombat/module/AutoTotemModule.java
  -   src/main/java/client/java/com/autocombat/module/AutoCrystalModule.java
  -   src/main/java/client/java/com/autocombat/module/AutoAnchorModule.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJun 22 at 12:32 pm 30

Three issues to fix:

  1. PlayerInventory.main, .offHand, .selectedSlot are private → need a mixin accessor

  2. entity.getPos() → use new Vec3d(entity.getX(), entity.getY(), entity.getZ())

  3. offHand.get(0) → use player.getOffHandStack() (public LivingEntity method)

Creating the accessor mixin and patching all three modules:

Now wire the mixin file into fabric.mod.json:

Now fix the three modules — replacing private field access with accessor calls and fixing getPos():

The totem module was partially patched but the logic got garbled by overlapping patches. Let me rewrite it cleanly:

Now create the mixin accessor and its JSON:


All 22 errors fixed:

Error
Fix
inv.offHand
private
→
player.getOffHandStack()
(public
LivingEntity
method)
inv.main.get(i)
private
→
inv.getStack(i)
(public
PlayerInventory
method)
inv.selectedSlot = x
private
→
((PlayerInventoryAccessor) inv).setSelectedSlot(x)
via new
@Accessor
mixin
entity.getPos()
not found
→
new Vec3d(entity.getX(), entity.getY(), entity.getZ())
using safe individual coordinate getters

The new PlayerInventoryAccessor mixin (@Accessor("selectedSlot")) exposes the private field as a writable setter with zero bytecode risk — it’s read straight from the field at runtime via Mixin.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
13 593
src/client/java/com/autocombat/AutoCombatClient.java
package com.autocombat;

import com.autocombat.module.AutoAnchorModule;
import com.autocombat.module.AutoCrystalModule;
import com.autocombat.module.AutoTotemModule;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Identifier;

@Environment(EnvType.CLIENT)
public class AutoCombatClient implements ClientModInitializer {

    public static final String MOD_ID = "autocombat";

    @Override
    public void onInitializeClient() {
        ModKeybinds.register();

        HudElementRegistry.addLast(
            Identifier.of(MOD_ID, "status"),
            (context, tickCounter) -> HudOverlay.render(context)
        );

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (ModKeybinds.TOGGLE_TOTEM.wasPressed()) {
                AutoTotemModule.enabled = !AutoTotemModule.enabled;
            }
            while (ModKeybinds.TOGGLE_CRYSTAL.wasPressed()) {
                AutoCrystalModule.enabled = !AutoCrystalModule.enabled;
            }
            while (ModKeybinds.TOGGLE_ANCHOR.wasPressed()) {
                AutoAnchorModule.enabled = !AutoAnchorModule.enabled;
            }

            AutoTotemModule.tick(client);
            AutoCrystalModule.tick(client);
            AutoAnchorModule.tick(client);
        });
    }
}