PathfinderGoal bug?

Discussion in 'Plugin Development' started by xorinzor, Jul 11, 2014.

Thread Status:
Not open for further replies.
  1. Hey all,
    So after lots of messing around with PathfinderGoals I discovered something weird.
    I was making my own pathfindergoal so my zombie would follow my custom PathEntity and it turns out that when the validator function returns only true it will only execute the pathfindergoal once.
    Only when you return false and then afterwards (when the pathfindergoal gets called a 2nd time) it will execute again.
    for example:
    Code:
    true -> execute
    true
    true
    false
    true -> execute
    false
    true -> execute
    true
    true
    false
    true -> execute
    (etc)
    Is this a known issue? I managed to solve this with a very ugly solution:
    Add a private boolean named "returnedTrue" and set it to true before every "return true;" statement, then at the top of the function add:
    Code:java
    1. if(returnedTrue) {
    2. returnedTrue = false;
    3. return false;
    4. }

    Now whenever it returns true twice it will execute always, however this doesnt seem right to me and I have no idea why this is happening.
     
Thread Status:
Not open for further replies.

Share This Page