[NMS] PathFinderGoal

Discussion in 'Plugin Development' started by ToastHelmi, Mar 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ToastHelmi

    I want to write my own targetSelector there is only a smale change.
    this is my Code:
    Code:java
    1. package me.ToastHelmi.GrandTheftMinecart.NMS.PathFinderGoals;
    2.  
    3. import java.util.Collections;
    4. import java.util.List;
    5.  
    6. import net.minecraft.server.v1_7_R1.DistanceComparator;
    7. import net.minecraft.server.v1_7_R1.EntityCreature;
    8. import net.minecraft.server.v1_7_R1.EntityLiving;
    9. import net.minecraft.server.v1_7_R1.IEntitySelector;
    10. import net.minecraft.server.v1_7_R1.PathfinderGoalNearestAttackableTarget;
    11.  
    12. public class PathfinderGoalNearestAttackableGangster extends
    13. PathfinderGoalNearestAttackableTarget {
    14.  
    15. private final Class a;
    16. private final int b;
    17. private final DistanceComparator e;
    18. private final IEntitySelector f;
    19. private EntityLiving g;
    20.  
    21. public PathfinderGoalNearestAttackableGangster(
    22. EntityCreature entitycreature, Class oclass, int i, boolean flag) {
    23. this(entitycreature, oclass, i, flag, false);
    24. }
    25.  
    26. public PathfinderGoalNearestAttackableGangster(EntityCreature entitycreature, Class oclass, int i, boolean flag,boolean flag1) {
    27. this(entitycreature, oclass, i, flag, flag1, (IEntitySelector) null);
    28. }
    29.  
    30. public PathfinderGoalNearestAttackableGangster(EntityCreature entitycreature, Class oclass, int i, boolean flag,boolean flag1, IEntitySelector ientityselector) {
    31. super(entitycreature, oclass, i, flag, flag1, ientityselector);
    32. this.a = oclass;
    33. this.b = i;
    34. this.e = new DistanceComparator(entitycreature);
    35. this.a(1);
    36. this.f = new EntitySelectorNearestAttackableGangster(this,ientityselector);
    37. }
    38. public boolean a() {
    39. if (this.b > 0 && this.c.aH().nextInt(this.b) != 0) {
    40. return false;
    41. } else {
    42. double d0 = this.f();
    43. List list = this.c.world.a(this.a, this.c.boundingBox.grow(d0, 4.0D, d0), this.f);
    44.  
    45. Collections.sort(list, this.e);
    46. if (list.isEmpty()) {
    47. return false;
    48. } else {
    49. this.g = (EntityLiving) list.get(0);
    50. return true;
    51. }
    52. }
    53. }
    54.  
    55. public void c() {
    56. this.c.setGoalTarget(this.g);
    57. super.c();
    58. }
    59. public boolean a(EntityLiving entityliving, boolean flag) {
    60. return super.a(entityliving, flag);
    61. }
    62.  
    63. }
    64.  

    But i get this error
    Code:
    The method aH() is undefined for the type EntityCreature
    does anybody know whats the name of this method or can i simply use a new Random??
     
  2. Offline

    Garris0n

  3. Offline

    JoeyDevs

    Do u use the Bukkit API or the Craftbukkit.jar ?l
    and if it is the Craftbukkit.jar , can u use the same things in craftbukkit as in bukkit api?
     
  4. Offline

    Garris0n

    He's using CraftBukkit.
     
  5. Offline

    JoeyDevs

    But you can use the same things as in the bukkit API and extra NMS
     
  6. Offline

    Garris0n

    The Bukkit API is just an API, CraftBukkit is both the API and the internal server code.
     
  7. Offline

    ToastHelmi

    Garris0n
    thanks im new to NMS and was looking for some method in EntityCreature that gives me the opertunety for .nextInt()
     
  8. Offline

    Garris0n

    The recent switch from 1.7.2 to 1.7.5 confused me too :p

    I spent like half an hour trying to figure out where a method was in a class before noticing Bukkit had just been updated ._.
     
  9. Offline

    ToastHelmi

    And am i rigth
    EntityHuman.class is for the Player
     
Thread Status:
Not open for further replies.

Share This Page