Rndom Rndom

package com.example.armorremover;

import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.entity.EquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.screen.slot.SlotActionType; import net.minecraft.text.Text; import java.util.HashMap; import java.util.Map;

public class ArmorRemoverLogic { public static final int CRITICAL_STRIP_THRESHOLD = 100; public static int mendRoundCounter = 1; private static boolean cycleCompletedTrigger = false;

// Reset code triggered when you hit your custom hotkey public static void resetMod(MinecraftClient client) { mendRoundCounter = 1; cycleCompletedTrigger = false; if (client.player != null) { client.player.sendMessage(Text.literal("§b[MendMod] Tracking cycles reset back to Round 1!"), true); } }

public static void checkArmorCycle(MinecraftClient client) { if (client.player == null || client.interactionManager == null) return; int syncId = client.player.playerScreenHandler.syncId;

// Checks if you are intentionally text chatting or typing commands boolean isCurrentlyTexting = (client.currentScreen instanceof ChatScreen); int totalXpBottlesLeft = countRemainingXpBottles(client);

Map<EquipmentSlot, Boolean> slotIsReady = new HashMap<>(); slotIsReady.put(EquipmentSlot.HEAD, false); slotIsReady.put(EquipmentSlot.CHEST, false); slotIsReady.put(EquipmentSlot.LEGS, false); slotIsReady.put(EquipmentSlot.FEET, false);

for (EquipmentSlot slot : EquipmentSlot.values()) { if (slot.getType() == EquipmentSlot.Type.ARMOR) { ItemStack equippedStack = client.player.getEquippedStack(slot); int bodySlotId = getSlotIdForEquipment(slot); if (bodySlotId == -1) continue;

int targetThreshold = getTargetThreshold(slot, mendRoundCounter, totalXpBottlesLeft);

if (!equippedStack.isEmpty() && equippedStack.isDamageable()) { int dur = equippedStack.getMaxDamage() - equippedStack.getDamage(); if (dur >= targetThreshold) slotIsReady.put(slot, true);

// A: COMBAT EJECTION SAFETY (Only triggers at 100 on Round 1) if (!isCurrentlyTexting && mendRoundCounter == 1 && dur <= CRITICAL_STRIP_THRESHOLD) { client.interactionManager.clickSlot(syncId, bodySlotId, 0, SlotActionType.QUICK_MOVE, client.player); cycleCompletedTrigger = true; }

// B: CHAT MILESTONE STRIP (Pops off single pieces hitting target numbers while texting) if (isCurrentlyTexting && dur >= targetThreshold) { client.interactionManager.clickSlot(syncId, bodySlotId, 0, SlotActionType.QUICK_MOVE, client.player); } }

// Checks inventory bag slots to find items that have reached their target thresholds if (equippedStack.isEmpty()) { for (int i = 9; i < 45; i++) { ItemStack inventoryStack = client.player.playerScreenHandler.getSlot(i).getStack(); if (!inventoryStack.isEmpty() && inventoryStack.isDamageable() && isMatchingSlot(inventoryStack, slot)) { int dur = inventoryStack.getMaxDamage() - inventoryStack.getDamage(); if (dur >= targetThreshold) { slotIsReady.put(slot, true); break; } } } } } }

// --- THE SYNCHRONIZED SNAP-BACK ENGAGEMENT LOCK --- boolean allPiecesAreReady = slotIsReady.get(EquipmentSlot.HEAD) && slotIsReady.get(EquipmentSlot.CHEST) && slotIsReady.get(EquipmentSlot.LEGS) && slotIsReady.get(EquipmentSlot.FEET);

// Pulls everything out of the bags onto your body at the exact same millisecond if (allPiecesAreReady) { for (EquipmentSlot slot : EquipmentSlot.values()) { if (slot.getType() == EquipmentSlot.Type.ARMOR) { ItemStack equippedStack = client.player.getEquippedStack(slot); if (equippedStack.isEmpty()) { for (int i = 9; i < 45; i++) { ItemStack inventoryStack = client.player.playerScreenHandler.getSlot(i).getStack(); if (!inventoryStack.isEmpty() && inventoryStack.isDamageable() && isMatchingSlot(inventoryStack, slot)) { client.interactionManager.clickSlot(syncId, i, 0, SlotActionType.QUICK_MOVE, client.player); break; } } } } } if (cycleCompletedTrigger) { mendRoundCounter = 2; cycleCompletedTrigger = false; } } }

private static int getTargetThreshold(EquipmentSlot slot, int round, int xpBottlesLeft) { // LOW-XP ADAPTIVE SAFETY VALVE: Drops limits to standard 400 if you have 16 or fewer bottles left if (xpBottlesLeft <= 16) return 400; if (round == 1) return 400; return switch (slot) { case CHEST, LEGS -> 480; case FEET -> 415; case HEAD -> 400; default -> 400; }; }

private static int countRemainingXpBottles(MinecraftClient client) { if (client.player == null) return 0; int count = 0; for (int i = 0; i < client.player.getInventory().size(); i++) { ItemStack stack = client.player.getInventory().getStack(i); if (stack.isOf(Items.EXPERIENCE_BOTTLE)) count += stack.getCount(); } return count; }

private static boolean isMatchingSlot(ItemStack stack, EquipmentSlot slot) { String name = stack.getItem().toString(); return switch (slot) { case HEAD -> name.contains("helmet"); case CHEST -> name.contains("chestplate"); case LEGS -> name.contains("leggings"); case FEET -> name.contains("boots"); default -> false; }; }

private static int getSlotIdForEquipment(EquipmentSlot slot) { return switch (slot) { case HEAD -> 5; case CHEST -> 6; case LEGS -> 7; case FEET -> 8; default -> -1; }; } }

Kodari AI
KodariOct 23 at 7:38 am 2
MendCycleArmorManager
A Minecraft Fabric mod that automates armor maintenance cycles. It monitors equipped armor durability, strips pieces at critical thresholds, and synchronizes replacement from inventory when all four armor slots reach target durability levels. Features adaptive thresholds based on XP bottle count, chat-aware stripping, and a two-round mend cycle system for efficient armor management.

Plan:

  1. Create a client-only Fabric 1.21.11 mod from the supplied armor-cycle logic.

  2. Add a reset keybind and client tick registration, then create the required project metadata.

Created a client-only Fabric 1.21.11 mod with the supplied armor-cycle logic, registered on client ticks. Press R to reset tracking to Round 1. I also used the 1.21.11 armor slot type, HUMANOID_ARMOR.

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

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public class MendCycleClient implements ClientModInitializer {
    private static final KeyBinding RESET_KEY = KeyBindingHelper.registerKeyBinding(
            new KeyBinding(
                    "key.mendcycle.reset",
                    GLFW.GLFW_KEY_R,
                    KeyBinding.Category.create(Identifier.of("mendcycle", "keys"))
            )
    );

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (RESET_KEY.wasPressed()) {
                ArmorRemoverLogic.resetMod(client);
            }
            ArmorRemoverLogic.checkArmorCycle(client);
        });
    }
}