/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (theWatcher.getRNG().nextFloat() >= field_75331_e) { return false; } if (watchedClass == (net.minecraft.src.EntityPlayer.class)) { closestEntity = theWatcher.worldObj.getClosestPlayerToEntity(theWatcher, field_75333_c); } else { closestEntity = theWatcher.worldObj.findNearestEntityWithinAABB( watchedClass, theWatcher.boundingBox.expand(field_75333_c, 3D, field_75333_c), theWatcher); } return closestEntity != null; }
/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { leapTarget = leaper.getAttackTarget(); if (leapTarget == null) { return false; } double d = leaper.getDistanceSqToEntity(leapTarget); if (d < 4D || d > 16D) { return false; } if (!leaper.onGround) { return false; } return leaper.getRNG().nextInt(5) == 0; }
/** Execute a one shot task or start executing a continuous task */ public void startExecuting() { lookTime = 40 + theWatcher.getRNG().nextInt(40); }