Определения движения игрока в Minecraft
Пишу мод и мне нужно отследить движение игрока.
Вот код:
@SubscribeEvent
public void playerUpdate(LivingUpdateEvent event) {
LivingEntity entity = event.getEntityLiving();
double i = entity.getPosX();
double j = entity.getPosY();
double k = entity.getPosZ();
World world = entity.world;
Map<String, Object> dependencies = new HashMap<>();
dependencies.put("x", i);
dependencies.put("y", j);
dependencies.put("z", k);
dependencies.put("entity", entity);
if ((lasti!=i) | (lastj!=j) | (lastk!=k)){
this.executeProcedure(dependencies);
}
lasti=i;
lastj=j;
lastk=k;
}
Но получается просто бесконечный цикл. Помогите пожалуйста.
P.S. Переменные lasti, lastj, lastk я обЪявил в другом куске кода.