the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.entity.h"
3#include "Sensing.h"
4
5Sensing::Sensing(Mob *mob)
6{
7 this->mob = mob;
8}
9
10void Sensing::tick()
11{
12 seen.clear();
13 unseen.clear();
14}
15
16bool Sensing::canSee(shared_ptr<Entity> target)
17{
18 //if ( find(seen.begin(), seen.end(), target) != seen.end() ) return true;
19 //if ( find(unseen.begin(), unseen.end(), target) != unseen.end()) return false;
20 for(AUTO_VAR(it, seen.begin()); it != seen.end(); ++it)
21 {
22 if(target == (*it).lock()) return true;
23 }
24 for(AUTO_VAR(it, unseen.begin()); it != unseen.end(); ++it)
25 {
26 if(target == (*it).lock()) return false;
27 }
28
29 //util.Timer.push("canSee");
30 bool canSee = mob->canSee(target);
31 //util.Timer.pop();
32 if (canSee) seen.push_back(weak_ptr<Entity>(target));
33 else unseen.push_back(weak_ptr<Entity>(target));
34 return canSee;
35}