Greenadine

PathfinderGoalAvoidTarget.java

Sep 17th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. package net.minecraft.server.v1_12_R1;
  2.  
  3. import com.google.common.base.Predicate;
  4. import com.google.common.base.Predicates;
  5. import java.util.List;
  6.  
  7. public class PathfinderGoalAvoidTarget<T extends Entity>
  8. extends PathfinderGoal
  9. {
  10. private final Predicate<Entity> c = new PathfinderGoalAvoidTarget.1(this);
  11.  
  12. protected EntityCreature a;
  13.  
  14. private final double d;
  15.  
  16. private final double e;
  17.  
  18. protected T b;
  19.  
  20. private final float f;
  21. private PathEntity g;
  22. private final NavigationAbstract h;
  23. private final Class<T> i;
  24. private final Predicate<? super T> j;
  25.  
  26. public PathfinderGoalAvoidTarget(EntityCreature paramEntityCreature, Class<T> paramClass, float paramFloat, double paramDouble1, double paramDouble2)
  27. {
  28. this(paramEntityCreature, paramClass, Predicates.alwaysTrue(), paramFloat, paramDouble1, paramDouble2);
  29. }
  30.  
  31. public PathfinderGoalAvoidTarget(EntityCreature paramEntityCreature, Class<T> paramClass, Predicate<? super T> paramPredicate, float paramFloat, double paramDouble1, double paramDouble2) {
  32. a = paramEntityCreature;
  33. i = paramClass;
  34. j = paramPredicate;
  35. f = paramFloat;
  36. d = paramDouble1;
  37. e = paramDouble2;
  38. h = paramEntityCreature.getNavigation();
  39. a(1);
  40. }
  41.  
  42. public boolean a()
  43. {
  44. List localList = a.world.a(i, a.getBoundingBox().grow(f, 3.0D, f), Predicates.and(new Predicate[] { IEntitySelector.d, c, j }));
  45. if (localList.isEmpty()) {
  46. return false;
  47. }
  48. b = ((Entity)localList.get(0));
  49.  
  50.  
  51.  
  52.  
  53. Vec3D localVec3D = RandomPositionGenerator.b(a, 16, 7, new Vec3D(b.locX, b.locY, b.locZ));
  54. if (localVec3D == null) {
  55. return false;
  56. }
  57. if (b.d(x, y, z) < b.h(a)) {
  58. return false;
  59. }
  60. g = h.a(x, y, z);
  61. return g != null;
  62. }
  63.  
  64. public boolean b()
  65. {
  66. return !h.o();
  67. }
  68.  
  69. public void c()
  70. {
  71. h.a(g, d);
  72. }
  73.  
  74. public void d()
  75. {
  76. b = null;
  77. }
  78.  
  79. public void e()
  80. {
  81. if (a.h(b) < 49.0D) {
  82. a.getNavigation().a(e);
  83. } else {
  84. a.getNavigation().a(d);
  85. }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment