Auto Totem Replacer
Minecraft Gameplay Impact
Monitors the player's offhand slot. The millisecond the offhand Totem of Undying is consumed or destroyed, this module searches the inventory for a spare totem and swaps it into the offhand slot via clickSlot window packets in 0 ticks.
Functions & APIs Analyzed
ClientPlayerInteractionManager.clickSlot
Dispatches inventory slot interaction packets (method_2906).
Items.TOTEM_OF_UNDYING
Item identifier constant (field_8288) for totem search.
PlayerEntity.getOffHandStack
Inspects currently equipped offhand item (method_6079).
Mod Implementation (Dev Source / Mapped)
// Developer Source (Fabric / Yarn mappings)
public class AutoTotem {
public static void update(MinecraftClient client) {
if (client.player.getOffHandStack().getItem() != Items.TOTEM_OF_UNDYING) {
int slot = findTotemSlot(client.player.getInventory());
if (slot != -1) {
client.interactionManager.clickSlot(client.player.currentScreenHandler.syncId, slot, 0, SlotActionType.PICKUP, client.player);
client.interactionManager.clickSlot(client.player.currentScreenHandler.syncId, 45, 0, SlotActionType.PICKUP, client.player);
}
}
}
}
Decompiled Representation (Vineflower View)
// Decompiled with Vineflower 1.12 (Intermediary mappings)
public class AutoTotem {
public static void update(class_310 client) {
if (client.field_1724.method_6079().method_7909() != class_1802.field_8288) {
int slot = findTotemSlot(client.field_1724.method_31548());
if (slot != -1) {
client.field_1761.method_2906(client.field_1724.field_7512.field_7763, slot, 0, class_1713.field_7790, client.field_1724);
client.field_1761.method_2906(client.field_1724.field_7512.field_7763, 45, 0, class_1713.field_7790, client.field_1724);
}
}
}
}
Bytecode Signature & Static Detection
Matches Items.TOTEM_OF_UNDYING (field_8288) paired with ClientPlayerInteractionManager.clickSlot (method_2906) targeting offhand slot 45.