Начинающий
- Статус
- Оффлайн
- Регистрация
- 23 Июн 2025
- Сообщения
- 43
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
Код:
package im.expensive.functions.impl.combat;
import com.google.common.eventbus.Subscribe;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
@FunctionRegister(name = "AntiBot", type = Category.Combat)
public class AntiBot extends Function {
public static List<Entity> bots = new ArrayList<Entity>();
public AntiBot() {
super();
}
@Subscribe
public void onUpdate(EventUpdate eventUpdate) {
this.reallyWorldCheck();
}
private void reallyWorldCheck() {
for (PlayerEntity playerEntity : mc.world.getPlayers()) {
if (mc.player == playerEntity) {
continue;
}
boolean armorCheck = false;
boolean enchantCheck = false;
boolean armorDamagedCheck = false;
boolean offHandCheck = playerEntity.getHeldItemOffhand().getItem() == Items.AIR;
boolean equipCheck =
playerEntity.inventory.armorInventory.get(0).getItem() == Items.LEATHER_BOOTS ||
playerEntity.inventory.armorInventory.get(0).getItem() == Items.IRON_BOOTS ||
playerEntity.inventory.armorInventory.get(1).getItem() == Items.LEATHER_LEGGINGS ||
playerEntity.inventory.armorInventory.get(1).getItem() == Items.IRON_LEGGINGS ||
playerEntity.inventory.armorInventory.get(2).getItem() == Items.LEATHER_CHESTPLATE ||
playerEntity.inventory.armorInventory.get(2).getItem() == Items.IRON_CHESTPLATE ||
playerEntity.inventory.armorInventory.get(3).getItem() == Items.LEATHER_HELMET ||
playerEntity.inventory.armorInventory.get(3).getItem() == Items.IRON_HELMET;
boolean mainHandCheck = playerEntity.getHeldItemMainhand().getItem() != Items.AIR;
boolean foodCheck = playerEntity.getFoodStats().getFoodLevel() == 20;
for (int i = 0; i < 4; ++i) {
ItemStack armorPiece = playerEntity.inventory.armorInventory.get(i);
if (!armorCheck && armorPiece.getItem() != Items.AIR) {
armorCheck = true;
}
if (!enchantCheck && armorPiece.isEnchantable()) {
enchantCheck = true;
}
if (!armorDamagedCheck && !armorPiece.isDamaged()) {
armorDamagedCheck = true;
}
}
if (armorCheck && enchantCheck && armorDamagedCheck && offHandCheck &&
equipCheck && mainHandCheck && foodCheck) {
if (!bots.contains(playerEntity)) {
bots.add(playerEntity);
}
} else {
bots.remove(playerEntity);
}
}
}
public static boolean isBot(Entity entity) {
return entity instanceof PlayerEntity && bots.contains(entity);
}
public static boolean isBot(LivingEntity entity) {
return entity instanceof PlayerEntity && bots.contains(entity);
}
public static boolean checkBot(Entity entity) {
return isBot(entity);
}
@Override
public void onDisable() {
super.onDisable();
bots.clear();
}
}