// 4J - a few changes here so that we can call findRandomStrollLocation for a sub-set of things that it normally wouldn't be in the java game.
// This is so that we can have entities wander around a little, in order that we can measure how far they wander and then determine (if they wander too far) that
// they aren't enclosed. We don't want the extra network overhead of just having Everything wandering round all the time, so have put a management system in place
// that selects a subset of entities which have had their flag set through the considerForExtraWandering method so that these can keep doing random strolling.
// This entity wouldn't normally be randomly strolling. However, if our management system says that it should do, then do. Don't
// bother waiting for random conditions to be met before picking a direction though as the point here is to see if it is possible to
// stroll out of a given area and so waiting around is just wasting time
findRandomStrollLocation(getWanderingQuadrant());
}
}
// Consider this for extra strolling if it is protected against despawning. We aren't interested in ones that aren't protected as the whole point of this
// extra wandering is to potentially transition from protected to not protected.
considerForExtraWandering(isDespawnProtected());
intyFloor=Mth::floor(bb->y0+0.5f);
boolinWater=isInWater();
boolinLava=isInLava();
xRot=0;
if(path==NULL||random->nextInt(100)==0)
{
this->Mob::serverAiStep();
setPath(NULL);// 4J - changed to setPath from path =
// 4J - added quadrant parameter to this method so that the caller can request that only stroll locations in one quadrant be found. If -1 is passed then
// behaviour is the same as the java game
intxt,zt;
intyt=Mth::floor(y+random->nextInt(7)-3);
if(quadrant==-1)
{
xt=Mth::floor(x+random->nextInt(13)-6);
zt=Mth::floor(z+random->nextInt(13)-6);
}
else
{
intsx=((quadrant&1)?-1:1);
intsz=((quadrant&2)?-1:1);
xt=Mth::floor(x+random->nextInt(7)*sx);
zt=Mth::floor(z+random->nextInt(7)*sz);
}
floatvalue=getWalkTargetValue(xt,yt,zt);
if(value>best)
{
best=value;
xBest=xt;
yBest=yt;
zBest=zt;
hasBest=true;
}
}
if(hasBest)
{
setPath(level->findPath(shared_from_this(),xBest,yBest,zBest,10,true,false,false,true));// 4J - changed to setPath from path =