Начинающий
- Статус
- Оффлайн
- Регистрация
- 25 Янв 2026
- Сообщения
- 3
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
вот рабочий AutoSwap Funtime 1.21.4 FunTime думаю норм на 1 раз 

AutoSwap:
package autoswap.funtime;
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.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import org.lwjgl.glfw.GLFW;
import java.util.EnumMap;
import java.util.Map;
public class AutoSwapClient implements ClientModInitializer {
static class Settings {
boolean enabled = true;
float healthThreshold = 7.0f;
int delayTicks = 4;
Item lowHealthItem = Items.GOLDEN_APPLE;
Item combatItem = Items.NETHERITE_SWORD;
Item utilityItem = Items.TOTEM_OF_UNDYING;
}
enum Mode {
AUTO,
COMBAT,
UTILITY
}
private final Settings settings = new Settings();
private final Map<Mode, KeyBinding> binds = new EnumMap<>(Mode.class);
private Mode mode = Mode.AUTO;
private int cooldown = 0;
@Override
public void onInitializeClient() {
binds.put(Mode.AUTO, KeyBindingHelper.registerKeyBinding(
new KeyBinding("autoswap.auto", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_Z, "autoswap")
));
binds.put(Mode.COMBAT, KeyBindingHelper.registerKeyBinding(
new KeyBinding("autoswap.combat", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_X, "autoswap")
));
binds.put(Mode.UTILITY, KeyBindingHelper.registerKeyBinding(
new KeyBinding("autoswap.utility", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C, "autoswap")
));
ClientTickEvents.END_CLIENT_TICK.register(this::tick);
}
private void tick(MinecraftClient mc) {
if (mc.player == null || mc.currentScreen != null) return;
if (binds.get(Mode.AUTO).wasPressed()) mode = Mode.AUTO;
if (binds.get(Mode.COMBAT).wasPressed()) mode = Mode.COMBAT;
if (binds.get(Mode.UTILITY).wasPressed()) mode = Mode.UTILITY;
if (!settings.enabled) return;
if (cooldown > 0) {
cooldown--;
return;
}
switch (mode) {
case AUTO -> autoLogic(mc.player);
case COMBAT -> forceItem(mc.player, settings.combatItem);
case UTILITY -> forceItem(mc.player, settings.utilityItem);
}
}
private void autoLogic(PlayerEntity player) {
if (player.getHealth() <= settings.healthThreshold) {
if (forceItem(player, settings.lowHealthItem)) return;
}
forceItem(player, settings.combatItem);
}
private boolean forceItem(PlayerEntity player, Item item) {
int slot = findHotbarItem(player, item);
if (slot == -1) return false;
if (player.getInventory().selectedSlot != slot) {
player.getInventory().selectedSlot = slot;
player.swingHand(Hand.MAIN_HAND);
cooldown = settings.delayTicks;
}
return true;
}
private int findHotbarItem(PlayerEntity player, Item item) {
for (int i = 0; i < 9; i++) {
if (player.getInventory().getStack(i).getItem() == item) {
return i;
}
}
return -1;
}
}
Последнее редактирование:
