if (bank_capacity > 0 && Math.random()*10 > 9 && working == undefined && bank_upgrade == 4) 
{ent.setPosition(bankx + Math.random()*bankx2, banky + Math.random()*banky2, 
bankz + Math.random()*bankz2); working = 1; bank_capacity -= 2; start = ent.getPosition();}

if (bank_upgrade >= 4 && pathing == true) {var pos = ent.getPosition(); var epos = player.getPosition();
if (Math.floor(Math.sqrt(Math.pow(epos.x-pos.x,2)+Math.pow(epos.y-pos.y,2)+Math.pow(epos.z-pos.z,2))) < 12)
{
rand = Math.floor(Math.random()*100); switch (rand) 
{case 0: case 2: ent.pathToBlock(pos.x + Math.random()*15 - Math.random()*15, 
pos.y + Math.random()*15 - Math.random()*15, pos.z + Math.random()*15 - Math.random()*15); break;
case 1: ent.pathToBlock(start.x,start.y,start.z); break;}
}
else {ent.setPosition(start.x,start.y,start.z);}}