Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. IsEntityValid method in the aura main class
  2.  
  3. public boolean isEntityValid(final Entity entity) {
  4. if (entity instanceof EntityLivingBase) {
  5. final EntityLivingBase entityLiving = (EntityLivingBase)entity;
  6. if (!ClientUtils.player().isEntityAlive() || !entityLiving.isEntityAlive() || entityLiving.getDistanceToEntity(ClientUtils.player()) > (ClientUtils.player().canEntityBeSeen(entityLiving) ? this.range : 3.0)) {
  7. return false;
  8. }
  9. if (entityLiving.ticksExisted < this.ticksExisted) {
  10. return false;
  11. }
  12. if (this.players && entityLiving instanceof EntityPlayer) {
  13. final EntityPlayer entityPlayer = (EntityPlayer)entityLiving;
  14. return !FriendManager.isFriend(entity.getName()) && (Helper.hasArmor(entityPlayer)) && (!this.antibot || (AntiBotEngine.getInstance().doesntExistMoreThanOnce(entityPlayer) && AntiBotEngine.getInstance().hasEntityReachedThisDistance(entityPlayer, 5.0f)));
  15. }
  16. if (this.animals && (entityLiving instanceof EntityAnimal || entityLiving instanceof EntitySquid || entityLiving instanceof EntityMob || entityLiving instanceof EntityGhast)) {
  17. return true;
  18. }
  19. }
  20. return false;
  21. }
  22.  
  23. AntiBotEngine class
  24.  
  25. package me.aristhena.utils;
  26.  
  27. import net.minecraft.entity.player.*;
  28. import net.minecraft.entity.*;
  29. import java.util.*;
  30.  
  31. import me.aristhena.event.EventManager;
  32. import me.aristhena.event.EventTarget;
  33. import me.aristhena.event.events.TickEvent;
  34.  
  35. public class AntiBotEngine extends Helper
  36. {
  37. public ArrayList<EntityPlayer> bots;
  38. public HashMap<EntityPlayer, Float> rangemap;
  39. private static AntiBotEngine instance;
  40.  
  41. public AntiBotEngine() {
  42. this.bots = new ArrayList<EntityPlayer>();
  43. this.rangemap = new HashMap<EntityPlayer, Float>();
  44. }
  45.  
  46. @EventTarget
  47. public void onTick(final TickEvent eventTick) {
  48. for (final Entity entity : Helper.getLoadedEntities()) {
  49. if (entity != ClientUtils.player() && entity instanceof EntityPlayer) {
  50. final EntityPlayer player = (EntityPlayer)entity;
  51. this.rangemap.putIfAbsent(player, ClientUtils.player().getDistanceToEntity(entity));
  52. if (!this.rangemap.containsKey(entity) || this.rangemap.get(entity) >= ClientUtils.player().getDistanceToEntity(entity)) {
  53. continue;
  54. }
  55. this.rangemap.replace(player, ClientUtils.player().getDistanceToEntity(entity));
  56. }
  57. }
  58. }
  59.  
  60. public boolean hasEntityReachedThisDistance(final EntityPlayer entityPlayer, final float minDistance) {
  61. return this.rangemap.containsKey(entityPlayer) && this.rangemap.get(entityPlayer) > minDistance;
  62. }
  63.  
  64. public boolean doesntExistMoreThanOnce(final EntityPlayer entityPlayer) {
  65. int counts = 0;
  66. for (final Entity entity : Helper.getLoadedEntities()) {
  67. if (entity != entityPlayer && entity instanceof EntityPlayer && entity.getName().equals(entityPlayer.getName())) {
  68. ++counts;
  69. }
  70. }
  71. return counts == 1;
  72. }
  73.  
  74. public static AntiBotEngine getInstance() {
  75. return AntiBotEngine.instance;
  76. }
  77.  
  78. static {
  79. EventManager.register(AntiBotEngine.instance = new AntiBotEngine());
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement