Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 10 Дек 2022
- Сообщения
- 10
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
- Forge
- Fabric
- NeoForge
- OptiFine
- ForgeOptiFine
на форуме нет нормальных рабочих хелперов фт так еще и рабочих на 1.21.4
поэтому я сделал свой
сс
поэтому я сделал свой
сс
Java:
package ru.daxx.implement.features.modules.misc;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import lombok.experimental.NonFinal;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.Hand;
import ru.daxx.api.event.EventHandler;
import ru.daxx.api.feature.module.Module;
import ru.daxx.api.feature.module.ModuleCategory;
import ru.daxx.api.feature.module.setting.implement.BindSetting;
import ru.daxx.common.util.world.ServerUtil;
import ru.daxx.implement.events.keyboard.KeyEvent;
import ru.daxx.implement.events.player.TickEvent;
import java.util.ArrayList;
import java.util.List;
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class FTAssistent extends Module {
List<FTKeyBind> keyBindings = new ArrayList<>();
@NonFinal Item pendingItem = null;
@NonFinal int tickTimer = 0;
@NonFinal int itemSlot = -1;
@NonFinal int originalSlot = -1;
@NonFinal boolean f, b, l, r, j;
public FTAssistent() {
super("FTAssistent", "Помощник по предметам", ModuleCategory.MISC);
initialize();
}
public void initialize() {
keyBindings.add(new FTKeyBind(Items.SNOWBALL, new BindSetting("SnowBall", "SnowBall Key").visible(() -> ServerUtil.isCopyTime() || ServerUtil.isHolyWorld()), 0));
keyBindings.add(new FTKeyBind(Items.PHANTOM_MEMBRANE, new BindSetting("Gods Aura", "God's Aura Key").visible(ServerUtil::isCopyTime), 0));
keyBindings.add(new FTKeyBind(Items.NETHERITE_SCRAP, new BindSetting("Trap", "Trap Key").visible(ServerUtil::isCopyTime), 0));
keyBindings.add(new FTKeyBind(Items.DRIED_KELP, new BindSetting("Plast", "Plast Key").visible(ServerUtil::isCopyTime), 0));
keyBindings.add(new FTKeyBind(Items.SUGAR, new BindSetting("Clear Dust", "Clear Dust Key").visible(ServerUtil::isCopyTime), 10));
keyBindings.add(new FTKeyBind(Items.FIRE_CHARGE, new BindSetting("Fire Tornado", "Fire Tornado Key").visible(ServerUtil::isCopyTime), 10));
keyBindings.add(new FTKeyBind(Items.ENDER_EYE, new BindSetting("Disorientation", "Disorientation Key").visible(ServerUtil::isCopyTime), 10));
keyBindings.forEach(bind -> setup(bind.setting));
}
@EventHandler
public void onTick(TickEvent e) {
if (mc.player == null || pendingItem == null) return;
tickTimer++;
if (tickTimer == 1) {
f = mc.options.forwardKey.isPressed();
b = mc.options.backKey.isPressed();
l = mc.options.leftKey.isPressed();
r = mc.options.rightKey.isPressed();
j = mc.options.jumpKey.isPressed();
mc.options.forwardKey.setPressed(false);
mc.options.backKey.setPressed(false);
mc.options.leftKey.setPressed(false);
mc.options.rightKey.setPressed(false);
mc.options.jumpKey.setPressed(false);
mc.player.input.movementForward = 0;
mc.player.input.movementSideways = 0;
itemSlot = daun(pendingItem);
if (itemSlot == -1) {
VbeBan();
return;
}
}
int selected = mc.player.getInventory().selectedSlot;
int syncId = mc.player.currentScreenHandler.syncId;
switch (tickTimer) {
case 2 -> {
if (itemSlot >= 9) mc.interactionManager.clickSlot(syncId, itemSlot, selected, SlotActionType.SWAP, mc.player);
else mc.player.getInventory().selectedSlot = itemSlot;
}
case 3 -> {
mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
mc.player.swingHand(Hand.MAIN_HAND);
}
case 4 -> {
if (itemSlot >= 9) mc.interactionManager.clickSlot(syncId, itemSlot, selected, SlotActionType.SWAP, mc.player);
else mc.player.getInventory().selectedSlot = originalSlot;
}
case 5 -> VbeBan();
}
}
@EventHandler
public void onKey(KeyEvent e) {
if (mc.player == null || pendingItem != null) return;
keyBindings.stream()
.filter(bind -> e.isKeyReleased(bind.setting.getKey()) && bind.setting.isVisible())
.findFirst()
.ifPresent(bind -> {
int slot = daun(bind.item);
if (slot == -1) return;
originalSlot = mc.player.getInventory().selectedSlot;
pendingItem = bind.item;
tickTimer = 0;
});
}
private void VbeBan() {
mc.options.forwardKey.setPressed(f);
mc.options.backKey.setPressed(b);
mc.options.leftKey.setPressed(l);
mc.options.rightKey.setPressed(r);
mc.options.jumpKey.setPressed(j);
pendingItem = null;
itemSlot = -1;
tickTimer = 0;
}
private int daun(Item item) {
for (int i = 0; i < 45; i++) {
if (mc.player.getInventory().getStack(i).getItem() == item) return i;
}
return -1;
}
public record FTKeyBind(Item item, BindSetting setting, float distance) {}
}