package net.minecraft.entity.ai; import net.minecraft.entity.EntityCreature; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; public class EntityAIMoveTowardsRestriction extends EntityAIBase { private EntityCreature theEntity; private double movePosX; private double movePosY; private double movePosZ; private double movementSpeed; private static final String __OBFID = "CL_00001598"; public EntityAIMoveTowardsRestriction(EntityCreature p_i2347_1_, double p_i2347_2_) { this.theEntity = p_i2347_1_; this.movementSpeed = p_i2347_2_; this.setMutexBits(1); } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (this.theEntity.isWithinHomeDistanceCurrentPosition()) { return false; } else { BlockPos var1 = this.theEntity.func_180486_cf(); Vec3 var2 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)var1.getX(), (double)var1.getY(), (double)var1.getZ())); if (var2 == null) { return false; } else { this.movePosX = var2.xCoord; this.movePosY = var2.yCoord; this.movePosZ = var2.zCoord; return true; } } } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { return !this.theEntity.getNavigator().noPath(); } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.movementSpeed); } }