Advertisement
Guest User

Untitled

a guest
Feb 7th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. public class CustomPathfinderGoalMeleeAttack extends PathfinderGoal {
  2.  
  3. World a;
  4. private String playerOwner;
  5. EntityCreature b;
  6. int c;
  7. double d;
  8. boolean e;
  9. PathEntity f;
  10. Class g;
  11. private int h;
  12. private double i;
  13. private double j;
  14. private double k;
  15.  
  16. public CustomPathfinderGoalMeleeAttack(EntityCreature entitycreature, Class oclass, double d0, boolean flag, String playerOwner) {
  17. this(entitycreature, d0, flag);
  18. this.g = oclass;
  19. this.playerOwner = playerOwner;
  20. }
  21.  
  22. public CustomPathfinderGoalMeleeAttack(EntityCreature entitycreature, double d0, boolean flag) {
  23. this.b = entitycreature;
  24. this.a = entitycreature.world;
  25. this.d = d0;
  26. this.e = flag;
  27. this.a(3);
  28. }
  29.  
  30. public boolean a() {
  31. EntityLiving entityliving = this.b.getGoalTarget();
  32.  
  33. if (entityliving == null) {
  34. return false;
  35. } else if (!entityliving.isAlive()) {
  36. return false;
  37. } else if (this.g != null && !this.g.isAssignableFrom(entityliving.getClass())) {
  38. return false;
  39. } else if(entityliving.getName().equalsIgnoreCase(this.playerOwner)) {
  40. return false;
  41. } else {
  42. this.f = this.b.getNavigation().a(entityliving);
  43. return this.f != null;
  44. }
  45. }
  46.  
  47. @SuppressWarnings("unchecked")
  48. public boolean b() {
  49. EntityLiving entityliving = this.b.getGoalTarget();
  50. return entityliving == null ? false : entityliving.getName().equalsIgnoreCase(this.playerOwner) ? false : (!entityliving.isAlive() ? false : (!this.e ? !this.b.getNavigation().g() : this.b.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))));
  51. }
  52.  
  53. public void c() {
  54. this.b.getNavigation().a(this.f, this.d);
  55. this.h = 0;
  56. }
  57.  
  58. public void d() {
  59. this.b.getNavigation().h();
  60. }
  61.  
  62. public void e() {
  63. EntityLiving entityliving = this.b.getGoalTarget();
  64.  
  65. this.b.getControllerLook().a(entityliving, 30.0F, 30.0F);
  66. double d0 = this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ);
  67. double d1 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);
  68.  
  69. Bukkit.getPlayer(entityliving.getName()).sendMessage("entity is tracking you");
  70. --this.h;
  71. if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && this.h <= 0 && (this.i == 0.0D && this.j == 0.0D && this.k == 0.0D || entityliving.e(this.i, this.j, this.k) >= 1.0D || this.b.aI().nextFloat() < 0.05F)) {
  72. this.i = entityliving.locX;
  73. this.j = entityliving.boundingBox.b;
  74. this.k = entityliving.locZ;
  75. this.h = 4 + this.b.aI().nextInt(7);
  76. if (d0 > 1024.0D) {
  77. this.h += 10;
  78. } else if (d0 > 256.0D) {
  79. this.h += 5;
  80. }
  81.  
  82. if (!this.b.getNavigation().a((Entity) entityliving, this.d)) {
  83. this.h += 15;
  84. }
  85. }
  86.  
  87. this.c = Math.max(this.c - 1, 0);
  88. if (d0 <= d1 && this.c <= 20) {
  89. this.c = 20;
  90. if (this.b.be() != null) {
  91. this.b.ba();
  92. }
  93.  
  94. this.b.m(entityliving);
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement