kumpelblase2 / Remote-Entities

A library that enables you to control entities in minecraft.
Other
31 stars 28 forks source link

DesireMoveToLocation never finishes unless NPC is moved by a player #47

Closed rmb938 closed 11 years ago

rmb938 commented 11 years ago

So I have been trying to use DesireMoveToLocation and the npc will walk to the location but will never finish the desire.

Through some debugging I have found that that distanceSquared to the location sometimes returns 1.4-1.2 which makes DesireMoveToLocation unable to finish since the path finding has stopped the npc. So either the 1.15 limit in DesireMoveToLocation has to be raised or the path finding has to be tweaked.

rmb938 commented 11 years ago

After some more testing it turns out that the minecraft pathing is very picky and depending on the angle at which the npc is walking to it will vary from 0.3-1.5. So just changing the distance requirement in DesireMoveToLocation to something like 1.5 or 1.6 should work fine.

rmb938 commented 11 years ago

Ok after even more testing and comparing movement to how citizens2 does it I found this.

In the class DesireMoveToLocation under shouldExecute you should be using this instead:

http://pastebin.com/AQxufy9W

the f() method returns false while the entity is not at the walking to location and returns true when the entity is at the walking to location.